Skip to main content

Checkout API

POST/rest/checkouts

Checkout 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_nameStringrequired
Name of the merchant displayed on the checkout page
order_idStringrequired
Any alphanumeric string to identify the Merchant's order
referenceString
Reference for the checkout session
descriptionString
Description about the product or service
currencyStringrequired
3 letter currency code
amountFloatrequired
Amount of the transaction
amount_taxesFloat
Tax amount
amount_shippingFloat
Shipping amount
total_amountFloatrequired
Total amount including taxes and shipping
collect_dobInteger
Whether to collect date of birth (0 or 1)
collect_phoneInteger
Whether to collect phone number (0 or 1)
collect_genderInteger
Whether to collect gender (0 or 1)
collect_shipping_addressInteger
Whether to collect shipping address (0 or 1)
collect_billing_addressInteger
Whether to collect billing address (0 or 1)
display_transaction_detailsInteger
Whether to display transaction details (0 or 1)
display_manual_payment_instruction_to_customerInteger
Whether to display manual payment instructions (0 or 1)
payment_instruction_merchant_account_holderString
Merchant account holder name for manual payment instructions
payment_instruction_merchant_ibanString
Merchant IBAN for manual payment instructions
payment_instruction_merchant_bicString
Merchant BIC for manual payment instructions
success_urlStringrequired
Where to redirect the user after a successful transaction
error_urlStringrequired
Where to redirect the user after a failed transaction
postback_urlStringrequired
The 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.emailString
Customer email
prefill_customer_info.phoneString
Customer phone number
prefill_customer_info.companyString
Company name
prefill_customer_info.first_nameString
Customer first name
prefill_customer_info.last_nameString
Customer last name
prefill_customer_info.addressString
Street address
prefill_customer_info.address2String
Complementary address
prefill_customer_info.cityString
City
prefill_customer_info.stateString
State
prefill_customer_info.postal_codeString
Postal code
prefill_customer_info.countryString
Country 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_idString
ID of the created checkout session
error_codeInteger
Error code for the response
statusString
Status of the checkout session (e.g. open)
client_actionString
Indicates the required client-side action. Value: redirect — redirect the customer to the url in action_data
action_dataObject
Contains: url — the checkout page URL to redirect the customer to
Example 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"
}
}