Skip to content

    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

    ParameterMandatoryDescription
    initialAmountmandatoryAmount as smallest currency unit e.g 100€ will be result in amount = 10000
    currencymandatoryCurrency code according to ISO 4217
    productmandatoryPayment product (method) to be used for this order
    asyncmandatory*Mandatory for asynchronous payment products like PayPal
    merchantOrderIdoptionalThe order id from your system/shop
    descriptionoptionalThe description from your system/shop of this order
    customermandatoryThe customer id which will be used to process this order

    PayPal Debit Payment Body - async - JSON Format

    ParameterMandatoryDescription
    successUrlmandatoryIn case of a successful order the customer will be redirected to the given URL
    failureUrlmandatoryIn case of a failed order the customer will be redirected to the given URL
    cancelUrlmandatoryIn 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.

    Was this helpful?

    What was your feeling about it?