Hosted Checkout Send customers to a SumUp-hosted payment page.
Install and configure your SDK or the SumUp CLI with sandbox credentials. Replace the sample merchant code and checkout reference with your own.
import SumUp from "@sumup/sdk" ;
async function main () {
const client = new SumUp ({ apiKey: "sup_sk_your_api_key" });
const result = await client.checkouts. create (
{
"checkout_reference" : "b50pr914-6k0e-3091-a592-890010285b3d" ,
"amount" : 12 ,
"currency" : "EUR" ,
"merchant_code" : "MCXXXXXX" ,
"hosted_checkout" : {
"enabled" : true
}
}
);
console. log (result);
}
main (). catch (console.error); using System ;
using System . Threading . Tasks ;
using SumUp ;
public static class Program
{
public static async Task Main ()
{
using var client = new SumUpClient ();
var response = await client.Checkouts. CreateAsync (
new CheckoutCreateRequest
{
Amount = 12f ,
CheckoutReference = "b50pr914-6k0e-3091-a592-890010285b3d" ,
Currency = Currency.Eur,
HostedCheckout = new HostedCheckout
{
Enabled = true ,
},
MerchantCode = "MCXXXXXX" ,
});
Console. WriteLine (response.StatusCode);
}
} import com.sumup.sdk.SumUpClient;
public final class CreateCheckoutHostedCheckoutSample {
public static void main ( String [] args ) throws Exception {
var client = new SumUpClient ();
var result = client. checkouts (). create (
com.sumup.sdk.models.CheckoutCreateRequest. builder ()
. amount ( 12.0f )
. checkoutReference ( "b50pr914-6k0e-3091-a592-890010285b3d" )
. currency (com.sumup.sdk.models.Currency. of ( "EUR" ))
. hostedCheckout (com.sumup.sdk.models.HostedCheckout. builder ()
. enabled ( true )
. build ())
. merchantCode ( "MCXXXXXX" )
. build ()
);
System.out. println (result);
}
} import os
import sumup
client = sumup.Sumup( api_key = os.environ[ "SUMUP_API_KEY" ])
result = client.checkouts.create(
checkout_reference = "b50pr914-6k0e-3091-a592-890010285b3d" ,
amount = 12 ,
currency = "EUR" ,
merchant_code = "MCXXXXXX" ,
hosted_checkout = {
"enabled" : True ,
},
)
print (result) <? php
declare ( strict_types = 1 );
require __DIR__ . '/vendor/autoload.php' ;
$sumup = new \SumUp\SumUp ( 'sup_sk_your_api_key' );
$body = [
'amount' => 12 ,
'checkout_reference' => 'b50pr914-6k0e-3091-a592-890010285b3d' ,
'currency' => 'EUR' ,
'hosted_checkout' => [
'enabled' => true ,
],
'merchant_code' => 'MCXXXXXX' ,
];
$result = $sumup -> checkouts () -> create (
$body,
);
var_dump ($result); package main
import (
" context "
" fmt "
" github.com/sumup/sumup-go "
)
func main () {
client := sumup. NewClient ()
result, err := client.Checkouts. Create (context. TODO (), sumup . CheckoutsCreateParams {
Amount: 12 ,
CheckoutReference: "b50pr914-6k0e-3091-a592-890010285b3d" ,
Currency: "EUR" ,
HostedCheckout: new ( sumup . HostedCheckout {
Enabled: true ,
}),
MerchantCode: "MCXXXXXX" ,
})
if err != nil {
panic (err. Error ())
}
fmt. Printf ( " %+v\n " , result)
} use sumup :: { Authorization , Client };
#[tokio :: main]
async fn main () {
let client = Client :: default ()
. with_authorization ( Authorization :: api_key ( "sup_sk_test_..." ));
let body = sumup :: resources :: checkouts :: CreateRequest {
amount : 12 f32 ,
checkout_reference : "b50pr914-6k0e-3091-a592-890010285b3d" . to_string (),
currency : sumup :: resources :: common :: Currency :: EUR ,
customer_id : None ,
description : None ,
hosted_checkout : Some ( sumup :: resources :: checkouts :: HostedCheckout {
enabled : true ,
}),
merchant_code : "MCXXXXXX" . to_string (),
purpose : None ,
redirect_url : None ,
return_url : None ,
valid_until : None ,
};
let response = client . checkouts () . create (body) .await. expect ( "create request failed" );
println! ( "{response:#?}" );
} sumup --json checkouts create \
--merchant-code 'MCXXXXXX' \
--reference 'b50pr914-6k0e-3091-a592-890010285b3d' \
--amount 12 \
--currency 'EUR' \
--hosted-checkout {
"id" : "64553e20-3f0e-49e4-8af3-fd0eca86ce91" ,
"hosted_checkout_url" : "https://checkout.sumup.com/pay/8f9316a3-cda9-42a9-9771-54d534315676"
} Redirect the customer to hosted_checkout_url. Verify the final checkout status on your server before fulfilling the order.
Payment Widget Embed SumUp’s payment form in your website.
Create a checkout on your server first. Replace CHECKOUT_ID_FROM_YOUR_SERVER with its ID; keep secret API keys on your server.
< div id = "sumup-card" ></ div >
< script src = "https://gateway.sumup.com/gateway/ecom/card/v2/sdk.js" ></ script >
< script >
SumUpCard. mount ({
id: "sumup-card" ,
checkoutId: "CHECKOUT_ID_FROM_YOUR_SERVER" ,
});
</ script > The widget collects payment details and handles authentication. Verify the final checkout status on your server before fulfilling the order.
Mobile SDK in-person payments Accept in-person payments from your Android or iOS app.
Initialize the Reader SDK with an affiliate key linked to your application or bundle ID, log in a sandbox merchant, and connect a supported reader. The Android example uses EUR; iOS uses the merchant’s currency.
import SumUpSDK
import UIKit
@MainActor
func takePayment ( from controller: UIViewController) async throws {
guard let currency = SumUpSDK.currentMerchant ? .currencyCode else { return }
let request = CheckoutRequest (
total : NSDecimalNumber ( string : "12.00" ),
title : nil , currencyCode : currency
)
let result = try await SumUpSDK. checkout ( with : request, from : controller)
if result.success { print (result.transactionCode ?? "" ) }
} import android.app.Activity
import com.sumup.merchant.reader.api.SumUpAPI
import com.sumup.merchant.reader.api.SumUpPayment
import java.math.BigDecimal
fun takePayment (activity: Activity ) {
val payment = SumUpPayment. builder ()
. total ( BigDecimal ( "12.00" ))
. currency (SumUpPayment.Currency.EUR)
. build ()
SumUpAPI. checkout (activity, payment, 2 )
} Handle the payment result in your app: check result.success on iOS, or RESULT_CODE in onActivityResult for Android request code 2. Retain transaction identifiers and handle cancellation and errors.
Server SDK in-person payments Start a payment on a Solo reader from your backend.
Use a paired, online Solo reader, a sandbox API key, and your merchant and reader IDs. You can test with Virtual Solo.
import SumUp from "@sumup/sdk" ;
async function main () {
const client = new SumUp ({ apiKey: "sup_sk_your_api_key" });
const result = await client.readers. createCheckout (
"MC0X0ABC" ,
"rdr_3MSAFM23CK82VSTT4BN6RWSQ65" ,
{
"total_amount" : {
"currency" : "EUR" ,
"minor_unit" : 2 ,
"value" : 5033
}
}
);
console. log (result);
}
main (). catch (console.error); sumup readers checkout "rdr_3MSAFM23CK82VSTT4BN6RWSQ65" \
--merchant-code "MC0X0ABC" \
--amount "50.33" \
--minor-unit "2" \
--currency "EUR" using System ;
using System . Threading . Tasks ;
using SumUp ;
public static class Program
{
public static async Task Main ()
{
using var client = new SumUpClient ();
var response = await client.Readers. CreateCheckoutAsync (
"your-merchant-code" ,
"your-reader-id" ,
new CreateReaderCheckoutRequest
{
TotalAmount = new CreateReaderCheckoutRequestTotalAmount
{
Currency = "EUR" ,
MinorUnit = 2 ,
Value = 5033 ,
},
});
Console. WriteLine (response.StatusCode);
}
} import com.sumup.sdk.SumUpClient;
public final class CreateReaderCheckoutSample {
public static void main ( String [] args ) throws Exception {
var client = new SumUpClient ();
var result = client. readers (). createCheckout (
"MC0X0ABC" ,
"rdr_3MSAFM23CK82VSTT4BN6RWSQ65" ,
com.sumup.sdk.models.CreateReaderCheckoutRequest. builder ()
. totalAmount (com.sumup.sdk.models.Money. builder ()
. currency ( "EUR" )
. minorUnit ( 2L )
. value ( 5033L )
. build ())
. build ()
);
System.out. println (result);
}
} import os
import sumup
client = sumup.Sumup( api_key = os.environ[ "SUMUP_API_KEY" ])
result = client.readers.create_checkout(
"MC0X0ABC" ,
"rdr_3MSAFM23CK82VSTT4BN6RWSQ65" ,
total_amount = {
"currency" : "EUR" ,
"minor_unit" : 2 ,
"value" : 5033 ,
},
)
print (result) <? php
declare ( strict_types = 1 );
require __DIR__ . '/vendor/autoload.php' ;
$sumup = new \SumUp\SumUp ( 'sup_sk_your_api_key' );
$body = [
'total_amount' => [
'currency' => 'EUR' ,
'minor_unit' => 2 ,
'value' => 5033 ,
],
];
$result = $sumup -> readers () -> createCheckout (
'MC0X0ABC' ,
'rdr_3MSAFM23CK82VSTT4BN6RWSQ65' ,
$body,
);
var_dump ($result); package main
import (
" context "
" fmt "
" github.com/sumup/sumup-go "
)
func main () {
client := sumup. NewClient ()
result, err := client.Readers. CreateCheckout (context. TODO (), "MC0X0ABC" , "rdr_3MSAFM23CK82VSTT4BN6RWSQ65" , sumup . ReadersCreateCheckoutParams {
TotalAmount: sumup . CreateCheckoutRequestTotalAmount {
Currency: "EUR" ,
MinorUnit: 2 ,
Value: 5033 ,
},
})
if err != nil {
panic (err. Error ())
}
fmt. Printf ( " %+v\n " , result)
} use sumup :: { Authorization , Client };
#[tokio :: main]
async fn main () {
let client = Client :: default ()
. with_authorization ( Authorization :: api_key ( "sup_sk_test_..." ));
let body = sumup :: resources :: readers :: CreateCheckoutRequest {
aade : None ,
affiliate : None ,
card_type : None ,
description : None ,
installments : None ,
return_url : None ,
tip_rates : None ,
tip_timeout : None ,
total_amount : sumup :: resources :: readers :: CreateCheckoutRequestTotalAmount {
currency : "EUR" . to_string (),
minor_unit : 2 i64 ,
value : 5033 i64 ,
},
};
let response = client
. readers ()
. create_checkout ( "MERCHANT_CODE" , "READER_ID" , body)
.await
. expect ( "create_checkout request failed" );
println! ( "{response:#?}" );
} Store the returned client_transaction_id. Use it to retrieve the transaction and verify its final status before marking the order paid.