Skip to content

Refunds

Manually initiate a refund of a specific transaction.

POST /v2/refund

The amount refunded does not have to be the full amount of the original transaction, it can be less.

Sample

json
POST /v1/refund
{
  "TransactionReference": "BA0542FB-1C66-4868-B072-3B9474401578",
  "RefundAmountInCents": 133
}

Auth: Access token (Bearer).

Request body

FieldTypeRequiredDescription
sourceTransactionReferencestringNoA globally unique transaction reference (UUID) that identifies the original transaction that sourced the funds that you want to refund.
destinationTransactionReferencestringNoA globally unique transaction reference (UUID) that identifies the destination transaction that the refund request is associated with.
clientDataobject?NoA collection of public data that can be associated with the transaction.
refundAmountInCentsintegerNoThe amount to refund. This value cannot be larger than the amount that was originally sourced by the transaction referenced by ZGA.Core.Models.Payments.RefundRequest.SourceTransactionReference.
json
{
  "sourceTransactionReference": "00000000-0000-0000-0000-000000000000",
  "destinationTransactionReference": "00000000-0000-0000-0000-000000000000",
  "clientData": {},
  "refundAmountInCents": 0
}

Responses

StatusDescription
202The request was successful but does not return any results.
400The request failed validation, the error object will contain further information.
401The authorization information provided is not valid, authentication is required to access this resource.
403The authorization header does not contain the correct type or you do not have access to this resource.
404The request was successful but does not return any results.
422The request payload is invalid, the error object will contain further information.
429Too many requests are being sent concurrently or rate limiting has taken effect.
500An unexpected error occurred, the error object will contain further information.

Response body

FieldTypeRequiredDescription
successbooleanNoGets a value indicating whether the operation was successful.
resultobjectNoA model to hold the details of a response to a refund request.
json
{
  "success": true,
  "result": {
    "reference": "00000000-0000-0000-0000-000000000000",
    "refundStatusUrls": {}
  }
}

Code samples

ts
// @vantagepay/vantagepay
// Server-side/admin refund - initiate via the .NET admin SDK. Not available in the JavaScript SDK.
// Not wrapped by the JavaScript SDK - call the endpoint directly with the active token.
const response = await fetch(baseUrl + '/v2/refund', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + ApiTokens.accessToken },
})
const result = await response.json()
csharp
// VantagePay.SDK
using VantagePay.Models.Payments.Requests;

var refund = await adminClient.Payments.RefundAsync(new RefundRequest
{
    SourceTransactionReference = "e1d2c3b4-a5f6-4738-9a0b-1c2d3e4f5a6b",
    DestinationTransactionReference = "c7b8a9d0-1234-4567-89ab-cdef01234567",
    RefundAmountInCents = 5000,
});

Check the status of a refund.

GET /v2/refund/status/{refundReference}

Sample

json
POST /v1/refund/status/d66f8095-f355-4dfe-83ca-5d96e136f6f5

Auth: Access token (Bearer).

Parameters

NameInRequiredDescription
refundReferencepathYesA globally unique refund reference (UUID).

Responses

StatusDescription
200The request was successful but does not return any results.
400The request failed validation, the error object will contain further information.
401The authorization information provided is not valid, authentication is required to access this resource.
403The authorization header does not contain the correct type or you do not have access to this resource.
404The request was successful but does not return any results.
422The request payload is invalid, the error object will contain further information.
429Too many requests are being sent concurrently or rate limiting has taken effect.
500An unexpected error occurred, the error object will contain further information.

Response body

FieldTypeRequiredDescription
successbooleanNoGets a value indicating whether the operation was successful.
resultobjectNoA model to hold the details of the current status of a refund transaction.
json
{
  "success": true,
  "result": {
    "refundCompletedDate": "string",
    "createdDate": "string",
    "reference": "00000000-0000-0000-0000-000000000000",
    "shortReference": "string",
    "description": "string",
    "originalAmountInCents": 0,
    "amountAttemptedInCents": 0,
    "amountInCents": 0,
    "cashbackAmountInCents": 0,
    "fees": [],
    "data": [],
    "currency": "None",
    "status": 0,
    "category": 0,
    "summaryStatus": 0,
    "isComplete": true,
    "message": "string"
  }
}

Code samples

ts
// @vantagepay/vantagepay
// Checks a refund status. Not wrapped by the JavaScript SDK.
// Not wrapped by the JavaScript SDK - call the endpoint directly with the active token.
const response = await fetch(baseUrl + '/v2/refund/status/' + refundReference, {
  method: 'GET',
  headers: { Authorization: 'Bearer ' + ApiTokens.accessToken },
})
const result = await response.json()
csharp
// VantagePay.SDK
var status = await client.Payments.RefundStatusCheckAsync(Guid.Parse("d4c3b2a1-5678-4321-9876-fedcba098765"));

