You can perform a refund against a previous payment. You will need the payment id
from the successful payment response from the COPYandPAY API or SERVER-TO-SERVER API.
The payment to refund can be a debit (DB) or captured pre-authorisation (PA->CP) payment type.
Refund request
To perform a refund, send a POST request with the RF
payment type over HTTPS to the /payments/{id}
endpoint.
You can create a partial or full refund by using the amount
field. For issues of customer satisfaction, we recommend that you use full refunds, because this makes it easier to resolve situations where the customer has also requested chargeback.
Avoid duplicate blockingYou should send a unique
merchantTransactionId
every time to avoid duplicate blocking.
Here is the format of the cURL request to refund a payment.
curl https://test.oppwa.com/v1/payments/{id}\
-d "entityId={channelId}" \
-d "amount=50.00" \
-d "currency=GBP" \
-d "paymentType=RF" \
-d "merchantTransactionId=P168" \
-d "testMode=EXTERNAL" \
-H "Authorization: Bearer {auth_token}"
Example request flow
Here is an example of the first part of a previous JSON response from capturing a payment. The payment id
is the first attribute in the response.
{
"id": "8ac7a4a09136ba2801913734d9e253d8",
"referencedId": "8ac7a4a09136ba2801913706f2a221bf",
"paymentType": "CP",
"amount": "4000.00",
"currency": "EUR",
"descriptor": "7257.6024.8607 ECOMChannel",
"merchantTransactionId": "P155",
"result": {
"code": "000.100.112",
"description": "Request successfully processed in 'Merchant in Connector Test Mode'"
},
Here is an example of a cURL request to refund this payment.
curl https://test.oppwa.com/v1/payments/8ac7a4a09136ba2801913734d9e253d8 \
-d "entityId={channelId}" \
-d "amount=4000.00" \
-d "currency=EUR" \
-d "paymentType=RF" \
-d "merchantTransactionId=P155" \
-d "testMode=EXTERNAL" \
-H "Authorization: Bearer {auth_token}"
Example response
Here is an example of the JSON response to a successful refund request.
{
"id": "8ac7a4a09136ba28019137500e104eff",
"referencedId": "8ac7a4a09136ba2801913734d9e253d8",
"paymentType": "RF",
"amount": "4000.00",
"currency": "EUR",
"descriptor": "2108.9897.9615 ECOMChannel",
"merchantTransactionId": "P155",
"result": {
"code": "000.100.112",
"description": "Request successfully processed in 'Merchant in Connector Test Mode'"
},
"resultDetails": {
"ExtendedDescription": "Approved",
"clearingInstituteName": "SecureTrading Omnipay Demo",
"ConnectorTxID1": "891858||false| MCC635844 ||0809|| ||RECURRING|80||false|false|false|812|",
"ConnectorTxID3": "422201891858|00|||1||0809132439|||||||||||||Berlin|",
"connectorId": "885921",
"ConnectorTxID2": "017283||8ac7a0b39134af7f01913734da5f0c39",
"AcquirerResponse": "00",
"reconciliationId": "2108.9897.9615",
"merchantAccountId": "8ac7a4c890fc748b0190fe70998c0248",
"SchemeResponseCode": "00"
},
"customer": {
"merchantCustomerId": "CUST12"
},
"buildNumber": "174903ec91870d5654938dd40f55da3b35036b23@2024-08-08 12:50:27 +0000",
"timestamp": "2024-08-09 13:24:39+0000",
"ndc": "8ac7a4c890fc748b0190fe6ad56b0241_8ab7f980b9bb4bd093c90931766d6432",
"source": "OPP",
"paymentMethod": "CC",
"shortId": "2108.9897.9615"
}
For full details of how to interpret the payment response, see Transaction results.
For the gateway documentation of the Backoffice API, see Gateway Backoffice API documentation.
Test in the gateway playground
You can test a refund transaction in the gateway playground at Gateway Backoffice refund payment using test data as follows.
entityId={channelId}
amount=4000.00
currency=EUR
paymentType=RF
merchantTransactionId=P155
testMode=EXTERNAL
You can also perform these operations in the CardCorp Hub UI. See Refund a transaction.