Refunds

Walks through looking up transactions and issuing full or partial refunds.

Last updated View as Markdown

Overview

In this guide, you will learn how to refund a transaction. You will go through the following steps:

  1. Look up a transaction ID (Optional)
  2. Refund a transaction by using one of the available options:

When you complete these steps, the payment you have previously processed through SumUp will be refunded either partially or in full.

Before You Begin

Here are the things that you need in order to complete the steps in this guide:

Note

Transactions are associated with active merchant user accounts. As a result, you cannot use an access token obtained via the Client credentials flow to complete the steps in this guide.

Steps

1. Look up a Transaction ID

Note

If you already have the ID of the transaction you want to refund, you can skip this step and continue with Step 2.

  1. Make a GET request to the https://api.sumup.com/v0.1/checkouts/{id} endpoint, where the value of the {id} path parameter is the identifier of the checkout resource.

Example request:

Retrieve a Checkout
curl -X GET \
https://api.sumup.com/v0.1/checkouts/4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2 \
-H "Authorization: Bearer $SUMUP_API_KEY"
const checkout = await client.checkouts.get("4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2");
var checkout = await client.Checkouts.GetAsync("4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2");
var checkout = client.checkouts().getCheckout("4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2");
ctx := context.Background()
client := sumup.NewClient()

checkout, err := client.Checkouts.Get(ctx, "4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2")
checkout = client.checkouts.get("4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2")
let checkout = client
.checkouts()
.get("4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2")
.await?;
<?php

$checkout = $sumup->checkouts->get('4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2');
$checkoutReference = $checkout->checkout_reference;
$checkoutId = $checkout->id;

The response contains a JSON body with the full details of the processed checkout resource. You can find the transaction ID in the id attribute of the respective transaction resource (664200af-2b62-4142-9c73-a2a505310d78 in the sample response below).

{
  "checkout_reference": "CO287866",
  ...
  "id": "4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2",
  ...
  "transactions": [
    {
      "id": "664200af-2b62-4142-9c73-a2a505310d78",
      ...
    }
  ]
}

2. Refund a Transaction

Make a Full Refund

  1. Make a POST request with an empty request body to the https://api.sumup.com/v0.1/me/refund/{txn_id} endpoint, where the value of the {txn_id} path parameter is the identifier of the transaction resource.

Example request for the transaction with identifier 664200af-2b62-4142-9c73-a2a505310d78:

Make a Full Refund
curl -X POST \
https://api.sumup.com/v0.1/me/refund/19aa3cca-89f6-42d2-b462-463b0b53e959 \
-H "Authorization: Bearer $SUMUP_API_KEY"
await client.transactions.refund("19aa3cca-89f6-42d2-b462-463b0b53e959");
await client.Transactions.RefundAsync("19aa3cca-89f6-42d2-b462-463b0b53e959");
client.transactions().refundTransaction(
  "19aa3cca-89f6-42d2-b462-463b0b53e959",
  RefundTransactionRequest.builder().build()
);
ctx := context.Background()
client := sumup.NewClient()

err := client.Transactions.Refund(ctx, "19aa3cca-89f6-42d2-b462-463b0b53e959", sumup.TransactionsRefundParams{})
from sumup.transactions.resource import RefundTransactionBody

client.transactions.refund(
"19aa3cca-89f6-42d2-b462-463b0b53e959",
RefundTransactionBody(),
)
client
.transactions()
.refund("19aa3cca-89f6-42d2-b462-463b0b53e959", None)
.await?;
<?php

$sumup->transactions->refund('19aa3cca-89f6-42d2-b462-463b0b53e959');

The response returns a 204 HTTP status code and contains no body.

Make a Partial Refund

  1. Make a POST request to the https://api.sumup.com/v0.1/me/refund/{txn_id} endpoint, where the value of the {txn_id} path parameter is the identifier of the transaction resource.

Unlike the option for a full refund, the request body for partial refunds should be a JSON object with the amount you want to refund for the transaction.

Example request for a partial refund for the amount of 24.42 EUR:

Make a Partial Refund
curl -X POST \
https://api.sumup.com/v0.1/me/refund/19aa3cca-89f6-42d2-b462-463b0b53e959 \
-H "Authorization: Bearer $SUMUP_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"amount": 24.42}'
await client.transactions.refund("19aa3cca-89f6-42d2-b462-463b0b53e959", {
amount: 24.42,
});
await client.Transactions.RefundAsync(
  "19aa3cca-89f6-42d2-b462-463b0b53e959",
  new TransactionsRefundRequest
  {
      Amount = 24.42f,
  });
client.transactions().refundTransaction(
  "19aa3cca-89f6-42d2-b462-463b0b53e959",
  RefundTransactionRequest.builder().amount(24.42f).build()
);
ctx := context.Background()
client := sumup.NewClient()

amount := float32(24.42)
client.Transactions.Refund(ctx, "19aa3cca-89f6-42d2-b462-463b0b53e959", sumup.TransactionsRefundParams{
Amount: &amount,
})
from sumup.transactions.resource import RefundTransactionBody

client.transactions.refund(
"19aa3cca-89f6-42d2-b462-463b0b53e959",
RefundTransactionBody(amount=24.42),
)
use sumup::resources::transactions::RefundTransactionBody;

client
.transactions()
.refund(
"19aa3cca-89f6-42d2-b462-463b0b53e959",
Some(RefundTransactionBody { amount: Some(24.42) }),
)
.await?;
<?php

$sumup->transactions->refund('19aa3cca-89f6-42d2-b462-463b0b53e959', [
'amount' => 24.42,
]);

The response returns a 204 HTTP status code and contains no body.

Result

You have successfully refunded a transaction (either partially or in full) for a payment you previously processed. The refunded amount will be credited to the same payment method the customer had used to pay with in the original transaction. The processing fees associated with the original transaction are not returned.

Type to search…