Get detailed refund information for generating receipts.

GET /v2/refund/receipt/{refundReference}

Auth: Access token (Bearer).

Parameters

NameInRequiredDescription
refundReferencepathYesA globally unique refund reference (UUID).

Responses

StatusDescription
200The request was successful but does not return any results.
400The request failed validation, the error object will contain further information.
401The authorization information provided is not valid, authentication is required to access this resource.
403The authorization header does not contain the correct type or you do not have access to this resource.
404The request was successful but does not return any results.
422The request payload is invalid, the error object will contain further information.
429Too many requests are being sent concurrently or rate limiting has taken effect.
500An unexpected error occurred, the error object will contain further information.

Response body

FieldTypeRequiredDescription
successbooleanNoGets a value indicating whether the operation was successful.
resultobjectNoA model to hold the details of the current status of a refund transaction.
json
{
  "success": true,
  "result": {
    "yourReference": "string",
    "originalPaymentReceipt": {},
    "refundCompletedDate": "string",
    "createdDate": "string",
    "reference": "00000000-0000-0000-0000-000000000000",
    "shortReference": "string",
    "description": "string",
    "originalAmountInCents": 0,
    "amountAttemptedInCents": 0,
    "amountInCents": 0,
    "cashbackAmountInCents": 0,
    "fees": [],
    "data": [],
    "currency": "None",
    "status": 0,
    "category": 0,
    "summaryStatus": 0,
    "isComplete": true,
    "message": "string"
  }
}

Code samples

ts
// @vantagepay/vantagepay
// Retrieves a refund receipt. Not wrapped by the JavaScript SDK.
// Not wrapped by the JavaScript SDK - call the endpoint directly with the active token.
const response = await fetch(baseUrl + '/v2/refund/receipt/' + refundReference, {
  method: 'GET',
  headers: { Authorization: 'Bearer ' + ApiTokens.accessToken },
})
const result = await response.json()
csharp
// VantagePay.SDK
var receipt = await client.Payments.GetRefundReceiptAsync(Guid.Parse("d4c3b2a1-5678-4321-9876-fedcba098765"));

Generate a transaction for an external card refund.

POST /v2/refund/merchant/external-card

Auth: Access token (Bearer).

Request body

