Introduction

Refunds the customer on a previous deposit.

Trustly will refund the customer to the payment source of the original deposit.

You must have sufficient funds on your merchant account to make the refund. No credit is given. If the deposit has not yet settled when the refund request is received, the refund will be queued and executed once the money for the deposit has been received.

Request parameters

Parameter nameDescriptionReq.TypeExample
UsernameThe username.YesTextjoe
PasswordThe password.YesTextsecret
OrderIDThe OrderID of the initial deposit.YesText1234567890
AmountThe amount to refund the customer. See format in Currencies. Only digits. Use dot (.) as decimal separator.YesText98.02
CurrencyThe currency of the amount to refund the customer.YesChar(3)SEK
AttributesOptional attributes for this method. Send null as value if not used ("Attributes":null).YesHash{"ExternalReference ":"123"}

Attributes

Attribute nameDescriptionRequiredTypeExample
ExternalReferenceThe ExternalReference is a reference set by the merchant for any purpose and does not need to be unique for every API call. The ExternalReference will be included in version 1.2 of the settlement report, ViewAutomaticSettlementDetailsCSV.NoText123

The result returned is a hash with the following elements:

Hash keyDescriptionTypeExample
orderidThe OrderID specified when calling the method.BigInt7267342
result"1" if the refund request is accepted by Trustly's system. If the refund request is not accepted, you will get an error code back as described here.Boolean1

Code example

{
    "method": "Refund",
    "params": {
        "Signature": "W6JH1qeGCt...JOi5E80Adw==",
        "UUID": "8bedfbd4-8181-38e1-f0be-f360171aefc6",
        "Data": {
            "Username": "merchant_username",
            "Password": "merchant_password",
            "OrderID": 1187741486,
            "Amount": "30.00",
            "Currency": "EUR",
            "Attributes": null
        }
    },
    "version": 1.1
}
{
    "version": "1.1",
    "result": {
        "signature": "CeYDdgTi...jfzXlR3iSLQjt5Yl9w==",
        "method": "Refund",
        "data": {
            "result": "1",
            "orderid": "1187741486"
        },
        "uuid": "8bedfbd4-8181-38e1-f0be-f360171aefc6"
    }
}

Failed Refunds

In case an error occurs when processing the Refund (after the "result" : "1" response has been sent), a credit notification will be sent to the NotificationURL provided in the original Deposit call so that the merchant can flag the Refund as failed in their system. This is uncommon but can happen for example if the end user's bank account has been closed. In this case, the funds will be returned to the merchant's Trustly account balance.

A refund call can also fail with a synchronous error code, see more details here.