Integration API (v2)
Download OpenAPI specification:Download
API Reference for interacting with the Customer Session
Request
A customer session request
object includes
- identifying information for the session (
id
) - consistency identifier (
consistency_id
) - basket information (
basket: { total }
) - scanned
tokens
intended to be included in the session items
in the customers basket the merchant would like to check for subsidies
The items
provided can be compared against the relevant_items
(see below).
Response
A customer session response
object includes
- identifying information for the session (
id
,consistency_id
,ref
) - scanned
tokens
used to retrieve associated coupons - the current
state
of the session (OPEN
,CLOSED
orCANCELLED
) - an
external identifier
for the customer providing the coupon, can be used to identify the customer to Merchant Loyalty Program - a list of
coupons
associated with the scanned token relevant_items
(products) associated with the extracted couponssubsidies
that Transit will provide towards products
Update a Customer Session
A session can be created just by sending a ref
to the Transit Desktop Agent's http://localhost:42000/v2/customer_session
endpoint. Once created, you can expand on the interaction with repeated PUT
requests to the same endpoint.
Repeated calls function as a transaction negotiation and allow the Merchant and Transit to come to agreement on the subsidies Transit is committing to provide.
Request Body schema: application/json
ref required | string Reference id to create a new session |
Responses
Response Schema: application/json
id required | string Session identifier | ||||||||||||||||||||||||||||||||||
consistency_id required | string Session consistency identifier | ||||||||||||||||||||||||||||||||||
required | object Customer profile identifier | ||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
ref required | string Initial session reference identifier | ||||||||||||||||||||||||||||||||||
initiated_at required | string <date-time> Session initiated time | ||||||||||||||||||||||||||||||||||
state required | string Enum: "OPEN" "CLOSED" "CANCELLED" Current state of a session | ||||||||||||||||||||||||||||||||||
tokens required | Array of strings A list of tokens | ||||||||||||||||||||||||||||||||||
authorization_code | string | ||||||||||||||||||||||||||||||||||
required | Array of objects Data associated with tokens added to the session | ||||||||||||||||||||||||||||||||||
Array
| |||||||||||||||||||||||||||||||||||
required | Array of objects A list of coupons from tokens | ||||||||||||||||||||||||||||||||||
Array
| |||||||||||||||||||||||||||||||||||
required | Array of objects Relevant items list | ||||||||||||||||||||||||||||||||||
Array
| |||||||||||||||||||||||||||||||||||
required | Array of objects Session items list | ||||||||||||||||||||||||||||||||||
Array
| |||||||||||||||||||||||||||||||||||
Array of objects A list of item subsidies in absolute values | |||||||||||||||||||||||||||||||||||
Array
| |||||||||||||||||||||||||||||||||||
Array of objects A list of additional subsidies not relevant to items | |||||||||||||||||||||||||||||||||||
Array
| |||||||||||||||||||||||||||||||||||
object All subsidies summary | |||||||||||||||||||||||||||||||||||
|
Response Schema: application/json
message required | string Error message | ||
object Error data | |||
|
Response Schema: application/json
message required | string |
Request samples
- Payload
{- "ref": "my-ref-id-1"
}
Response samples
- 200
- 400
- 404
{- "id": "cs_lm65Qtbtv9b2NH0R2WcHf1Hq5Msp",
- "consistency_id": "MTY1OTk1NTA4NjAxMF85Ng",
- "customer_profile": {
- "id": "f3814d45-760d-4406-9398-916764c3535a"
}, - "ref": "my-ref-001",
- "initiated_at": "2019-08-24T14:15:22Z",
- "state": "OPEN",
- "tokens": [
- "m_eyJ0eXBlIjoibWFudWFsIiwidmFsdWUiOiJWQUxJRDAwMDEwIn0=",
- "m_eyJ0eXBlIjoibWFudWFsIiwidmZsdGUiOiAWQUxJRDAwMDEwIn0=",
- "m_eyJ0eXBlIjoibWFudWFsIiwidmZsdGUiOiAWQUxJRDAwDDEzzn0=",
- "m_eyJ0eXBlIjoibWFudWFsIiwidmFsdWUiOiJUR0NGTlVOVzQwIn0="
], - "authorization_code": "string",
- "token_data": [
- {
- "valid": true,
- "token": "m_eyJ0eXBlIjoibWFudWFsIiwidmFsdWUiOiJWQUxJRDAwMDEwIn0=",
- "coupons": [
- "MTER-DTSS"
], - "code": "3V7LLP5S4Z"
}, - {
- "valid": true,
- "token": "m_eyJ0eXBlIjoibWFudWFsIiwidmZsdGUiOiAWQUxJRDAwMDEwIn0=",
- "coupons": [
- "SMMR-SSSL"
], - "code": "3VXDLP5S4Z"
}, - {
- "valid": true,
- "token": "m_eyJ0eXBlIjoibWFudWFsIiwidmZsdGUiOiAWQUxJRDAwDDEzzn0=",
- "coupons": [
- "MTER-DEEE"
], - "code": "<57ABP5S4Z"
}, - {
- "valid": false,
- "token": "m_eyJ0eXBlIjoibWFudWFsIiwidmFsdWUiOiJUR0NGTlVOVzQwIn0=",
- "message": "Cannot access resource"
}
], - "coupons": [
- {
- "id": "MTER-DTSS",
- "name": "10% off",
- "status": "VALID",
- "token": "m_eyJ0eXBlIjoibWFudWFsIiwidmFsdWUiOiJWQUxJRDAwMDEwIn0=",
- "relevant_items": [
- {
- "sku": "PRODUCT-002"
}
], - "item_subsidies": [
- {
- "sku": "PRODUCT-002",
- "coupon_id": "MTER-DTSS",
- "value": 1.2
}
], - "additional_subsidies": [ ]
}, - {
- "id": "SMMR-SSSL",
- "name": "Summer 20% off",
- "status": "VALID",
- "token": "m_eyJ0eXBlIjoibWFudWFsIiwidmZsdGUiOiAWQUxJRDAwMDEwIn0=",
- "relevant_items": [
- {
- "sku": "PRODUCT-001"
}
], - "item_subsidies": [
- {
- "sku": "PRODUCT-001",
- "coupon_id": "SMMR-SSSL",
- "value": 2
}
], - "additional_subsidies": [ ]
}, - {
- "id": "MTER-DEEE",
- "name": "$10 Off",
- "status": "VALID",
- "token": "m_eyJ0eXBlIjoibWFudWFsIiwidmZsdGUiOiAWQUxJRDAwDDEzzn0=",
- "relevant_items": [ ],
- "item_subsidies": [ ],
- "additional_subsidies": [
- {
- "name": "$10 Off",
- "coupon_id": "MTER-DEEE",
- "value": 10
}
]
}
], - "relevant_items": [
- {
- "sku": "PRODUCT-002"
}, - {
- "sku": "PRODUCT-001"
}
], - "items": [
- {
- "sku": "PRODUCT-001",
- "name": "Item 1",
- "price": 10,
- "quantity": 1
}, - {
- "sku": "PRODUCT-002",
- "name": "Item 2",
- "price": 12,
- "quantity": 2
}
], - "item_subsidies": [
- {
- "sku": "PRODUCT-001",
- "value": 2,
- "coupon_id": "SMMR-SSSL"
}, - {
- "sku": "PRODUCT-002",
- "value": 1.2,
- "coupon_id": "MTER-DTSS"
}
], - "additional_subsidies": [
- {
- "name": "$10 Off",
- "coupon_id": "MTER-DEEE",
- "value": 10
}
], - "subsidy_summary": {
- "item_subsidies": 3.2,
- "additional_subsidies_total": 10,
- "total": 13.2
}
}
The customer session api accepts { tokens: [...] }
, an array containing tokens to apply during the customer session.
If a hardware scanner is connected to the POS host, a token can be obtained using the /v2/token/scan
api.
When no scanner is connected or to perform manual redemption, a manual token can be obtained using the /v2/token/encode endpoint.
Scan a Token
Is used to scan a token from a customers mobile device. Calling /v2/token/scan
will trigger the scanner to begin listening for scans, and the red scanning light will be activated for the duration of the request.
When the scanner scans a bCODE, the request will return a token, which can be passed to the Transit API.
Exiting scanning mode
query Parameters
attempts | integer <int64> >= 1 Default: 20 Maximum amount of times to attempt a scan |
timeout | integer <int64> >= 1 Default: 30 Maximum time in seconds allowed for customer to scan |
provider | string Default: "transit" Enum: "giftaway" "transit" Used to specify the token provider. Defaults to transit |
Responses
Response Schema: application/json
token required | string |
Response Schema: application/json
message required | string | ||
required | object | ||
|
Response Schema: application/json
attempts required | integer <int64> >= 1 |
message required | string |
Response Schema: application/json
message required | string |
Response Schema: application/json
message required | string |
Response samples
- 200
- 400
- 409
- 500
- 503
{- "token": "bl_eyJ0eXBlIjoiYmNvZGUiLCJ2YWx1ZSI6IjdkYjM2NTcyYWE4N2QzZTNkMzE2YjJlYjMwMjM3MjQ0In0"
}
Creating a Manual Token
Is used to encode input data captured manually by a cashier from a customers mobile device.
The response will contain a token, which can be passed to the Transit API.
Request Body schema: application/json
data required | string Data captured by cashier |
provider | string Default: "transit" Enum: "giftaway" "transit" Used to specify the token provider. Defaults to transit |
Responses
Response Schema: application/json
token required | string |
Response Schema: application/json
message required | string | ||
required | object | ||
|
Response Schema: application/json
message required | string |
Response Schema: application/json
message required | string |
Request samples
- Payload
{- "data": "FIXED00002",
- "provider": "giftaway"
}
Response samples
- 200
- 400
- 409
- 500
{- "token": "m_eyJ0eXBlIjoiYmNvZGUiLCJ2YWx1ZSI6IjdkYjM2NTcyYWE4N2QzZTNkMzE2YjJlYjMwMjM3MjQ0In0"
}