Payment Page Redirect
Redirect the customer to our PCI DSS compliant payment page. Card data is collected on the hosted page — it does not pass through your systems.
Payment workflow
For the full sequence diagram, see Payment workflow on the Card ECOM overview.
Implementation flow
- Make a Payment API request.
- Receive API response with
client_action. - Redirect your customer to the
payment pageURL inaction_data. - Customer is redirected to
success_urlorerror_url. - Receive asynchronous postback notifications to
postback_urlabout transaction status.
For a general walkthrough of credentials, authentication, and postbacks, see Get Started — Payment Page Redirect.
Create a payment
POST/rest/payment
/rest/paymentProduction URL
https://api.betterpayment.de/rest/paymentTest URL
https://testapi.betterpayment.de/rest/paymentpayment_typeStringrequiredcardecomorder_idStringrequiredAny alphanumeric string to identify the Merchant's order
amountFloatrequiredAmount of the transaction including all taxes and shipping fees
currencyStringrequired3 letter currency code
postback_urlStringrequiredThe URL for updates about transaction status are posted
success_urlStringrequiredWhere to redirect the user after a successful transaction
error_urlStringrequiredWhere to redirect the user after a failed transaction
This example includes only the minimum required parameters. See the Payment API Reference for the full list.
Example RequestHTTP
POST /rest/payment
Authorization: Basic <base64(api_key:api_password)>
Content-Type: application/json
{
"payment_type": "cardecom",
"order_id": "12345678",
"amount": "15.90",
"currency": "EUR",
"postback_url": "https://your-postback.url.com",
"success_url": "https://your-success.url.com",
"error_url": "https://your-error.url.com"
}
Payment API Response
transaction_idStringID of the created transaction
payment_typeStringPayment type of the transaction
status_codeIntegerStatus code of the transaction
statusStringStatus of the transaction
order_idStringOrder ID of the transaction
error_codeIntegerError code for the response
client_actionStringRequired client-side action. Values: redirect or postForm. When not returned, no action is required.
action_dataObjectContains
url (target URL) and, for postForm, fields (key/value pairs to post).Example ResponseJSON
{
"transaction_id": "d1bf9fdf-7268-406f-9e08-8d5a9540ab97",
"order_id": "12345678",
"error_code": 0,
"status_code": 1,
"status": "started",
"client_action": "redirect",
"action_data": {
"url": "https://testapi.betterpayment.de/payment/d1bf9fdf-7268-406f-9e08-8d5a9540ab97"
}
}
Postbacks
For the full list of payment postback fields (including card-specific fields such as card_last_four and card_brand), see the Payment API. For refund postbacks, see the Refund API. For retry policy and signature verification, see Postbacks.
Test Data
Enter these values on the hosted payment page.
Visa
| Parameter | Test Value |
|---|---|
card_number | 4761070000000509 |
card_holder | any name |
card_cvv | any 3 digit number |
card_expiry_month | any month (e.g. 12) |
card_expiry_year | any year in the future (e.g. 2026) |
mastercard
| Parameter | Test Value |
|---|---|
card_number | 5286940020000908 |
card_holder | any name |
card_cvv | any 3 digit number |
card_expiry_month | any month (e.g. 12) |
card_expiry_year | any year in the future (e.g. 2026) |