Processing a Token Refund
This section describes how to process a token refund when the app is in Local
mode. A token refund transaction enables you to process a stand-alone credit against a
tokenized card. In order to process a credit through a token, you must have the
Token Management Service
product enabled and an existing (saved) token from a tokenized
transaction. For more information, see .Endpoints
The endpoint is the same for the test and production environments.
Test:
wss://{terminal IP address:port number}/
Production:
wss://{terminal IP address:port number}/
Required Fields for Processing a Token Refund
- type
- Set this field toTokenRefundRequest.
- instrumentId
- Set this field to the Instrument Identifier token.
- merchantReferenceCode
- Set this field to a unique, user-defined reference code. The code can consist of up to 50 alphanumeric characters, underscores (_), and dashes (-). Avoid using formatting that resembles a telephone number (XXX-XXX-XXXX) or a Social Security number (XXX-XX-XXXX).
- amountDetails.amount
- Set this field to the transaction amount.
- amountDetails.currency
- Set this field to the currency code.
REST Example: Processing a Token Refund
Request
{"type": "TokenRefundRequest", "instrumentId": "7030000000022690119", "merchantReferenceCode": "30ed45dc7b3f4fb9905413940ac30363", "amountDetails": { "amount": "1.00", "currency": "GBP" }}
Mid-Transaction Status Updates
During the transaction, you might receive one or more update responses indicating the current status of the transaction. You can choose to display these updates on your point-of-sale (POS) system.
{"type": "TransactionStatusResponse", "message": "Status update to display.", "canBeAborted": true/false}
Response to a Successful Request
{"type" : "TokenRefundResponse", "message" : "Refund approved", "transactionDetails" : { "id" : "596b797178fe45e39ce3a8b8fdf432d6", "merchantReferenceCode" : "30ed45dc7b3f4fb9905413940ac30363", "submitTimeUtc" : "2023-12-01T21:02:50+0000", "amountDetails" : { "amount" : "1.00", "currency" : "GBP" } }, "processingDetails" : { "status" : "APPROVED", "verificationMethod" : "NONE", "entryMode" : "MANUAL", "card" : { "expirationMonth" : "00", "expirationYear" : "00", "type" : "VISA", "maskedPan" : "703000XXXXXXXXX0119" } }, "additionalInformation" : { "requestId" : "7014645711206245404009" }, "receipts" : { "merchantReceipt" : { "preformattedReceipt" : "Merchant Receipt\nCP Test\nSample Street\nUB3 2EA London\nUnited Kingdom\n1234567\n\nRefund\n-£1.00\n\n\nPlease retain receipt!\n\n\nCard: VISA\nAccount: *** **** **** **** 0119\nEntry Mode: Keyed\n\nTransaction: -\nAuthorization: -\nMerchant ID: **37599\nTerminal ID: *************L_ID\n\n596b797178fe45e39ce3a8b8fdf432d6\n10:02:50 PM: 12/1/2023\n\n\n", "receiptData" : { "lines" : { "MERCHANT_DETAILS_PUBLIC_NAME" : { "label" : "Name", "value" : "CP Test" }, "MERCHANT_DETAILS_ADDRESS" : { "label" : "Address", "value" : "Sample Street" }, "MERCHANT_DETAILS_ZIP" : { "label" : "Zip", "value" : "UB3 2EA" }, "MERCHANT_DETAILS_CITY" : { "label" : "City", "value" : "London" }, "MERCHANT_DETAILS_COUNTRY" : { "label" : "Country", "value" : "United Kingdom" }, "MERCHANT_DETAILS_CONTACT" : { "label" : "Contact", "value" : "1234567" }, "MERCHANT_DETAILS_ADDITIONAL_INFORMATION" : { "label" : "Additional Information", "value" : "" }, "PAYMENT_DETAILS_SCHEME_OR_LABEL" : { "label" : "Card", "value" : "VISA" }, "PAYMENT_DETAILS_MASKED_ACCOUNT" : { "label" : "Account", "value" : "*** **** **** **** 0119" }, "PAYMENT_DETAILS_SOURCE" : { "label" : "Entry Mode", "value" : "Keyed" }, "CLEARING_DETAILS_TRANSACTION_IDENTIFIER" : { "label" : "Transaction", "value" : "-" }, "CLEARING_DETAILS_AUTHORIZATION_CODE" : { "label" : "Authorization", "value" : "-" }, "CLEARING_DETAILS_MERCHANT_IDENTIFIER" : { "label" : "Merchant ID", "value" : "**37599" }, "CLEARING_DETAILS_TERMINAL_ID" : { "label" : "Terminal ID", "value" : "*************L_ID" }, "RECEIPT_TYPE" : { "label" : "Receipt Type", "value" : "Merchant Receipt" }, "TRANSACTION_TYPE" : { "label" : "Type", "value" : "Refund" }, "SUBJECT" : { "label" : "Description", "value" : "" }, "IDENTIFIER" : { "label" : "PWID", "value" : "596b797178fe45e39ce3a8b8fdf432d6" }, "AMOUNT_AND_CURRENCY" : { "label" : "Amount", "value" : "-£1.00" }, "DATE" : { "label" : "Date", "value" : "12/1/2023" }, "TIME" : { "label" : "Time", "value" : "10:02:50 PM" }, "STATUS_TEXT" : { "label" : "Information", "value" : "Please retain receipt!" } }, "signatureLineRequired" : false } }, "customerReceipt" : { "preformattedReceipt" : "Cardholder Receipt\nCP Test\nSample Street\nUB3 2EA London\nUnited Kingdom\n1234567\n\nRefund\n-£1.00\n\n\nPlease retain receipt!\n\n\nCard: VISA\nAccount: *** **** **** **** 0119\nEntry Mode: Keyed\n\nTransaction: -\nAuthorization: -\nMerchant ID: **37599\nTerminal ID: *************L_ID\n\n596b797178fe45e39ce3a8b8fdf432d6\n10:02:50 PM: 12/1/2023\n\n\n", "receiptData" : { "lines" : { "MERCHANT_DETAILS_PUBLIC_NAME" : { "label" : "Name", "value" : "CP Test" }, "MERCHANT_DETAILS_ADDRESS" : { "label" : "Address", "value" : "Sample Street" }, "MERCHANT_DETAILS_ZIP" : { "label" : "Zip", "value" : "UB3 2EA" }, "MERCHANT_DETAILS_CITY" : { "label" : "City", "value" : "London" }, "MERCHANT_DETAILS_COUNTRY" : { "label" : "Country", "value" : "United Kingdom" }, "MERCHANT_DETAILS_CONTACT" : { "label" : "Contact", "value" : "1234567" }, "MERCHANT_DETAILS_ADDITIONAL_INFORMATION" : { "label" : "Additional Information", "value" : "" }, "PAYMENT_DETAILS_SCHEME_OR_LABEL" : { "label" : "Card", "value" : "VISA" }, "PAYMENT_DETAILS_MASKED_ACCOUNT" : { "label" : "Account", "value" : "*** **** **** **** 0119" }, "PAYMENT_DETAILS_SOURCE" : { "label" : "Entry Mode", "value" : "Keyed" }, "CLEARING_DETAILS_TRANSACTION_IDENTIFIER" : { "label" : "Transaction", "value" : "-" }, "CLEARING_DETAILS_AUTHORIZATION_CODE" : { "label" : "Authorization", "value" : "-" }, "CLEARING_DETAILS_MERCHANT_IDENTIFIER" : { "label" : "Merchant ID", "value" : "**37599" }, "CLEARING_DETAILS_TERMINAL_ID" : { "label" : "Terminal ID", "value" : "*************L_ID" }, "RECEIPT_TYPE" : { "label" : "Receipt Type", "value" : "Cardholder Receipt" }, "TRANSACTION_TYPE" : { "label" : "Type", "value" : "Refund" }, "SUBJECT" : { "label" : "Description", "value" : "" }, "IDENTIFIER" : { "label" : "PWID", "value" : "596b797178fe45e39ce3a8b8fdf432d6" }, "AMOUNT_AND_CURRENCY" : { "label" : "Amount", "value" : "-£1.00" }, "DATE" : { "label" : "Date", "value" : "12/1/2023" }, "TIME" : { "label" : "Time", "value" : "10:02:50 PM" }, "STATUS_TEXT" : { "label" : "Information", "value" : "Please retain receipt!" } }, "signatureLineRequired" : false } } }}
Response to an Unsuccessful Request
If the request is unsuccessful, you will receive an error response with details.
{"type": "ErrorResponse", "message": "Error message to display.", "developerDescription": "Detailed description of error."}