Vraag? Stuur ons een bericht

+31 6 26 52 78 57

Wij verwerken online betalingen sinds 2006

Refunds

This guide will show you how you can create refunds with the PayPro API.

Refunds are a way for a merchant to pay its customers back. You can refund the entire amount of a transaction or a portion of it.

The customer will also be notified of the refund and if you have Debtorprocess enabled you will be able to sent them new payment links.

Creating a refund

There are two ways to create a refund. You can refund an order through the Dashboard or you can create a refund with the PayPro API.

A payment can only be refunded once and can not have a larger amount than the original payment. You also need sufficient balance in your PayPro account to create a refund.

Single Payment

If you want to refund a single payment (not a subscription) you can use the following code:

# First we create a client object with our API key.
# This is an example key. Use your own API key here.
client = PayPro::Client.new('YOUR_API_KEY')

# Set the command to `refund`.
client.command = 'refund'

client.params  = {
  # Set the id of the payment you want to refund.
  sale_id: 123456,
  # Set the amount you want to refund.
  amount: 500
}

# Execute the command and store the response.
response = client.execute
<?
// First we create a client object with our API key.
// This is an example key. Use your own API key here.
$client = \PayPro\Client("YOUR_API_KEY");

// Set the command to `refund`.
$client->setCommand("refund");

$client->setParams([
  // Set the id of the payment you want to refund.
  "sale_id" => 123456,
  // Set the amount you want to refund.
  "amount" => 500
]);

// Execute the command and store the response.
$response = $client.execute();
# First we create a client object with our API key.
# This is an example key. Use your own API key here.
client = Client('YOUR_API_KEY')

# Set the command to `refund`.
client.setCommand('refund')

client.setParams({
    # Set the id of the payment you want to refund.
    'sale_id': 123456,
    # Set the amount you want to refund.
    'amount': 500
})

# Execute the command and store the response.
response = client.execute()

Recurring Payments

When you want to refund a specific installment of a recurring payment you can use the following code:

# First we create a client object with our API key.
# This is an example key. Use your own API key here.
client = PayPro::Client.new('YOUR_API_KEY')

# Set the command to `refund`.
client.command = 'refund'

client.params  = {
  # Set the id of the subscription you want to refund.
  sale_id: 123456,
  # Set the sequence number of the installment you want to refund.
  sequence_number: 4,
  # Set the amount you want to refund.
  amount: 500
}

# Execute the command and store the response.
response = client.execute
<?
// First we create a client object with our API key.
// This is an example key. Use your own API key here.
$client = \PayPro\Client("YOUR_API_KEY");

// Set the command to `refund`.
$client->setCommand("refund");

$client->setParams([
  // Set the id of the subscription you want to refund.
  "sale_id" => 123456,
  // Set the sequence number of the installment you want to refund.
  "sequence_number" => 4,
  // Set the amount you want to refund.
  "amount" => 500
]);

// Execute the command and store the response.
$response = $client.execute();
# First we create a client object with our API key.
# This is an example key. Use your own API key here.
client = Client('YOUR_API_KEY')

# Set the command to `refund`.
client.setCommand('refund')

client.setParams({
    # Set the id of the subscription you want to refund.
    'sale_id': 123456,
    # Set the sequence number of the installment you want to refund.
    'sequence_number': 4,
    # Set the amount you want to refund.
    'amount': 500
})

# Execute the command and store the response.
response = client.execute()

Handling Refunds

When refunds are being issued the system will sent postbacks of the Termijnstatus type. There are three statuses that the payment will go through:

  • wachten_op_terugbetalen Request for refund received and waiting to be processed.
  • terugbetalen The payment is getting refunded.
  • terugbetaald The payment has been refunded.

By checking for these postbacks you will be notified about the statuses of refunds and can act accordingly.

You can check the Postback Guide to see how you can handle these postback.

Related Guides

Payments Quickstart

Postbacks

Support

Would you like additional support or do you have questions? Contact us.