Tokens are Assets API which can only be spent in full.
Every Token is associated with a Collection, which defines the branding and general rules for the Tokens, such as active duration.
A Redemption Condition is created for each Merchant API that accepts Tokens from a Collection, and contains additional conditions specific to that Merchant, such as redeemable product identifiers.
Attributes
Attributes
period
duration
Attributes
sku
name
maxValue
monetary
Attributes
collectionId
idempotencyKey
externalId
accountId
/api/collections
This endpoint allows you to create a Token Collection.
Attributes
Errors
EXTERNAL_ID_ALREADY_USED
Request
curl -X POST \
https://service.centrapay.com/api/collections \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"name": "Bread",
"accountId": "T3y6hogYA4d612BExypWYH",
"tokenExpiresAfter": {
"period": "month",
"duration": "1"
},
"maxValue": {
"currency": "NZD",
"amount": "400"
},
"type": "product",
"mediaUploadId": "12345",
"externalId": "ABC"
}
'
Response
{
"id": "c_Xv990BzkgfoDS7bBls50pd",
"name": "Bread",
"accountId": "T3y6hogYA4d612BExypWYH",
"tokenExpiresAfter": {
"period": "month",
"duration": "1"
},
"maxValue": {
"currency": "NZD",
"amount": "400"
},
"test": true,
"type": "product",
"status": "active",
"createdBy": "crn::user:b657195e-dc2f-11ea-8566-e7710d592c99",
"createdAt": "2021-05-12T04:30:11.001Z",
"mediaUploadId": "12345",
"img": "https://media-upload.centrapay.com/image.png?jhbdsfau67ewejshb=487hsdjhbdgs743",
"issuer": "Centrapay",
"externalId": "ABC"
}
/api/accounts/{accountId}/collections
Returns a paginated API list of Token Collections for an Account.
Attributes
pageKey
Request
curl -X GET \
'https://service.centrapay.com/api/accounts/T3y6hogYA4d612BExypWYH/collections?pageKey=Collection%232G5bXm4dnuDHnnKY8WeCPm%7C%23Collection%7C8vq4kn03o0g1grrihk7ooloizpqt2y' \
-H 'x-api-key: <TOKEN>'
Response
{
"nextPageKey": "Collection#E9eXsErwA444qFDoZt5iLA|#Collection",
"items": [
{
"id": "c_Xv990BzkgfoDS7bBls50pd",
"name": "Bread",
"accountId": "T3y6hogYA4d612BExypWYH",
"tokenExpiresAfter": {
"period": "month",
"duration": "1"
},
"maxValue": {
"currency": "NZD",
"amount": "400"
},
"test": true,
"type": "product",
"status": "active",
"createdBy": "crn::user:b657195e-dc2f-11ea-8566-e7710d592c99",
"createdAt": "2021-05-12T04:30:11.001Z",
"mediaUploadId": "12345",
"img": "https://media-upload.centrapay.com/image.png?jhbdsfau67ewejshb=487hsdjhbdgs743",
"issuer": "Centrapay"
}
]
}
/api/collections/{collectionId}/redemption-conditions
This endpoint allows you to create a Redemption Condition.
Attributes
merchantId
allowedProducts
Errors
INVALID_AMOUNT
REDEMPTION_CONDITION_ALREADY_EXISTS
Request
curl -X POST \
https://service.centrapay.com/api/collections/c_NFhUgPQEYbk2EbTXAYArTX/redemption-conditions \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"merchantId": "36EALpZ89XpShxM2Ee9sXT",
"allowedProducts": [
{
"sku": "100001",
"name": "White Bread",
"maxValue": {
"currency": "NZD",
"amount": "400"
}
},
{
"sku": "100002",
"name": "Sourdough Bread",
"maxValue": {
"currency": "NZD",
"amount": "800"
}
}
]
}
'
Response
{
"id": "1234",
"merchantId": "36EALpZ89XpShxM2Ee9sXT",
"collectionId": "c_NFhUgPQEYbk2EbTXAYArTX",
"allowedProducts": [
{
"sku": "100001",
"name": "White Bread",
"maxValue": {
"currency": "NZD",
"amount": "400"
}
},
{
"sku": "100002",
"name": "Sourdough Bread",
"maxValue": {
"currency": "NZD",
"amount": "800"
}
}
],
"createdAt": "2022-05-12T04:30:11.001Z",
"createdBy": "crn::user:b657195e-dc2f-11ea-8566-e7710d592c99"
}
/api/collections/{collectionId}/redemption-conditions/{redemptionConditionId}/set-allowed-products
This endpoint allows you to set Allowed Products for a Redemption Condition.
Attributes
allowedProducts
Errors
INVALID_AMOUNT
Request
curl -X POST \
https://service.centrapay.com/api/collections/c_NFhUgPQEYbk2EbTXAYArTX/redemption-conditions/DKTs3U38hdhfEqwF1JKoT2/set-allowed-products \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"allowedProducts": [
{
"sku": "100001",
"name": "White Bread",
"maxValue": {
"currency": "NZD",
"amount": "400"
}
},
{
"sku": "100002",
"name": "Sourdough Bread",
"maxValue": {
"currency": "NZD",
"amount": "800"
}
}
]
}
'
Response
{
"id": "DKTs3U38hdhfEqwF1JKoT2",
"merchantId": "36EALpZ89XpShxM2Ee9sXT",
"collectionId": "c_NFhUgPQEYbk2EbTXAYArTX",
"allowedProducts": [
{
"sku": "100001",
"name": "White Bread",
"maxValue": {
"currency": "NZD",
"amount": "400"
}
},
{
"sku": "100002",
"name": "Sourdough Bread",
"maxValue": {
"currency": "NZD",
"amount": "800"
}
}
],
"createdAt": "2022-05-12T04:30:11.001Z",
"createdBy": "crn::user:b657195e-dc2f-11ea-8566-e7710d592c99",
"updatedAt": "2022-11-12T04:30:11.001Z",
"updatedBy": "crn::user:b657195e-dc2f-11ea-8566-e7710g542c49"
}
—
/api/tokens
This endpoint allows you to create a Token.
Attributes
collectionId
idempotencyKey
externalId
accountId
Errors
TOKEN_ALREADY_CREATED
LIVENESS_MISMATCH
Request
curl -X POST \
https://service.centrapay.com/api/tokens \
-H 'content-type: application/json' \
-H 'x-api-key: <TOKEN>' \
-d '
{
"collectionId": "c_Jaim1Cu1Q55uooxSens6yk",
"idempotencyKey": "payment-de32dd90-b46c-11ea-93c3-83a333b86e7b",
"externalId": "23403283262"
}
'
Response
{
"id": "pe32dd90-b46c-11ea-92828sa",
"accountId": "WRhAxxWpTKb5U7pXyxQjjP",
"category": "token",
"collectionId": "c_Jaim1Cu1Q55uooxSens6yk",
"status": "active",
"createdAt": "2021-01-17T18:00:23.000Z",
"activeFrom": "2021-01-17T18:00:23.000Z",
"expiresAt": "2022-01-18T18:00:23.000Z",
"liveness": "test",
"createdBy": "crn:1234abc:api-key:MyAssetIssuerKey",
"description": "My Cafe Token",
"issuerImg": "https://static.centrapay.com/assets/brands/centraperk/logo.png",
"img": "https://static.centrapay.com/assets/brands/centraperk/cafe-token.png",
"issuer": "Centraperk Cafe",
"issuerWebsite": "www.centraperk-cafe.com",
"type": "centrapay.token.test",
"externalId": "23403283262"
}