Menu

Refund

How to refund a SETTLED payment in test.

Types of refund in test

Test supports two types of refunds.

Automatic refunds

Initiate and complete refunds for some alternative payment methods (APMs). With automatic refunds, you do not need to manually enter additional shopper information as part of the refund process. In the production environment, when the automatic refund is completed, the refund payment is transferred directly to the shopper's ewallet or account.

Bank Transfer refunds

These require the manual entry of some shopper data as part of the refund process. Use the bank transfer refund method to refund an APM payment when:

  • The payment method does not support automatic refunds
  • The payment method supports automatic refunds, but attempts to refund the payment using this method have failed
  • Shopper details have not been saved in the system To see which APMs can only be refunded through bank transfers, seeAPM Test Features.

Common characteristics

For both types of refunds, you can test:

  • Full refunds, partial refunds and multiple partial refunds.
  • Order notifications for the SENT_FOR_REFUND and REFUNDED statuses, if order notifications are set up.

Refunding a payment made in a different currency

As in the production environment, if you are refunding a payment that was made in a currency that is different from your settlement currency, the appropriate exchange rate is applied when the amount is refunded. The refund amount might therefore be higher or lower than the original payment.

Automatic refunds

Payment flows

Secure test supports these payment flows for automatic refunds:

  • AUTHORISED > CAPTURED > SETTLED > SENT_FOR_REFUND > REFUNDED
  • AUTHORISED > CAPTURED > SENT_FOR_REFUND > SETTLED > REFUNDED Use order modifications to push payments to REFUNDED.

Test automatic refunds

Submit order modifications in test to request automatic refunds for payments. As in the production environment, Worldpay sends a response to acknowledge that it has received the request successfully. In the production environment, Worldpay processes the order modification offline.

Request

A request for a refund of EUR 1.00:

Copied!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN"
"http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="YOUR_MERCHANT_CODE" version="1.4">
  <modify>
    <orderModification orderCode="YOUR_ORDER_CODE">
      <refund>
        <amount value="100" currencyCode="EUR" exponent="2"/>
      </refund>
    </orderModification>
  </modify>
</paymentService>

Response

Test responds confirming that the request has been received successfully:

Copied!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN"
  "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE">
  <reply>
    <ok>
      <refundReceived orderCode="YOUR_ORDER_CODE">
        <amount value="100" currencyCode="EUR" exponent="2" debitCreditIndicator="credit"/>
      </refundReceived>
    </ok>
  </reply>
</paymentService>

Bank transfer refunds

You can test two scenarios:

  • Valid bank account: In this scenario, Worldpay accepts your refund instructions. The payment moves from CAPTURED/SETTLED to SENT_FOR_REFUND.
  • Invalid bank account: In this scenario, the refund fails. The payment status moves from CAPTURED/SETTLED to SENT_FOR_REFUND and then immediately to REFUND_FAILED. In test, these two statuses occur very quickly; in the live system there is a time delay, because it will take time for the bank to respond.

Note: To see which APMs can be refunded through bank transfers only, seeAPM Test Features.

Use the test MAI

To play out these scenarios, you need to use the test MAI:

  1. In the test MAI, click TRANSACTIONS and find and open a payment that is CAPTURED or SETTLED.
  2. Under Refund by Bank Transfer, enter the full or partial amount to be refunded.
  3. Click BT Refund to display the Refund Simulation (Test) page:
    1. Click Valid bank account to simulate correct bank information, changing the status from CAPTURED/SETTLED to SENT_FOR_REFUND.

      Note: Each time you click Valid bank account, a status of SENT_FOR_REFUND is generated (along with the notification, if you've set it up).

    2. Click Invalid bank account to simulate incorrect bank information, changing the status from CAPTURED/SETTLED to SENT_FOR_REFUND and then REFUND_FAILED. You'll see an error displayed.

      Note: Each time you click Invalid bank account, a pair of SENT_FOR_REFUND and REFUND_FAILED statuses is generated (along with the notifications, if you've set them up).

  4. Click Cancel to view the payment details.

Testing refunds of UnionPay payments

You can test both successful and failed refunds for payments made with the UnionPay payment method.

Simulating failed refunds

The unique payment status REFUND_FAILED can occur with refund requests for UnionPay payments. This status indicates that the request for a refund has failed.

What happens in production

The below scenario illustrates when the REFUND_FAILED status is triggered in production:

  1. A merchant requests a partial or full refund for a UnionPay payment. The payment status changes to REFUND_REQUESTED .
  2. After approximately two hours, if Worldpay has not received a response from China Union Pay, the status of the payment changes from REFUND_REQUESTED to REFUND_FAILED.

How to test

  1. Log in to the MAI and click the Production Mode button (bottom left) to switch to test mode.
  2. Click TRANSACTIONS and find and open a payment that is CAPTURED or SETTLED.
  3. Under Refund failed simulation for CUP, enter a full or partial amount then click Refund failed.

    Note: The Refund and Refund failed buttons are always visible for UnionPay payments, regardless of the payment status. If these buttons are clicked when the payment is not at a refundable status (e.g. SHOPPER_REDIRECTED, AUTHORISED), you'll get an error.

  4. Click OK to confirm. The status of the payment changes to SENT_FOR_REFUND and then REFUND_FAILED.