Payment Page Redirect
Create a PayPal payment via the Payment API and redirect the customer to PayPal to complete the transaction.
Payment workflow
For the full sequence diagram, see Payment workflow on the PayPal overview.
Looking for recurring billing?
One-time payments use this flow. For recurring billing with PayPal, see Subscriptions.
Implementation flow
- Make a Payment API request with
payment_type: paypal. - Receive the API response with
client_action = redirect. - Redirect your customer to the
urlprovided inaction_data. - The customer authenticates and completes the payment on PayPal.
- PayPal redirects the customer back to your
success_urlorerror_url. - Receive asynchronous postback notifications to
postback_urlabout transaction status — use the postback as the source of truth.
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_typeStringrequiredpaypalorder_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 to create a PayPal payment. See the Create Payment API reference for the full list of supported parameters.
Example RequestHTTP
POST /rest/payment
Authorization: Basic <base64(api_key:api_password)>
Content-Type: application/json
{
"payment_type": "paypal",
"order_id": "123000",
"amount": "29.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
messageStringOptional additional information about the transaction result
additional_transaction_dataStringAdditional transaction data provided by you. This will be shown in the dashboard as well as when you query for transaction data. It will also be sent back to your
postback_url as part of the postback data.amountFloatAmount of the transaction
included_feesStringIncluded fees for the transaction
error_codeIntegerError code for the response
client_actionStringIndicates the required client-side action. Value: redirect
action_dataObjectContains
url — redirect the customer to this PayPal URL to complete the paymentExample ResponseJSON
{
"transaction_id": "dbd3ab13-38f3-49da-9e12-47ef445b0b72",
"payment_type": "paypal",
"status_code": 2,
"status": "pending",
"order_id": "123000",
"message": null,
"additional_transaction_data": null,
"amount": 29.9,
"included_fees": "0.00",
"error_code": 0,
"client_action": "redirect",
"action_data": {
"url": "https://www.sandbox.paypal.com/checkoutnow?token=EC-XXXXXX"
}
}
Postbacks
For the full list of payment postback fields, see the Payment API. For refund postbacks, see the Refund API. For retry policy and signature verification, see Postbacks.