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" ;
const client = new SumUp ({ apiKey : "sup_sk_your_api_key" });
const checkout = await client . checkouts .create ({
checkout_reference : "order-123" ,
amount : 12 ,
currency : "EUR" ,
merchant_code : "MERCHANT_CODE" ,
hosted_checkout : { enabled : true } ,
});
console .log ( checkout .hosted_checkout_url); sumup --json checkouts create \
--merchant-code MERCHANT_CODE \
--reference order-123 \
--amount 12 \
--currency EUR \
--hosted-checkout using System ;
using SumUp ;
using var client = new SumUpClient ( new SumUpClientOptions
{
AccessToken = "sup_sk_your_api_key" ,
});
var response = await client . Checkouts . CreateAsync ( new CheckoutCreateRequest
{
CheckoutReference = "order-123" ,
Amount = 12f ,
Currency = Currency . Eur ,
MerchantCode = "MERCHANT_CODE" ,
HostedCheckout = new HostedCheckout { Enabled = true } ,
});
Console . WriteLine ( response . Data ? . HostedCheckoutUrl ); import com . sumup . sdk . SumUpClient ;
import com . sumup . sdk . models . CheckoutCreateRequest ;
import com . sumup . sdk . models . Currency ;
import com . sumup . sdk . models . HostedCheckout ;
public class HostedCheckoutSample {
public static void main ( String [] args) throws Exception {
var client = new SumUpClient( "sup_sk_your_api_key" ) ;
var checkout = client . checkouts () . create (
CheckoutCreateRequest . builder ()
. checkoutReference ( "order-123" )
. amount ( 12f )
. currency ( Currency . of ( "EUR" ))
. merchantCode ( "MERCHANT_CODE" )
. hostedCheckout ( HostedCheckout . builder () . enabled ( true ) . build ())
. build ()
);
System . out . println ( checkout . hostedCheckoutUrl ());
}
} from sumup import Sumup
with Sumup (api_key = "sup_sk_your_api_key" ) as client :
checkout = client . checkouts . create (
checkout_reference = "order-123" ,
amount = 12 ,
currency = "EUR" ,
merchant_code = "MERCHANT_CODE" ,
hosted_checkout = { "enabled" : True },
)
print (checkout.hosted_checkout_url) <? php
require __DIR__ . '/vendor/autoload.php' ;
$client = new \ SumUp \ SumUp ( 'sup_sk_your_api_key' ) ;
$checkout = $client -> checkouts () -> create ( [
'checkout_reference' => 'order-123' ,
'amount' => 12 ,
'currency' => 'EUR' ,
'merchant_code' => 'MERCHANT_CODE' ,
'hosted_checkout' => [ 'enabled' => true ] ,
] ) ;
echo $checkout -> hostedCheckoutUrl; package main
import (
"context"
"fmt"
"log"
"github.com/sumup/sumup-go"
)
func main () {
client := sumup. NewClient ()
checkout, err := client.Checkouts. Create (context. Background (), sumup . CheckoutsCreateParams {
CheckoutReference: "order-123" ,
Amount: 12 ,
Currency: "EUR" ,
MerchantCode: "MERCHANT_CODE" ,
HostedCheckout: & sumup . HostedCheckout {Enabled: true },
})
if err != nil {
log. Fatal (err)
}
fmt. Println ( * checkout.HostedCheckoutURL)
} use sumup :: { Authorization , Client };
use sumup :: resources :: checkouts :: { CreateRequest , HostedCheckout };
use sumup :: resources :: common :: Currency ;
#[tokio :: main]
async fn main () -> Result <(), Box < dyn std :: error :: Error >> {
let client = Client :: default ()
. with_authorization (Authorization :: api_key ( "sup_sk_your_api_key" ));
let body = CreateRequest :: builder ()
. checkout_reference ( "order-123" )
. amount ( 12 . 0 )
. currency (Currency :: EUR)
. merchant_code ( "MERCHANT_CODE" )
. hosted_checkout (HostedCheckout :: builder () . enabled ( true ) . build ())
. build ();
let checkout = client . checkouts () . create (body) .await? ;
println! ( "{}" , checkout . hosted_checkout_url . unwrap_or_default ());
Ok (())
} {
"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" ;
const client = new SumUp ({ apiKey : "sup_sk_your_api_key" });
const checkout = await client . readers .createCheckout (
"MERCHANT_CODE" ,
"READER_ID" ,
{ total_amount : { currency : "EUR" , minor_unit : 2 , value : 1200 } } ,
);
console .log ( checkout . data .client_transaction_id); sumup --json readers checkout READER_ID \
--merchant-code MERCHANT_CODE \
--amount 12 \
--currency EUR using System ;
using SumUp ;
using var client = new SumUpClient ( new SumUpClientOptions
{
AccessToken = "sup_sk_your_api_key" ,
});
var response = await client . Readers . CreateCheckoutAsync (
"MERCHANT_CODE" ,
"READER_ID" ,
new CreateReaderCheckoutRequest
{
TotalAmount = new CreateReaderCheckoutRequestTotalAmount
{
Currency = "EUR" ,
MinorUnit = 2 ,
Value = 1200 ,
} ,
});
Console . WriteLine ( response . Data ? . Data . ClientTransactionId ); import com . sumup . sdk . SumUpClient ;
import com . sumup . sdk . models . CreateReaderCheckoutRequest ;
import com . sumup . sdk . models . Money ;
public class ReaderCheckoutSample {
public static void main ( String [] args) throws Exception {
var client = new SumUpClient( "sup_sk_your_api_key" ) ;
var checkout = client . readers () . createCheckout (
"MERCHANT_CODE" ,
"READER_ID" ,
CreateReaderCheckoutRequest . builder ()
. totalAmount ( Money . builder ()
. currency ( "EUR" )
. minorUnit ( 2L )
. value ( 1200L )
. build ())
. build ()
);
System . out . println ( checkout . data () . clientTransactionId ());
}
} from sumup import Sumup
with Sumup (api_key = "sup_sk_your_api_key" ) as client :
checkout = client . readers . create_checkout (
"MERCHANT_CODE" ,
"READER_ID" ,
total_amount = { "currency" : "EUR" , "minor_unit" : 2 , "value" : 1200 },
)
print (checkout.data.client_transaction_id) <? php
require __DIR__ . '/vendor/autoload.php' ;
$client = new \ SumUp \ SumUp ( 'sup_sk_your_api_key' ) ;
$checkout = $client -> readers () -> createCheckout ( 'MERCHANT_CODE' , 'READER_ID' , [
'total_amount' => [
'currency' => 'EUR' ,
'minor_unit' => 2 ,
'value' => 1200 ,
] ,
] ) ;
echo $checkout -> data -> clientTransactionId; package main
import (
"context"
"fmt"
"log"
"github.com/sumup/sumup-go"
)
func main () {
client := sumup. NewClient ()
checkout, err := client.Readers. CreateCheckout (
context. Background (), "MERCHANT_CODE" , "READER_ID" ,
sumup . ReadersCreateCheckoutParams {
TotalAmount: sumup . CreateCheckoutRequestTotalAmount {
Currency: "EUR" ,
MinorUnit: 2 ,
Value: 1200 ,
},
},
)
if err != nil {
log. Fatal (err)
}
fmt. Println (checkout.Data.ClientTransactionID)
} use sumup :: { Authorization , Client };
use sumup :: resources :: readers :: { CreateCheckoutRequest , CreateCheckoutRequestTotalAmount };
#[tokio :: main]
async fn main () -> Result <(), Box < dyn std :: error :: Error >> {
let client = Client :: default ()
. with_authorization (Authorization :: api_key ( "sup_sk_your_api_key" ));
let body = CreateCheckoutRequest :: builder ()
. total_amount (CreateCheckoutRequestTotalAmount :: builder ()
. currency ( "EUR" )
. minor_unit ( 2 )
. value ( 1200 )
. build ())
. build ();
let checkout = client . readers ()
. create_checkout ( "MERCHANT_CODE" , "READER_ID" , body)
.await? ;
println! ( "{}" , checkout . data . client_transaction_id);
Ok (())
} Store the returned client_transaction_id. Use it to retrieve the transaction and verify its final status before marking the order paid.