How to perform a payment
This section shows how to perform a payment.
Request body
Request body
{ "initialAmount": 100, "currency": "EUR", "product": "paypal",
PayPal Debit Payment Body -JSON Format
Parameter | Mandatory | Description |
---|---|---|
initialAmount | mandatory | Amount as smallest currency unit e.g 100€ will be result in amount = 10000 |
currency | mandatory | Currency code according to ISO 4217 |
product | mandatory | Payment product (method) to be used for this order |
async | mandatory* | Mandatory for asynchronous payment products like PayPal |
merchantOrderId | optional | The order id from your system/shop |
description | optional | The description from your system/shop of this order |
customer | mandatory | The customer id which will be used to process this order |
PayPal Debit Payment Body - async - JSON Format
Parameter | Mandatory | Description |
---|---|---|
successUrl | mandatory | In case of a successful order the customer will be redirected to the given URL |
failureUrl | mandatory | In case of a failed order the customer will be redirected to the given URL |
cancelUrl | mandatory | In case of a cancellation by the customer, the customer will be redirected to the given URL |
Find more information on potential body parameters in our API reference.
Send request with curl
Send the request via curl - line breaks for readability
curl --user MerchantID:APIKey \ -H "Content-Type: application/json" -X POST \ -d '{"initialAmount": 100,"currency": "EUR","product": "paypal","async": \
curl command - descriptions
We will now touch on every part of this command.
--user MerchantID:APIKey
Curl Option for HTTP basic access authentication.
-H "Content-Type: application/json"
content-type header "application/json" for our API.
-X POST
We want the request to be a HTTP POST.
-d '{"initialAmount": 100,"currency": "EUR","product": "paypal","async": {"successUrl": "https://myshop.com/success/","failureUrl": "https://myshop.com/fail/","cancelUrl": "https://myshop.com/cancel/"},"merchantOrderId": "#0000000001","description": "Order at myshop.com","customer": "Customer-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}'
The body for our request in JSON format.
https://apitest.payengine.de/v1/orders/debit/
The orders debit endpoint of our API (Test in this case).
curl command - response
If the request was successful we should get a response that looks like this:
Response
{ "createdAt": 1502092403541, "modifiedAt": 1502092403557, "merchantId": "Merchant-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
Find more information in our API reference.