FieldTypeRequiredDescription
transactionDateUtcstringNoThe UTC date and time the terminal submitted the transaction.
timeZonestring?NoThe IANA or Windows time-zone identifier for the terminal's local time.
transactionBatchReferencestring?NoThe payment engine transaction batch reference associated with this terminal transaction.
splitReferencestring?NoA shared split-payment reference that groups multiple batches contributing to the same consumer bill.
tipEmployeeReferencestring?NoThe reference of the employee who should receive the tip, if applicable.
transactionReferencestring?NoThe unique transaction reference assigned by the payment engine.
transactionNumberstring?NoThe transaction sequence number assigned by the terminal.
transactionTypestring?NoThe transaction type descriptor as returned by the terminal (e.g. PURCHASE, REFUND).
merchantAccountNumberstring?NoThe merchant account number as returned by the terminal, with leading zeros stripped.
terminalNumberstring?NoThe terminal identifier, left-padded to 8 digits.
batchNumberstring?NoThe settlement batch number, left-padded to 3 digits.
customDescriptionstring?NoAn optional description that overrides the default transaction label, used for itemised receipts.
currencyone of 106 values (e.g. None, AFN, ALL, ...)NoThe currency in which the transaction was processed.
requestedAmountInCentsintegerNoThe purchase amount in cents originally requested by the terminal.
approvedAmountInCentsintegerNoThe purchase amount in cents approved by the acquiring host.
requestedCashbackAmountInCentsintegerNoThe cashback amount in cents requested by the cardholder.
approvedCashbackAmountInCentsintegerNoThe cashback amount in cents approved by the acquiring host.
requestedMerchantFeeInCentsintegerNoThe merchant surcharge fee in cents requested.
approvedMerchantFeeInCentsintegerNoThe merchant surcharge fee in cents approved by the acquiring host.
requestedTaxAmountInCentsintegerNoThe tax amount in cents requested.
approvedTaxAmountInCentsintegerNoThe tax amount in cents approved by the acquiring host.
requestedTipAmountInCentsintegerNoThe tip amount in cents requested by the cardholder.
approvedTipAmountInCentsintegerNoThe tip amount in cents approved by the acquiring host.
maskedCardNumberstring?NoThe masked PAN of the card used (e.g. 411111******1111).
expiryDatestring?NoThe card expiry date as returned by the terminal (format: MMYY or YYMM depending on scheme).
authCodestring?NoThe authorisation code returned by the issuer for an approved transaction.
authModestring?NoThe authentication mode used (e.g. PIN, SIGNATURE, CONTACTLESS).
resultCodestring?NoThe ISO 8583 result code returned by the acquiring host (e.g. 00 for approved).
messagestring?NoA short human-readable outcome message.
detailedMessagestring?NoA verbose description of the outcome, supplementing ZGA.Core.Models.Payments.ExternalCardTransactionData.Message.
hostResponsestring?NoThe raw response string returned by the acquiring host.
gatewayTransactionReferencestring?NoA unique transaction reference assigned by the payment gateway.
gatewayResponsestring?NoThe raw JSON or string response returned by the payment gateway.
avsResponsestring?NoThe Address Verification Service (AVS) response code returned by the issuer.
cvvResponsestring?NoThe Card Verification Value (CVV/CVC) check response code returned by the issuer.
issuerResponseCodestring?NoThe ISO 8583 response code returned by the card issuer.
globalUniqueIdentifierstring?NoA globally unique identifier assigned to this transaction by the network or acquirer.
cardPresentFlagstring?NoFlag indicating whether the card was physically present at the terminal (e.g. 1 = present, 0 = absent).
entryModeFlagstring?NoThe card-data entry mode flag (e.g. chip, swipe, contactless, manual).
pinStatusFlagstring?NoFlag indicating the PIN entry status for this transaction.
apppnstring?NoEMV Application Preferred Name (APPPN) from the chip.
aidstring?NoEMV Application Identifier (AID) from the chip.
atcstring?NoEMV Application Transaction Counter (ATC) from the chip.
acstring?NoEMV Application Cryptogram (AC) generated by the chip for this transaction.
tvrstring?NoEMV Terminal Verification Results (TVR) - a bitmap of checks performed by the terminal.
tsistring?NoEMV Transaction Status Information (TSI) - indicates which functions were performed during processing.
cvmstring?NoEMV Cardholder Verification Method (CVM) used (e.g. PIN, signature, no CVM).
ctqstring?NoEMV Card Transaction Qualifiers (CTQ) - contactless transaction qualifier bitmap.
stanstring?NoThe Systems Trace Audit Number (STAN) assigned by the terminal for this transaction.
invoiceNumberstring?NoThe terminal-assigned invoice number for this transaction.
receiptNumberstring?NoThe receipt number printed on the customer copy.
nameOnCardstring?NoThe cardholder name as embossed or encoded on the card.
locationobjectNoA geographic coordinate with an optional time zone and description. Used to pin an address or entity on a map.
printLinesarray<string>?NoFree-text lines to be appended verbatim to the printed receipt.
lineItemsarray<object>?NoItemised line items that make up this transaction (products or services purchased).
clientDataobject?NoA key-value map of arbitrary client data forwarded from the terminal to the payment engine.
json
{
  "transactionDateUtc": "string",
  "timeZone": "string",
  "transactionBatchReference": "00000000-0000-0000-0000-000000000000",
  "splitReference": "00000000-0000-0000-0000-000000000000",
  "tipEmployeeReference": "string",
  "transactionReference": "string",
  "transactionNumber": "string",
  "transactionType": "string",
  "merchantAccountNumber": "string",
  "terminalNumber": "string",
  "batchNumber": "string",
  "customDescription": "string",
  "currency": "None",
  "requestedAmountInCents": 0,
  "approvedAmountInCents": 0,
  "requestedCashbackAmountInCents": 0,
  "approvedCashbackAmountInCents": 0,
  "requestedMerchantFeeInCents": 0,
  "approvedMerchantFeeInCents": 0,
  "requestedTaxAmountInCents": 0,
  "approvedTaxAmountInCents": 0,
  "requestedTipAmountInCents": 0,
  "approvedTipAmountInCents": 0,
  "maskedCardNumber": "string",
  "expiryDate": "string",
  "authCode": "string",
  "authMode": "string",
  "resultCode": "string",
  "message": "string",
  "detailedMessage": "string",
  "hostResponse": "string",
  "gatewayTransactionReference": "string",
  "gatewayResponse": "string",
  "avsResponse": "string",
  "cvvResponse": "string",
  "issuerResponseCode": "string",
  "globalUniqueIdentifier": "string",
  "cardPresentFlag": "string",
  "entryModeFlag": "string",
  "pinStatusFlag": "string",
  "apppn": "string",
  "aid": "string",
  "atc": "string",
  "ac": "string",
  "tvr": "string",
  "tsi": "string",
  "cvm": "string",
  "ctq": "string",
  "stan": "string",
  "invoiceNumber": "string",
  "receiptNumber": "string",
  "nameOnCard": "string",
  "location": {
    "latitude": 0,
    "longitude": 0,
    "timeZone": "string",
    "description": "string"
  },
  "printLines": [
    "string"
  ],
  "lineItems": [
    {}
  ],
  "clientData": {}
}

