These calls are used to refund part or all of a previously completed transaction on the MYGW Gateway after the merchant has been settled cancel all of a purchase made prior to the to the merchant being settled URLs: Test https://api.test.oneroadpayments.com/commands/ Production https://api.oneroadpayments.com/commands/ Request Method: POST Headers: The header ‘x-api-key’ should be set to the value of the Merchant API Key allocated to the merchant or PSP at sign up. URL Parameters: None Body – Refund/Cancel Request Name | Description | R/M/O | command | Always set to ‘BackOffice’ for cancel and refund requests | M | p1 | Set to ‘Refund’ to refund a transaction and ‘Cancel’ to cancel a transaction | M | p2 | The merchant ID of the merchant. The unique merchant ID provided by the PSP or allocated by the MYGW system | M | p3 | The unique order number for the original transaction to be refunded or cancelled | M | p4 | The date to process the refund or cancel, in the format YYYY-MM-DD | M | p5 | The amount to be cancelled or refunded. The refund amount can be less than or equal to the amount of the original transaction; the cancel amount must be the same as the original transaction amount. | M |
The refund or cancel request data should be sent to the MYGW server formatted as a JSON object, using the POST method. Refund/Cancel Response The MYGW server will respond including a status code, signifying whether the call succeeded, as described above - MYGW API Responses. An example of the JSON object sent in a response to a successful refund or cancel request is as follows. { "response": { "statusCode": 200, "message": "OK" }, } An example of the JSON object sent in a response to an unsuccessful refund or cancel request is as follows. { "response": { "statusCode":400, "message":"Bad Request", "detail":"Bad Command" } } The status code and status message returned could be one of the following values. Status Code | Description | Status Message | 200 | The refund/cancel was successfully executed or queued for processing | Message - OK | 400 | The request was not correctly formatted | Message - Bad Request Detail – Bad Command | 400 | Either the merchant ID or order ID were not valid | Message - Bad Request Detail – Refund/void failed Original transaction not found | 400 | The amount in the request is invalid | Message - Bad Request Detail – Refund/void failed Amount not valid | 403 | The merchant API key could not be validated, and the request failed | Message - Forbidden | 500 | A server error occurred, and the request failed | Message – Internal processing exception |
Refund/Cancel - Sample Source Code An example of executable JavaScript sample source code to refund or cancel a transaction can be found by clicking on the icon below. Note that this is an example of how a refund or cancel can be initiated, it is a not a recommendation for how to implement the API in your own applications. |