Refund

Refund a payment back to the shopper.


To return funds to your shopper, you can refund all or part of their payment. For example: if an item in the order is out of stock, you refund that part of the payment.

When you make a refund request for a payment that was only pre-authorised, Datman captures the payment in full first and then refunds it.

Requirements

Before you begin, take into account the following requirements, limitations, and preparations.

RequirementDescription
Integration typeAn online payments integration.
API credentialsYour api_token, sent in the api_token header.
LimitationsThe refund can't be more than what's left to refund on the payment. If a payment has not been captured and you don't want to take it, you can reverse the authorisation instead.

Types of refunds

TypeDescription
Full refundYou refund the full amount of the payment.
Partial refundYou refund part of the amount of the payment. If you make several partial refunds, the sum of the refund amounts can't be more than the amount of the payment.

Make a refund

To return funds to the shopper:

  1. From the information of the payment you want to refund, get your order_id and the merchant_id.

  2. Make a refund request with your api_token header and the following parameters:

    ParameterRequiredDescription
    merchant_idRequiredThe merchant that took the payment.
    order_idRequiredYour own order reference for the payment, as you sent it when paying.
    amountRequiredThe amount to refund, in major units, for example 3.25. Minimum 0.01.
    reasonWhy the payment is refunded.
    requested_byWho asked for the refund, for your records.
    refund_split_feeFor a payment with splits: how much to take back from each merchant that received part of the payment. Each item has partner_merchant_id and refund_amount. The total can't be more than amount.

    The Refund a payment page in the API Explorer has the full request, with examples you can try.

  3. When you receive the response, note:

    • outcome: success when the refund was made, or failed when it wasn't. Errors are returned with HTTP 200, so always check outcome.
    • destination: the amount refunded to each destination, as strings, for example CARD 3.25.
    • transaction_methods: the payment method of the original payment (ECOM, GPAY, APPLEPAY or WALLET) and its original total, as strings.
    • message: present for an uncaptured pre-authorisation, which is captured first and then refunded.

    Example response for a refund request

    {
      "outcome": "success",
      "destination": {
        "CARD": "3.25"
      },
      "transaction_methods": {
        "ECOM": "27.75"
      }
    }
  4. To check the refunds recorded against a payment, get the refunds recorded against the transaction.

Reasons for a failed refund

When a refund fails, you receive outcome failed and a message with the reason. The next table shows the most common reasons.

messageDescription
Refund amount (30.00) cannot be greater than the original transaction amount (24.50).The refund amount is more than the amount of the payment.
Transaction already refunded: <reason>The payment has already been refunded.
No transaction found for order_id : <order_id> and merchant_id: <merchant_id>No payment matches the order_id and merchant_id.
Refund split amount (5.00) cannot be greater than the total refund amount (3.25).The total of refund_split_fee is more than amount.
Refund amount cannot be greater than the authorised amountFor a pre-authorisation, the refund amount is more than the authorised amount.
Pre-auth refund already in progressA refund of this pre-authorisation is already being processed.
Token is empty or Invalid tokenThe api_token header is missing or invalid.

See also

On this page

Need help?

Questions about your integration, credentials or going live?

Contact supportRequest a sandbox