Creating Refunds

The Refund API can be used to refund the money for a completed charge, should your customer request for one or you see any other need to do so. For example, a wrong purchase was made, or the customer changed their mind.

There are two types of refunds:

  1. Partial refund: You can issue multiple partial refunds, as long as the total amount refunded is not greater than the total charge amount
  2. Full refund: This refunds the charged amount in full

Xendit does not charge any additional fees for you to perform a refund. Thus, when you refund a charge:

  • The variable component fee (default: 2.9% transaction value) incurred upon a successful charge will be refunded to you.
  • The fixed fee component will be refunded only if you issue a full (and not partial) refund. When you issue a full refund, your customer will be able to receive the full amount of money that they were charged.

Implementing Refunds

Refunds can be issued via API. Request for refunds are:

curl https://api.xendit.co/credit_card_charges/:credit_card_charge_id/refunds -X POST \
  -u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
  -H X-IDEMPOTENCY-KEY: unique-id-12345 \
  -d amount=17000 \
  -d external_id=unique-external-id
<?php
    require("vendor/autoload.php");

    $options['secret_api_key'] = "xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==";

    $xenditPHPClient = new XenditClientXenditPHPClient($options);

    $credit_card_charge_id = "5877255293ff67900c6aa64e";
    $amount = 15000;
    $external_id = "unique-external-id";
    $response = $xenditPHPClient->issueCreditCardRefund($credit_card_charge_id, $amount, $external_id);
    print_r($response);
?>

To look at the full Refund API references, please refer to our API reference .

Last Updated on 2023-05-19