Responses

StatusDescription
202The refund request was submitted successfully.
400The request failed validation, the error object will contain further information.
401The authorization information provided is not valid, authentication is required to access this resource.
403The authorization header does not contain the correct type or you do not have access to this resource.
404The request was successful but does not return any results.
422The request payload is invalid, the error object will contain further information.
429Too many requests are being sent concurrently or rate limiting has taken effect.
500An unexpected error occurred, the error object will contain further information.

Response body

FieldTypeRequiredDescription
successbooleanNoGets a value indicating whether the operation was successful.
resultobjectNoA model to hold the details of a response to a refund request.
json
{
  "success": true,
  "result": {
    "reference": "00000000-0000-0000-0000-000000000000",
    "refundStatusUrls": {}
  }
}

Code samples

ts
// @vantagepay/vantagepay
// POS terminal refund integration - typically driven from the .NET SDK.
// Not wrapped by the JavaScript SDK - call the endpoint directly with the active token.
const response = await fetch(baseUrl + '/v2/refund/merchant/external-card', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + ApiTokens.accessToken },
})
const result = await response.json()
csharp
// VantagePay.SDK
using VantagePay.Models.Payments;

var refund = await client.Payments.RefundMerchantAsync(new ExternalCardTransactionData
{
    TransactionReference = "e1d2c3b4-a5f6-4738-9a0b-1c2d3e4f5a6b",
    TransactionBatchReference = Guid.Parse("c7b8a9d0-1234-4567-89ab-cdef01234567"),
    MerchantAccountNumber = "12345678",
    TerminalNumber = "00000042",
    RequestedAmountInCents = 5000,
});

Manually initiate a refund to a merchant.

POST /v2/refund/merchant

The amount refunded does not have to be the full amount of the original transaction, it can be less.

Auth: Access token (Bearer).

Request body

FieldTypeRequiredDescription
descriptionstring?NoAn optional description explaining the reason for the refund.
transactionBatchReferencestring?NoThe reference of the original transaction batch to refund.
refundCategory0, 1, 2, 3, 4, 5, 6, 7, 8, 9NoThe transaction category that classifies this refund (e.g. ZGA.Core.Models.Payments.TransactionCategory.Merchant).
clientDataobject?NoA collection of public data that can be associated with the transaction.
refundAmountInCentsintegerNoThe amount to refund in cents. When 0 the full original transaction amount is refunded.
json
{
  "description": "string",
  "transactionBatchReference": "00000000-0000-0000-0000-000000000000",
  "refundCategory": 0,
  "clientData": {},
  "refundAmountInCents": 0
}

Responses

StatusDescription
202The request was successful but does not return any results.
400The request failed validation, the error object will contain further information.
401The authorization information provided is not valid, authentication is required to access this resource.
403The authorization header does not contain the correct type or you do not have access to this resource.
404The request was successful but does not return any results.
422The request payload is invalid, the error object will contain further information.
429Too many requests are being sent concurrently or rate limiting has taken effect.
500An unexpected error occurred, the error object will contain further information.

Response body

FieldTypeRequiredDescription
successbooleanNoGets a value indicating whether the operation was successful.
resultobjectNoA model to hold the details of a response to a refund request.
json
{
  "success": true,
  "result": {
    "reference": "00000000-0000-0000-0000-000000000000",
    "refundStatusUrls": {}
  }
}

Code samples

ts
// @vantagepay/vantagepay
// Merchant-initiated refund. Not wrapped by the JavaScript SDK.
// Not wrapped by the JavaScript SDK - call the endpoint directly with the active token.
const response = await fetch(baseUrl + '/v2/refund/merchant', {
  method: 'POST',
  headers: { Authorization: 'Bearer ' + ApiTokens.accessToken },
})
const result = await response.json()
csharp
// VantagePay.SDK
using VantagePay.Models.Payments;
using VantagePay.Models.Payments.Requests;

var refund = await client.Payments.RefundMerchantAsync(new MerchantRefundRequest
{
    TransactionBatchReference = "c7b8a9d0-1234-4567-89ab-cdef01234567",
    RefundCategory = TransactionCategory.Card,
    RefundAmountInCents = 5000,
});

Payments for Africa