REST API

REST Example: Performing a Mail Order or Telephone Order Sale

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}/
Request
{ "type" : "PaymentRequest", "merchantReferenceCode" : "a7fbcdc92425456fa0db29c8670a3150", "amountDetails" : { "amount" : "1.00", "currency" : "GBP" }, "paymentMode": "MOTO" }
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." }
Response for a Successful Request
If it applies, the response includes the data that is required in order to generate and print a receipt. The receipt data is located in the receipts section of the response and contains a pre-formatted, compliant receipt that is ready to use. The receipt data also includes the individual receipt line items that are required to build your own receipt. Find merchant- and customer-specific data here:
  • Merchant-specific receipt data is located under
    merchantReceipt
    .
  • Customer-specific receipt data is located under
    customerReceipt
    .
{ "type" : "PaymentResponse", "message" : "Payment approved", "transactionDetails" : { "id" : "4348c35f258c4f8d8c89b9898e3f1b63", "merchantReferenceCode" : "a7fbcdc92425456fa0db29c8670a3150", "submitTimeUtc" : "2023-12-01T20:51:09+0000", "captured" : true, "amountDetails" : { "currency" : "GBP", "amount" : "1.00", "capturedAmount" : "1.00", "refundableAmount" : "1.00" } }, "processingDetails" : { "status" : "APPROVED", "verificationMethod" : "NONE", "entryMode" : "MANUAL", "card" : { "expirationMonth" : "12", "expirationYear" : "2025", "type" : "VISA", "maskedPan" : "411111******1111" } }, "additionalInformation" : { "instrumentId" : "7038380000019631111", "requestId" : "7014638853776978504011" }, "linkedOperations" : [ ], "receipts" : { "merchantReceipt" : { "preformattedReceipt" : "Merchant Receipt\nCP Test\nSample Street\nUB3 2EA London\nUnited Kingdom\n1234567\n\nSale\n£1.00\n\n\nCVV MATCH ONLY\n\n\nCard: VISA\nAccount: **** **** **** 1111\nEntry Mode: Keyed\nVerification: Cardholder Not Present\n\nAuthorization: 938246\nMerchant ID: **37599\nTerminal ID: ****0063\n\n4348c35f258c4f8d8c89b9898e3f1b63\n21:51:27: 01/12/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" : "**** **** **** 1111" }, "PAYMENT_DETAILS_SOURCE" : { "label" : "Entry Mode", "value" : "Keyed" }, "PAYMENT_DETAILS_CUSTOMER_VERIFICATION" : { "label" : "Verification", "value" : "Cardholder Not Present" }, "CLEARING_DETAILS_AUTHORIZATION_CODE" : { "label" : "Authorization", "value" : "938246" }, "CLEARING_DETAILS_MERCHANT_IDENTIFIER" : { "label" : "Merchant ID", "value" : "**37599" }, "CLEARING_DETAILS_TERMINAL_ID" : { "label" : "Terminal ID", "value" : "****0063" }, "RECEIPT_TYPE" : { "label" : "Receipt Type", "value" : "Merchant Receipt" }, "TRANSACTION_TYPE" : { "label" : "Type", "value" : "Sale" }, "SUBJECT" : { "label" : "Description", "value" : "" }, "IDENTIFIER" : { "label" : "PWID", "value" : "4348c35f258c4f8d8c89b9898e3f1b63" }, "AMOUNT_AND_CURRENCY" : { "label" : "Amount", "value" : "£1.00" }, "DATE" : { "label" : "Date", "value" : "01/12/2023" }, "TIME" : { "label" : "Time", "value" : "21:51:27" }, "STATUS_TEXT" : { "label" : "Information", "value" : "CVV MATCH ONLY" } }, "signatureLineRequired" : false } }, "customerReceipt" : { "preformattedReceipt" : "Cardholder Receipt\nCP Test\nSample Street\nUB3 2EA London\nUnited Kingdom\n1234567\n\nSale\n£1.00\n\n\nPlease retain receipt!\n\n\nCard: VISA\nAccount: **** **** **** 1111\nEntry Mode: Keyed\nVerification: Cardholder Not Present\n\nAuthorization: 938246\nMerchant ID: **37599\nTerminal ID: ****0063\n\n4348c35f258c4f8d8c89b9898e3f1b63\n21:51:27: 01/12/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" : "**** **** **** 1111" }, "PAYMENT_DETAILS_SOURCE" : { "label" : "Entry Mode", "value" : "Keyed" }, "PAYMENT_DETAILS_CUSTOMER_VERIFICATION" : { "label" : "Verification", "value" : "Cardholder Not Present" }, "CLEARING_DETAILS_AUTHORIZATION_CODE" : { "label" : "Authorization", "value" : "938246" }, "CLEARING_DETAILS_MERCHANT_IDENTIFIER" : { "label" : "Merchant ID", "value" : "**37599" }, "CLEARING_DETAILS_TERMINAL_ID" : { "label" : "Terminal ID", "value" : "****0063" }, "RECEIPT_TYPE" : { "label" : "Receipt Type", "value" : "Cardholder Receipt" }, "TRANSACTION_TYPE" : { "label" : "Type", "value" : "Sale" }, "SUBJECT" : { "label" : "Description", "value" : "" }, "IDENTIFIER" : { "label" : "PWID", "value" : "4348c35f258c4f8d8c89b9898e3f1b63" }, "AMOUNT_AND_CURRENCY" : { "label" : "Amount", "value" : "£1.00" }, "DATE" : { "label" : "Date", "value" : "01/12/2023" }, "TIME" : { "label" : "Time", "value" : "21:51:27" }, "STATUS_TEXT" : { "label" : "Information", "value" : "Please retain receipt!" } }, "signatureLineRequired" : false } } } }
Response for 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." }