SumUp For Developers

SumUp For Developers

  • Terminal Payments
  • Online Payments
  • Help
  • API Reference

›Online Payments

Online Payments

    Introduction

    • Getting started
    • Register application
    • Authorization
    • Response Handling
    • Webhooks

    Guides

    • Make a payment with a card entered by a customer
    • Saving a payment instrument for future use
    • Make a payment recurrent
    • Make a refund

    Alternative Payment Methods

    • Getting Started

    Features

    • Open Banking
    • 3-D Secure flow

    Tools

    • Payment card widget
    • PHP SDK

    Plugins

    • WooCommerce
    • PrestaShop
    • WIX

Make a refund

In this guide, you will learn how to refund a transaction for a payment you have already processed. 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:
    • Option A: Make a full refund
    • Option B: Make a partial refund

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:

  • You have a merchant account with SumUp and have already filled in your account details.
    • For a test account reach out to our support team through this contact form.
  • You have registered your client application with SumUp.
  • You have a valid access token obtained via the Authorization code flow.
  • You have processed successfully a payment checkout and you need to refund the transaction. For the purposes of this guide, we're going to use the checkout you created and completed with a tokenized card payment for a saved customer.
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

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

To look up the identifier of a transaction for a payment checkout you have already completed, 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.

Following is a sample request for retrieving the checkout you completed with a tokenized card:

cURL
PHP
curl -X GET \
  https://api.sumup.com/v0.1/checkouts/4ebc2ed7-bb8c-4d4d-a110-08fd31301bf2 \
  -H 'Authorization: Bearer 565e2d19cef68203170ddadb952141326d14e03f4ccbd46daa079c26c910a864'
$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

You can use one the two available options for refunding a processed transaction:

  • Option A: Make a full refund
  • Option B: Make a partial refund

Option A: Make a full refund

To make a full refund for a processed transaction, 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.

Following is a sample request for making a full refund for the transaction with identifier 664200af-2b62-4142-9c73-a2a505310d78:

cURL
PHP
curl -X POST \
  https://api.sumup.com/v0.1/me/refund/19aa3cca-89f6-42d2-b462-463b0b53e959 \
  -H 'Authorization: Bearer 565e2d19cef68203170ddadb952141326d14e03f4ccbd46daa079c26c910a864'
$transactionsService = $sumup->getTransactionService();
$response = $transactionsService->refund('19aa3cca-89f6-42d2-b462-463b0b53e959');

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

Option B: Make a partial refund

To make a partial refund for a processed transaction, 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.

Following is a sample request for making a partial refund for the amount of 24.42 EUR:

cURL
PHP
curl -X POST \
  https://api.sumup.com/v0.1/me/refund/19aa3cca-89f6-42d2-b462-463b0b53e959 \
  -H 'Authorization: Bearer 565e2d19cef68203170ddadb952141326d14e03f4ccbd46daa079c26c910a864'\
  -H 'Content-Type: application/json' \
  -d '{"amount": 24.42}'
$transactionsService = $sumup->getCheckoutService();
$response = $transactionsService->refund('19aa3cca-89f6-42d2-b462-463b0b53e959', 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.

← Make a payment recurrentGetting Started →
  • Before you begin
  • Steps
    • 1. Look up a transaction ID
    • 2. Refund a transaction
  • Result
SumUp For Developers
Terminal Payments
Online Payments
Help
API Reference
Contact us

Legal Notice
Privacy Policy
Terms & Conditions
Cookie Policy
© SumUp Inc.

In order to provide optimal service, SumUp uses cookies. By continuing to browse the site you are agreeing to our use of cookies.