Checkout API
POST/rest/checkouts
/rest/checkoutsCheckout API is used to create checkout sessions where merchants don't have their own checkout page. This way, merchants can easily share payment links with their customers, where they can select one of the available payment methods and fill in their information to pay for a product or a service.
Checkout API is a low-code solution for merchants to accept payments from their customers. When creating a checkout link, configured payment methods in your merchant account will be available for the customers to choose from — including Google Pay and Apple Pay if enabled.
Checkout API Request
merchant_nameStringrequiredName of the merchant displayed on the checkout page
order_idStringrequiredAny alphanumeric string to identify the Merchant's order
referenceStringReference for the checkout session
descriptionStringDescription about the product or service
currencyStringrequired3 letter currency code
amountFloatrequiredAmount of the transaction
amount_taxesFloatTax amount
amount_shippingFloatShipping amount
total_amountFloatrequiredTotal amount including taxes and shipping
collect_dobIntegerWhether to collect date of birth (
0 or 1)collect_phoneIntegerWhether to collect phone number (
0 or 1)collect_genderIntegerWhether to collect gender (
0 or 1)collect_shipping_addressIntegerWhether to collect shipping address (
0 or 1)collect_billing_addressIntegerWhether to collect billing address (
0 or 1)display_transaction_detailsIntegerWhether to display transaction details (
0 or 1)display_manual_payment_instruction_to_customerIntegerWhether to display manual payment instructions (
0 or 1)payment_instruction_merchant_account_holderStringMerchant account holder name for manual payment instructions
payment_instruction_merchant_ibanStringMerchant IBAN for manual payment instructions
payment_instruction_merchant_bicStringMerchant BIC for manual payment instructions
success_urlStringrequiredWhere to redirect the user after a successful transaction
error_urlStringrequiredWhere to redirect the user after a failed transaction
postback_urlStringrequiredThe URL for updates about transaction status are posted
Example Request
POST /rest/checkouts
Authorization: Basic <base64(api_key:api_password)>
Content-Type: application/json
{
"merchant_name": "Merchant Name",
"order_id": "ORD001",
"reference": "Some reference",
"description": "Description about the product or service",
"currency": "EUR",
"amount": 10,
"amount_taxes": 2,
"amount_shipping": 1,
"total_amount": 13,
"collect_dob": 0,
"collect_phone": 1,
"collect_gender": 0,
"collect_shipping_address": 0,
"collect_billing_address": 1,
"display_transaction_details": 1,
"success_url": "https://your-success.url.com",
"error_url": "https://your-error.url.com",
"postback_url": "https://your-postback.url.com"
}
Prefill Customer Info Parameters
You can optionally prefill customer information by including a prefill_customer_info object:
prefill_customer_info.emailStringCustomer email
prefill_customer_info.phoneStringCustomer phone number
prefill_customer_info.companyStringCompany name
prefill_customer_info.first_nameStringCustomer first name
prefill_customer_info.last_nameStringCustomer last name
prefill_customer_info.addressStringStreet address
prefill_customer_info.address2StringComplementary address
prefill_customer_info.cityStringCity
prefill_customer_info.stateStringState
prefill_customer_info.postal_codeStringPostal code
prefill_customer_info.countryStringCountry code (ISO 3166-1 alpha-2)
Prefill Customer Info Fields
{
"prefill_customer_info": {
"email": "john.doe@email.com",
"phone": "+49 30 1234567",
"company": "My Company",
"first_name": "John",
"last_name": "Doe",
"address": "Rosenthalerstr. 8",
"address2": "Apt 3",
"city": "Berlin",
"state": "Berlin",
"postal_code": "10178",
"country": "DE"
}
}
Checkout API Response
checkout_idStringID of the created checkout session
error_codeIntegerError code for the response
statusStringStatus of the checkout session (e.g.
open)client_actionStringIndicates the required client-side action. Value: redirect — redirect the customer to the
url in action_dataaction_dataObjectContains:
url — the checkout page URL to redirect the customer toExample Response
{
"checkout_id": "7a87a507-91e8-4882-9b2d-19f35434d946",
"error_code": 0,
"status": "open",
"client_action": "redirect",
"action_data": {
"url": "https://testapi.betterpayment.de/rest/checkouts/7a87a507-91e8-4882-9b2d-19f35434d946"
}
}