Payment request with receipt generated by the POS

Adding receipt to your payment request alllows your customers to view the full payment receipt on their mobile device immediately after the payment approved, and on their SensePass account.

Receipt full documentation: Receipts Model

Creating a Payment Request

URL: /transactions/init

Request Body:

{
  "timeOut": 600,
  "amount": 200,
  "isCent": true,
  "currency": "USD",
  "deviceId": "2ooeww5ufzg3nkuf8a10gu5n695yolixlbgb042o03to9bxfkr7t815i5epu8o58jv1rznif3o1tr6xsb1rm",
  "receipt": {
    "mode": 2
  },
  "receiptNotifications": {
    "email": [
      "a@example.com"
    ],
    "sms": [
      "9295522135"
    ]
  }
}

Response body:

{
    "TransactionNumber": "5f3275249792ee75b41322e636617ee039e2e1a49cc80c11f2177233",
    "date": "2022-08-14T10:09:05.810Z",
    "amount": "2",
    "currency": "USD",
    "status": 0,
    "statusName": "Initialize",
    "timeoutDate": "2022-08-14T10:19:05.872Z",
    "paymentCommit": {
        "messsage": "Payment commit is enabled for this transaction"
    },
    "businessId": "339978940107456",
    "businessName": "Coffee Bar",
    "pos": "POS 1",
    "businessOwnerPhone": "3587292",
    "businessCountry": "US",
    "businessCity": "Virginia Beach",
    "businessStreet": "123 Street",
    "businessAddress": "123 Street, Virginia Beach",
    "branchNumber": "1",
    "branchId": "1",
    "receiptPending": true,
    "posReceiptsEndpoint": "https://api.sandbox.sensepass.com/api/invoicesReceipts/receipt/save/0128c664-1a2a-422c-91d0-85a8af229ed4",
    "transactionPage": {
        "iOSLink": "https://pay.sandbox.sensepass.com/orderSummary/5f3275249792ee75b41322e636617ee039e2e1a49cc80c27f2177233",
        "androidLink": "https://pay.sandbox.sensepass.com/orderSummary/5f3275249792ee75b41322e636617ee039e2e1a49cc80c27f2177233",
        "qrURL": "https://pay.sandbox.sensepass.com/orderSummary/5f3275249792ee75b41322e636617ee039e2e1a49cc80c27f2177233"
    }
}

See "posReceiptsEndpoint" field in the response body, the value of the field represents the unique endpoint created for saving the receipt created by the POS.

Save this value in the POS for a case of "Approved" status event.

Transaction Approved Status Event

Register to Socket.IO channel or use callback URL to get notifications about transaction status changes.

Once the transaction status changes to status "Approved" (5) you will get "confirmations" object in the Transaction model:

