Receivables Refund
POST
https://api.mpay.com.au/receivables/v2/refund
Body Parameters
- bodycuscalRefundBody_V2requiredDescription
- UniqueReferencestringExampleDescriptionDefaultc1f7e2a4-5b3d-4e8f-9a6b-2d4c8e1f3a57Pattern^[A-Za-z0-9_.-]{1,50}$
- originalTransactionIdstringExampleDescriptionDefault884231701Pattern^[0-9]{1,10}$
- refundAmountstringrequiredExampleDescriptionDefault125.50Pattern^([0-9]{1,13}(\.[0-9]{0,2})?|\.[0-9]{1,2})$
- descriptionstringExampleDescriptionDefaultRefund. Inv#123456Pattern^.{1,280}$
- refundReferencestringExampleDescriptionDefaultREFUND INV123456Pattern^[ -~]{1,280}$
- paymentInitiationUidstringExampleDescriptionDefaultBCORP00000001Pattern^[A-Za-z0-9_-]{1,35}$
Responses
200
- cuscalRefundResponse_V2Example
{ "transactionId": 884231755, "feeAmountExcludingGst": 0.12, "feeAmountGstComponent": 0.012, "feeAmountIncludingGst": 0.132, "callerUniqueReference": "c1f7e2a4-5b3d-4e8f-9a6b-2d4c8e1f3a57", "durationMs": 150, "status": "Ok", "statusDescription": "Operation completed successfully" }Description- transactionIdintegerExampleDescriptionDefault884231755Pattern^[0-9]{1,10}$
- feeAmountExcludingGstnumberExampleDescriptionDefault0.12Pattern^[0-9]{1,13}(\.[0-9]{1,4})?$
- feeAmountGstComponentnumberExampleDescriptionDefault0.012Pattern^[0-9]{1,13}(\.[0-9]{1,4})?$
- feeAmountIncludingGstnumberExampleDescriptionDefault0.132Pattern^[0-9]{1,13}(\.[0-9]{1,4})?$
- callerUniqueReferencestringExampleDescriptionDefaultc1f7e2a4-5b3d-4e8f-9a6b-2d4c8e1f3a57Pattern^[A-Za-z0-9_.-]{1,50}$
- durationMsintegerExampleDescriptionDefault150Pattern^[0-9]{1,7}$
- statusstringExampleDescriptionDefaultOkPattern^[A-Za-z0-9]{1,50}$
- statusDescriptionstringExampleDescriptionDefaultOperation completed successfullyPattern^.{1,500}$
400
- badRequestResponse_V2Example
{ "durationMs": 12, "status": "Error", "statusDescription": "Validation failed: 'refundAmount' must be less than or equal to the original transaction amount." }Description- durationMsintegerExampleDescriptionDefault12Pattern^[0-9]{1,7}$
- statusstringExampleDescriptionDefaultUniqueReferenceExistsPattern^[A-Za-z0-9]{1,100}$
- statusDescriptionstringExampleDescriptionDefaultThe uniqueReference has been used before although no Transaction ID could be found. Either the original transaction failed or it could be running now.Pattern^.{1,500}$
401
- unauthorizedResponse_V2Example
{ "durationMs": 4, "status": "Unauthorized", "statusDescription": "Authentication failed. Supply a valid API key as the basic authentication username." }Description- durationMsintegerExampleDescriptionDefault4Pattern^[0-9]{1,7}$
- statusstringExampleDescriptionDefaultUnauthorizedPattern^[A-Za-z0-9]{1,50}$
- statusDescriptionstringExampleDescriptionDefaultAuthentication failed. Supply a valid API key as the basic authentication username.Pattern^.{1,500}$
500
- internalServerErrorResponse_V2Example
{ "durationMs": 1503, "status": "Error", "statusDescription": "An unexpected error occurred while processing the request." }Description- durationMsintegerExampleDescriptionDefault1503Pattern^[0-9]{1,7}$
- statusstringExampleDescriptionDefaultErrorPattern^[A-Za-z0-9]{1,50}$
- statusDescriptionstringExampleDescriptionDefaultAn unexpected error occurred while processing the request.Pattern^.{1,500}$
curl
curl --request POST \
--url https://api.mpay.com.au/receivables/v2/refund \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"UniqueReference": "c1f7e2a4-5b3d-4e8f-9a6b-2d4c8e1f3a57",
"originalTransactionId": "884231701",
"refundAmount": "125.50",
"description": "Refund. Inv#123456",
"refundReference": "REFUND INV123456",
"paymentInitiationUid": "BCORP00000001"
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"UniqueReference": "c1f7e2a4-5b3d-4e8f-9a6b-2d4c8e1f3a57",
"originalTransactionId": "884231701",
"refundAmount": "125.50",
"description": "Refund. Inv#123456",
"refundReference": "REFUND INV123456",
"paymentInitiationUid": "BCORP00000001"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.mpay.com.au/receivables/v2/refund", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.mpay.com.au/receivables/v2/refund")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"UniqueReference": "c1f7e2a4-5b3d-4e8f-9a6b-2d4c8e1f3a57",
"originalTransactionId": "884231701",
"refundAmount": "125.50",
"description": "Refund. Inv#123456",
"refundReference": "REFUND INV123456",
"paymentInitiationUid": "BCORP00000001"
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.mpay.com.au/receivables/v2/refund"
payload = json.dumps({
"UniqueReference": "c1f7e2a4-5b3d-4e8f-9a6b-2d4c8e1f3a57",
"originalTransactionId": "884231701",
"refundAmount": "125.50",
"description": "Refund. Inv#123456",
"refundReference": "REFUND INV123456",
"paymentInitiationUid": "BCORP00000001"
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successful validation. The refund was accepted for processing.
{
"transactionId": 884231755,
"feeAmountExcludingGst": 0.12,
"feeAmountGstComponent": 0.012,
"feeAmountIncludingGst": 0.132,
"callerUniqueReference": "c1f7e2a4-5b3d-4e8f-9a6b-2d4c8e1f3a57",
"durationMs": 150,
"status": "Ok",
"statusDescription": "Operation completed successfully"
}400
// Bad request. One or more parameters are missing, malformed or failed validation, for example a refundAmount greater than the original transaction amount. Inspect statusDescription for the reason.
{
"durationMs": 12,
"status": "UniqueReferenceExists",
"statusDescription": "The uniqueReference has been used before although no Transaction ID could be found. Either the original transaction failed or it could be running now."
}401
// Unauthorized. The API key is missing or invalid. Pass your API key as the basic authentication username with no password.
{
"durationMs": 4,
"status": "Unauthorized",
"statusDescription": "Authentication failed. Supply a valid API key as the basic authentication username."
}500
// Internal server error. An unexpected error prevented the Platform from completing the request, so the outcome of the refund is unknown. Retry with the same UniqueReference so that a duplicate refund is not created.
{
"durationMs": 1503,
"status": "Error",
"statusDescription": "An unexpected error occurred while processing the request."
}