Introduction

Refunds the customer on a previous Deposit or Charge.

The Refund will always be made to the same bank account that was used in the original payment.

You must have sufficient funds on your merchant account to make the refund. No credit is given. If the deposit has not yet been 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.YesTextSEK
AttributesOptional attributes for this method. Send null as value if not used ("Attributes":null).YesObject{"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 of the initial deposit.Text1234567890
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.Text1

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.

PayoutConfirmation

A Payout Confirmation notification is sent to the merchant's NotificationURL when the transfer has been confirmed. Note: this notification is not enabled by default. Please speak to your Trustly contact person if you want to have it enabled.