{
    "TransactionNumber": "5f3275249792ee75b41322e636617ee039e2e1a49cc80c11f2177233",
    "date": "2022-08-14T10:09:05.810Z",
    "amount": "2",
    "currency": "USD",
    "status": 0,
    "statusName": "Initialize",
    "timeoutDate": "2022-08-14T10:19:05.872Z",
    "paymentCommit": {
        "messsage": "Payment commit is enabled for this transaction"
    },
    "businessId": "339978940107456",
    "businessName": "Coffee Bar",
    "pos": "POS 1",
    "businessOwnerPhone": "3587292",
    "businessCountry": "US",
    "businessCity": "Virginia Beach",
    "businessStreet": "123 Street",
    "businessAddress": "123 Street, Virginia Beach",
    "branchNumber": "1",
    "branchId": "1",
    "receiptPending": true,
    "posReceiptsEndpoint": "https://api.sandbox.sensepass.com/api/invoicesReceipts/receipt/save/0128c664-1a2a-422c-91d0-85a8af229ed4",
    "transactionPage": {
        "iOSLink": "https://pay.sandbox.sensepass.com/orderSummary/5f3275249792ee75b41322e636617ee039e2e1a49cc80c27f2177233",
        "androidLink": "https://pay.sandbox.sensepass.com/orderSummary/5f3275249792ee75b41322e636617ee039e2e1a49cc80c27f2177233",
        "qrURL": "https://pay.sandbox.sensepass.com/orderSummary/5f3275249792ee75b41322e636617ee039e2e1a49cc80c27f2177233"
    },
    "confirmations": [
    {
      "paymentType": "Regular",
      "confirmationNumber": "063-d9j09YsY1",
      "fullConfirmationCode": "063-d9j09YsY1",
      "dateApproval": "2019-12-19T09:47:59.105Z",
      "installments": 1,
      "paymentMethodName": "PayPal",
      "approvedBy": "PayPal",
      "providerId": "uGfNuwEGiP18SUnTUEo1/atTdesDnhDhZ/8i7G9NAEg=",
      "requestID": "a4dbf66e-d3f1-4a29-baf7-2591424a9a0c",
      "authNumber": "123213dsf13111",
      "referenceNumber": "1778298289",
      "acquirer": "Visa",
      "voucher": "yyyAbnlmlfm1323",
      "lastFourDigits": "8858",
      "sensePassReferenceId": "34e209ea8b24cc831cf"
    }
  ]
}

Save all "confirmationNumber" objects, and create receipt in your POS.

More than one "confirmations" object can be available in cases of split payment, refund and partial refund

Sending the receipt from the POS to SensePass

Once the receipt is ready in your POS, invoke API request to the endpoint from "posReceiptsEndpoint" (see the previous section).

Option 1 - Send Receipt file

Example URL (based on "posReceiptsEndpoint"): https://api.sandbox.sensepass.com/api/invoicesReceipts/receipt/save/0128c664-1a2a-422c-91d0-85a8af229ed4

Request Body as form-data:

FieldValue

receipt-file

Your File Here - PDF or Image

jsonStr

{
  "type": "pdf",
  "receiptIdentifier": "43242342324",
  "associateToConfirmationNumbers": [
    "012-34567891",
    "012-34567892"
  ]
}

"associateToConfirmationNumbers" is an array of "confirmationNumber" for the previous sections, this is the relation between the receipt to the payments of the consumer.

Response body:

{
  "success": true,
  "message": "Saved"
}

Option 2 - Send Receipt URL

It is required to host the receipt on a publicly accessible server and send SensePass the full URL of the file, SensePass will not expose to the consumers the URL, instead our servers will download the receipt from your server and host it securely.

Example URL (based on "posReceiptsEndpoint"): https://api.sandbox.sensepass.com/api/invoicesReceipts/receipt/save/0128c664-1a2a-422c-91d0-85a8af229ed4

Request Body:

{
  "url": "http://someDomain.com/receipt1.pdf",
  "type": "pdf",
  "receiptIdentifier": "43242342324",
  "associateToConfirmationNumbers": [
    "012-34567891",
    "012-34567892"
  ]
}

"associateToConfirmationNumbers" is an array of "confirmationNumber" for the previous sections, this is the relation between the receipt to the payments of the consumer.

Response body:

{
  "success": true,
  "message": "Saved"
}

Option 3 - Send Receipt as HTML

Example URL (based on "posReceiptsEndpoint"): https://api.sandbox.sensepass.com/api/invoicesReceipts/receipt/save/0128c664-1a2a-422c-91d0-85a8af229ed4

Request Body:

{
  "base64data": "PGh0bWw+",
  "type": "html",
  "receiptIdentifier": "43242342324",
  "associateToConfirmationNumbers": [
    "012-34567891",
    "012-34567892"
  ]
}

"associateToConfirmationNumbers" is an array of "confirmationNumber" for the previous sections, this is the relation between the receipt to the payments of the consumer.

Response body:

{
  "success": true,
  "message": "Saved"
}

Last updated