Refunds
Walks through looking up transactions and issuing full or partial refunds.
Overview
Section titled “Overview”In this guide, you will learn how to refund a transaction. You will go through the following steps:
- Look up a transaction ID (Optional)
- 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
Section titled “Before You Begin”Here are the things that you need in order to complete the steps in this guide:
- SumUp merchant account with completed account details.
- You can also use a test account.
- Registered client application with SumUp.
- Valid access token obtained with the Authorization code flow.
- You have processed a checkout and you have the checkout ID.
1. Look up a Transaction ID
Section titled “1. Look up a Transaction ID”- 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:
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().WithAuth(os.Getenv("SUMUP_API_KEY"))
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?;$checkoutsService = $sumup->getCheckoutService();$response = $checkoutsService->findById('4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2');$checkoutReference = $response->getBody()->checkout_reference;$checkoutId = $response->getBody()->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
Section titled “2. Refund a Transaction”Make a Full Refund
Section titled “Make a Full Refund”- 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:
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().WithAuth(os.Getenv("SUMUP_API_KEY"))
_, err := client.Transactions.Refund(ctx, "19aa3cca-89f6-42d2-b462-463b0b53e959", sumup.RefundTransactionBody{})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?;$transactionsService = $sumup->getTransactionService();$response = $transactionsService->refund('19aa3cca-89f6-42d2-b462-463b0b53e959');The response returns a 204 HTTP status code and contains no body.
Make a Partial Refund
Section titled “Make a Partial Refund”- 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:
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().WithAuth(os.Getenv("SUMUP_API_KEY"))
amount := 24.42client.Transactions.Refund(ctx, "19aa3cca-89f6-42d2-b462-463b0b53e959", sumup.RefundTransactionBody{ 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?;$transactionsService = $sumup->getTransactionService();$response = $transactionsService->refund('19aa3cca-89f6-42d2-b462-463b0b53e959', 24.42);The response returns a 204 HTTP status code and contains no body.
Result
Section titled “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.