Tokens
Tokens are Assets 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 that accepts Tokens from a Collection, and contains additional conditions specific to that Merchant, such as redeemable product identifiers.
Token Collection Model
Attributes
Token Expires After Model
Attributes
period
stringrequiredduration
stringrequiredceil
string
Redemption Condition Model experimental
Attributes
Allowed Products Model experimental
Attributes
sku
stringname
stringmaxValue
monetary
Token Model experimental
Attributes
collectionId
stringidempotencyKey
stringexternalId
stringaccountId
string
Create Token Collection experimental
This endpoint allows you to create a Token Collection.
Attributes
Errors
EXTERNAL_ID_ALREADY_USED
403
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"}'{ "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"}List Token Collections experimental
Returns a paginated list of Token Collections for an Account.
Attributes
pageKey
string
curl -X GET 'https://service.centrapay.com/api/accounts/T3y6hogYA4d612BExypWYH/collections?pageKey=Collection%232G5bXm4dnuDHnnKY8WeCPm%7C%23Collection%7C8vq4kn03o0g1grrihk7ooloizpqt2y' \-H 'x-api-key: <TOKEN>'{ "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" } ]}Create Redemption Condition experimental
This endpoint allows you to create a Redemption Condition. Redemption conditions are only created for Token Collections of type product.
Attributes
merchantId
stringrequiredallowedProducts
objectrequired
Errors
INVALID_AMOUNT
403REDEMPTION_CONDITION_ALREADY_EXISTS
403COLLECTION_INVALID_TYPE
403
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" } } ]}'{ "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"}Set Allowed Products for Redemption Condition experimental
This endpoint allows you to set Allowed Products for a Redemption Condition.
Attributes
allowedProducts
objectrequired
Errors
INVALID_AMOUNT
403
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" } } ]}'{ "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"}--
Create Token experimental
This endpoint allows you to create a Token.
Attributes
collectionId
stringrequiredidempotencyKey
stringrequiredexternalId
stringaccountId
string
Errors
TOKEN_ALREADY_CREATED
403LIVENESS_MISMATCH
403
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"}'{ "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"}