Refund a transaction

Background
Before starting this tutorial, make sure you understand the following topics from the Quick start section:

You can use a payment method to refund a transaction. To do so, you must have the Nexio payment id from the transaction.

Not every payment method supports refunding a transaction.

The following payment methods support refunds:

📘

Note

  • Paynet is not currently supported in refunds.

To refund a transaction

  1. Retrieve the Nexio payment id from the transaction you want to do a refund for. You can do this if you stored that ID for the original transaction or you can search for the transaction in the Nexio dashboard (or through one of the Transactions endpoints, such as Get APM iframe).

  2. Submit the refund transaction request (for more details and options, see the Refund an APM transaction endpoint).
    You must include the Nexio payment id and the data.amount to refund.

    📘

    Note

    The amount does not have to be same as the full amount for the original transaction, but it cannot exceed the original amount.

    For example, to refund 5.15 for a previous transaction with an id of 7971, send the following request:

    curl -X POST https://api.nexiopaysandbox.com/apm/v3/refund \
       -H 'Content-Type: application/json' \
       -H 'Accept: application/json' \
       -H 'Authorization: Basic [Base64_encoded_login]'
       -d '{
       "id": "7971",
       "data": {
          "amount": 5.15
       }
    }'
    

    The response includes the message parameter, which specifies whether the request was successful.

    {
       "id": "7971",
       "merchantId": "100039",
       "transactionDate": "2019-01-15T13:19:39.329Z",
       "amount": 5.15,
       "transactionType": "sale",
       "currency": "EUR",
       "gatewayResponse": {
          "result": 200,
          "refNumber": "8E56222GD0701110",
          "gatewayName": "payPal",
          "message": 200
       },
       "data": {
          "amount": 5.15,
          "currency": "EUR",
          "settlementCurrency": "EUR"
       },
       "message": "success"
    }
    

  3. For a successful request, the refund status gets set to PENDING.