REST API

REST Example: Performing a Cancel Transaction

Endpoints

Generate a bearer token before sending each request. For more information, see Generating a Bearer Token for Authentication Using a REST API Request.
Test:
POST https://terminalstest.cybersource.com/v1/cloud/transactions
Production:
POST https://terminals.cybersource.com/v1/cloud/transactions
Request
{ "serialNumber": "1850000000", "request": { "type": "CancelRequest" } }
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 aborted", "transactionDetails" : { "id" : "b6522aeb9d8d49b386f7c67852581145", "merchantReferenceCode" : "50c86aaa02ed4c0bb4b4b596379713f7", "submitTimeUtc" : "2023-12-01T20:30:05+0000", "captured" : false, "amountDetails" : { "currency" : "GBP", "amount" : "1.00", "capturedAmount" : "0.00", "refundableAmount" : "0.00" } }, "processingDetails" : { "status" : "ABORTED", "verificationMethod" : "UNKNOWN", "entryMode" : "NFC_ICC", "card" : { "expirationMonth" : "00", "expirationYear" : "00", "type" : "UNKNOWN", "maskedPan" : "" } }, "linkedOperations" : [ ], "receipts" : { "merchantReceipt" : { "preformattedReceipt" : "Merchant Receipt\nCP Test\nSample Street\nUB3 2EA London\nUnited Kingdom\n1234567\n\nSale\n£1.00\n\n\nCanceled transaction.\n\n\nEntry Mode: Contactless\nAID: NULL\n\n\nb6522aeb9d8d49b386f7c67852581145\n21:30:05: 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_EMV_APPLICATION_ID" : { "label" : "AID", "value" : "NULL" }, "PAYMENT_DETAILS_SOURCE" : { "label" : "Entry Mode", "value" : "Contactless" }, "RECEIPT_TYPE" : { "label" : "Receipt Type", "value" : "Merchant Receipt" }, "TRANSACTION_TYPE" : { "label" : "Type", "value" : "Sale" }, "SUBJECT" : { "label" : "Description", "value" : "" }, "IDENTIFIER" : { "label" : "PWID", "value" : "b6522aeb9d8d49b386f7c67852581145" }, "AMOUNT_AND_CURRENCY" : { "label" : "Amount", "value" : "£1.00" }, "DATE" : { "label" : "Date", "value" : "01/12/2023" }, "TIME" : { "label" : "Time", "value" : "21:30:05" }, "STATUS_TEXT" : { "label" : "Information", "value" : "Canceled transaction." } }, "signatureLineRequired" : false } }, "customerReceipt" : { "preformattedReceipt" : "Cardholder Receipt\nCP Test\nSample Street\nUB3 2EA London\nUnited Kingdom\n1234567\n\nSale\n£1.00\n\n\nCanceled transaction.\n\n\nEntry Mode: Contactless\nAID: NULL\n\n\nb6522aeb9d8d49b386f7c67852581145\n21:30:05: 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_EMV_APPLICATION_ID" : { "label" : "AID", "value" : "NULL" }, "PAYMENT_DETAILS_SOURCE" : { "label" : "Entry Mode", "value" : "Contactless" }, "RECEIPT_TYPE" : { "label" : "Receipt Type", "value" : "Cardholder Receipt" }, "TRANSACTION_TYPE" : { "label" : "Type", "value" : "Sale" }, "SUBJECT" : { "label" : "Description", "value" : "" }, "IDENTIFIER" : { "label" : "PWID", "value" : "b6522aeb9d8d49b386f7c67852581145" }, "AMOUNT_AND_CURRENCY" : { "label" : "Amount", "value" : "£1.00" }, "DATE" : { "label" : "Date", "value" : "01/12/2023" }, "TIME" : { "label" : "Time", "value" : "21:30:05" }, "STATUS_TEXT" : { "label" : "Information", "value" : "Canceled transaction." } }, "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." }