Skip to main content

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​

  1. Make a Payment API request.
  2. Receive API response with client_action.
  3. Redirect your customer to the payment page URL in action_data.
  4. Customer is redirected to success_url or error_url.
  5. Receive asynchronous postback notifications to postback_url about transaction status.

For a general walkthrough of credentials, authentication, and postbacks, see Get Started — Payment Page Redirect.

Create a payment​

POST/rest/payment
payment_typeStringrequired
cardecom
order_idStringrequired
Any alphanumeric string to identify the Merchant's order
amountFloatrequired
Amount of the transaction including all taxes and shipping fees
currencyStringrequired
3 letter currency code
postback_urlStringrequired
The URL for updates about transaction status are posted
success_urlStringrequired
Where to redirect the user after a successful transaction
error_urlStringrequired
Where 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_idString
ID of the created transaction
payment_typeString
Payment type of the transaction
status_codeInteger
Status code of the transaction
statusString
Status of the transaction
order_idString
Order ID of the transaction
error_codeInteger
Error code for the response
client_actionString
Required client-side action. Values: redirect or postForm. When not returned, no action is required.
action_dataObject
Contains 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

ParameterTest Value
card_number4761070000000509
card_holderany name
card_cvvany 3 digit number
card_expiry_monthany month (e.g. 12)
card_expiry_yearany year in the future (e.g. 2026)

mastercard

ParameterTest Value
card_number5286940020000908
card_holderany name
card_cvvany 3 digit number
card_expiry_monthany month (e.g. 12)
card_expiry_yearany year in the future (e.g. 2026)