Update a Transaction

Updating transaction amount

Flow:

  1. The transaction must be created with "readyForPayment": false flag first

  2. The customer can see the transaction page and can't choose any payment method

  3. The platform calls PATCH API to update transaction details including "amount" field, this API can be invoke multiple times

  4. The platform calls "readyForPayment" API - which allows the customer to choose a payment method and pay - without having to refresh the page or tap again

This flow is useful for POS who would like to create an initial transaction object with zero amount and update the total amount and other fields during the products scanning proccess, or any other flow where there is a requirement to create transaction once, and update it's amount and data later.

The customer will be allowed to make payment only after "readyForPayment" API will be called

Step 1 - Creating a transaction in Setup state

POST

https://api.sandbox.sensepass.com/api/transactions/init

{
    "amount": 100,
    "currency": "USD",
    "isCent": true,
    "readyForPayment": false,
    "deviceId": "YOUR-DEVICE-ID"
} 

Step 2 - Updating transaction Data

PATCH

https://api.sandbox.sensepass.com/api/transactions/250b859e1fb5b162d476f67dcc9ef9f0e2cb3a9412d13a610412d769

{
    "amount": 550,
    "currency": "USD",
    "isCent": true,
    "deviceId": "YOUR-DEVICE-ID"
} 

Step 3 - Allowing user to make payments

POST

https://api.sandbox.sensepass.com/api/transactions/250b859e1fb5b162d476f67dcc9ef9f0e2cb3a9412d13a610412d769/readyForPayment

{
    "amount": 550,
    "currency": "USD",
    "isCent": true,
    "deviceId": "YOUR-DEVICE-ID"
} 

Updating transaction fields

The following fields can be updated using the PATCH method based on Transaction Entity:

  1. reason

  2. posData

  3. metadata

Example

PATCH

https://api.sandbox.sensepass.com/api/transactions/250b859e1fb5b162d476f67dcc9ef9f0e2cb3a9412d13a610412d769

{
  "reason": "New Reason",
  "posData": {
    "a": "b"
  },
  "metadata": {
    "x": "y"
  },
  "deviceId": "YOUR-DEVICE-ID"
}

Last updated