Testing your Integration
...
Testing your Direct (API) Inte...

Testing Refunds

Testing Refunds

Card Refund Scenarios (Positive Flow)

Important to Consider

  • Ensure the Refund Payments permission is enabled on your API credentials.
  • Ensure you have the correct receiptId for the original payment or collection.
    • This is required for you to process the refund.
  • You can make multiple partial refund requests, up to the original transaction amount.
  • These scenarios can be used on:
    • Card
    • Apple Pay™
    • Google Pay™ test transactions.

To simulate a full or partial refund on the original transaction amount:

Suggested Test Scenario

Expected Outcome

Tip

Process a partial refund.

You can also make multiple test partial refund requests.

200 Successful

Ensure you have the correct receiptId for the original payment or collection, to process the partial refund.

If you are testing multiple partial refund requests, ensure the combined requests do not exceed the original transaction amount.

Process a full refund.

200 Successful

Ensure you have the correct receiptId for the original payment or collection, to process the full refund.



Request Parameters

Sandbox endpoint: https://api-sandbox.judopay.com/transactions/refunds

HTTP Method: POST

Header Parameters:

For more information, see Authentication Methods.

API-Version:

6.23

For the latest version of the Judopay Transaction API, see Latest Version.

Content-Type:

application/json

Accept:

application/json

Authorization Method:

TokenSecretAuth

In the Authorization Header:

  • Supply: Basic {authstring}

Example:

BasicTXpFdPdRSzWmSGk4djhxeTpjBTS4YjQ5OTdkZmO7CTk1YTE0OWEyMDg1MmY3YWYyZWEyZTcwYmQyZGY3O

Replace {authstring} with base64 encoding of:

  • API Token (username)
  • Colon
  • API Secret (password)

Example:

MzPdkQK1mGi8v3ky:y158n4732dfc7595a149a20381f7af2ea2e70gr6df794b8rnwc019cc5f799kk3




Body Parameters:

Ensure you have the correct receiptId for the original transaction to process the full or partial refund.

Configuration Property Descriptions

Parameter

Description

receiptId String Required

Judopay's reference for the transaction that is to be refunded.

amount Decimal Required

The amount to refund. Format:

  • Two decimal places

For currencies using a different structure please contact Judopay for support.

currency String Required

If specified, the currency must match the original transaction. If not specified, the currency of the original transaction will be used.

Any ISO 4217 alphabetic currency code:

  • GBP
  • USD
  • EUR

yourPaymentReference String Required

Your unique reference for this refund. Format:

  • Maximum length 50 characters.

This is not the yourPaymentReference of the original transaction.


Refund Request Example
Response Example



Card Refund Scenarios (Negative Flow)

Declines can occur for various reasons, it can be impossible to simulate all the negative flows in a sandbox environment.

Important to Consider

  • How your app handles negative flows
  • Your customer's experience should a negative flow occur:
    • Logic to communicate error messages
    • Customise how your app responds
  • How to maintain application consistency

Follow our suggested guidelines to simulate negative scenarios, to test your app’s error handling:

Suggested Negative Test Scenario

Expected Error Code

Error Description

Attempt a refund on a preAuth that has not yet been collected.

For a preAuth that has not yet been collected, follow the void scenarios.

67

Sorry, but your refund request was not valid.

Please check that the original transaction was a Sale or Collection, has not previously been refunded, was not for a lesser amount than your refund request.

Attempt a refund on a preAuth that has already been voided.

48

Sorry, this transaction has been voided. You cannot perform a refund on a voided transaction.

Attempt a larger refund amount than the original transaction amount.

49

Sorry, but the amount you're trying to refund is greater than the original transaction.

Attempt a refund using the incorrect receiptId.

Use the preAuth receiptId to simulate the error. (For a positive flow, the correct receiptId would be for the original payment or collection).

47

Sorry, but it looks like the transaction you are trying to refund is invalid.

Refunds can only be performed on Sales and Collections.

Where the codes remain fixed, the descriptions may change. You should not build any error handling logic based on these descriptions.



For a list of possible error codes, types and descriptions, see Error Codes and Descriptions.