Asset Transfers
An asset transfer is an asynchronous exchange of an asset or an amount to a recipient.
A recipient is an existing Centrapay user or someone who can create an account to claim the asset transfer by verifying their phone number or email.
After an asset transfer is completed the recipientAlias, lastSentTo and message fields are scrubbed to avoid storing PII.
Asset Transfer Model
Attributes
-
id
string -
status
string -
value
bignumber -
assetId
string -
assetType
string -
description
string -
message
string -
lastSentTo
string -
senderAlias
string -
senderName
string -
recipientAccountId
string -
senderAccountId
string -
claimedByAccountId
string -
recipientAlias
string -
createdAt
timestamp -
updatedAt
timestamp -
suppressNotification
boolean -
url
string
Asset Transfer lifecycle
Asset Transfer goes through different lifecycle stages.
State | Description |
---|---|
requested | Asset transfer successfully requested |
created | Asset transfer successfully created |
sent | Asset transfer notification (sms, email) was sent to a new user |
expired | Asset transfer expired as new user didn't create his account and claimed the asset. This is very short lived state |
returned | Asset transfer expired and was returned to original owner |
claimed | Asset transfer was successfully completed |
cancelled | Asset transfer was cancelled. |
Request an Asset Transfer experimental
Request a transfer of an asset from a sender to the recipient.
Attributes
-
recipientAlias
string required -
senderAccountId
string required -
assetType
string required -
description
string -
message
string -
suppressNotification
boolean
Errors
-
SENDER_NOT_FOUND
403 -
INVALID_ASSET_TYPE
403
curl -X POST \ https://service.centrapay.com/api/asset-transfer-requests \ -H 'content-type: application/json' \ -H 'x-api-key: <TOKEN>' \ -d '{ "recipientAlias": "12-1234-1234567-123", "senderAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "value": "1000", "assetType": "quartz.nzd.test"}'
{ "id": "M7Kn2stAxNa6ri7h", "recipientAlias": "12-1234-1234567-123", "status": "requested", "assetType": "quartz.nzd.main", "description": "request payment", "senderAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "createdAt": "2024-03-01T23:56:21.514Z", "createdBy": "crn:userId:1234", "suppressNotifications": false, "value": "1000", "message": "Payment request"}
Accept an Asset Transfer Request experimental
Attributes
-
assetId
string required -
senderName
string required -
value
bignumber
Errors
-
ASSET_TRANSFER_REQUEST_EXPIRED
403 -
ASSET_TRANSFER_REQUEST_ACCEPTED
403 -
BANK_ACCOUNT_BALANCE_INSUFFICIENT
403 -
QUOTA_EXCEEDED
403 -
ASSET_NOT_ACTIVE
403 -
INVALID_ASSET_TYPE
403 -
VALUE_NOT_DEFINED
403 -
VALUE_ALREADY_DEFINED
403
curl -X POST \ https://service.centrapay.com/api/asset-transfer-requests/M7Kn2stAxNa6ri7h/accept \ -H 'content-type: application/json' \ -H 'x-api-key: <TOKEN>' \ -d '{ "assetId": "YGRo6TYYSxH3js7", "value": "1000", "senderName": "Jane Doe"}'
{ "assetTransferId": "M7Kn2stAxNa6ri7h", "status": "accepted", "type": "asset-transfer:accepted", "createdAt": "2020-05-02T01:03:37.222Z", "createdBy": "sdasd98199dadas", "assetId": "YGRo6TYYSxH3js7", "senderName": "Jane Doe", "value": "1000"}
Create an Asset Transfer
Transfer an asset to a recipient. Some assets can be transfered only in whole (eg tokens) while others can be transfered only in part (eg money).
Some assets can be transferred without supplying a recipient. A url
field will be returned in these cases. The url
will link to a page to claim the asset.
Attributes
-
assetId
string required -
recipientAlias
string -
description
string -
message
string -
value
bignumber -
senderName
string -
suppressNotification
boolean
Errors
-
INSUFFICIENT_WALLET_BALANCE
403 -
QUOTA_EXCEEDED
403 -
ASSET_NOT_ACTIVE
403 -
RECIPIENT_MISSING
403 -
INVALID_ASSET_TYPE
403
curl -X POST \ https://service.centrapay.com/api/asset-transfers \ -H 'content-type: application/json' \ -H 'x-api-key: <TOKEN>' \ -d '{ "assetId": "YGRo6TYYSxH3js7", "recipientAlias": "+642212312"}'
{ "id": "M7Kn2stAxNa6ri7h", "status": "created", "value": "1000", "assetId": "YGRo6TYYSxH3js7", "assetType": "centrapay.token.main", "description": "Centrapay Token", "message": "Happy birthday", "senderName": "My Cafe", "recipientAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "claimedByAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "recipientAlias": "+64212312345", "createdAt": "2020-05-01T12:30:00.000Z", "updatedAt": "2020-05-02T01:03:37.222Z", "suppressNotifications": false}
Get an Asset Transfer
curl -X GET \ https://service.centrapay.com/api/asset-transfers/M7Kn2stAxNa6ri7h \ -H 'x-api-key: <TOKEN>'
{ "id": "M7Kn2stAxNa6ri7h", "status": "claimed", "value": "6000", "assetId": "YGRo6TYYSxH3js7", "assetType": "centrapay.token.main", "description": "Centrapay Token", "message": "Happy birthday", "senderName": "My Cafe", "recipientAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "claimedByAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "recipientAlias": "+64******2345", "createdAt": "2020-05-01T12:30:00.000Z", "updatedAt": "2020-05-02T01:03:37.222Z", "suppressNotifications": false}
Get Asset Transfer Summary
curl -X GET \ https://service.centrapay.com/api/asset-transfers/M7Kn2stAxNa6ri7h/summary
{ "id": "M7Kn2stAxNa6ri7h", "status": "created", "assetId": "YGRo6TYYSxH3js7", "message": "Happy birthday", "senderName": "My Cafe", "createdAt": "2020-05-01T12:30:00.000Z", "url": "https://app.centrapay.com/transfer/M7Kn2stAxNa6ri7h"}
Claim Asset Transfer experimental
Claim the asset transfer for the caller's authorised account.
Errors
-
ASSET_TRANSFER_INVALID_RECIPIENT
403 -
ASSET_TRANSFER_INVALID_STATUS
403
curl -X POST \ https://service.centrapay.com/api/asset-transfers/M7Kn2stAxNa6ri7h/claim \ -H 'x-api-key: <TOKEN>'
{ "id": "M7Kn2stAxNa6ri7h", "status": "claimed", "value": "6000", "assetId": "YGRo6TYYSxH3js7", "description": "$60 Giftcard", "message": "Happy birthday", "senderName": "My Cafe", "senderAccountId": "aBc932S9182qwCDqwer", "recipientAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "claimedByAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "createdAt": "2020-05-01T12:30:00.000Z", "updatedAt": "2020-05-02T01:03:37.222Z", "suppressNotifications": false}
Resolve Claimable Assets experimental
When you send another centrapay user cash or assets, they're automatically assigned to them. However, if they're not signed up yet then these assets are not immediately assigned.
If unclaimed, asset transfers are returned after 2 weeks.
New accounts should call this endpoint to allocate assets that you've been sent.
curl -X POST \ https://service.centrapay.com/api/me/resolve-claimable-assets \ -H 'x-api-key: <TOKEN>'
{}
List Asset Transfers experimental
Returns a paginated list of Asset Transfers.
Attributes
-
recipientAccountId
string -
senderAccountId
string
curl -X GET \ 'https://service.centrapay.com/api/asset-transfers?recipientAccountId=oS3Xom2au3Ooy9aihai' \ -H 'x-api-key: <TOKEN>'
{ "items": [ { "id": "M7Kn2stAxNa6ri7h", "status": "created", "value": "6000", "assetId": "YGRo6TYYSxH3js7", "description": "$60 Giftcard", "message": "Happy birthday", "senderName": "My Cafe", "senderAccountId": "aBc932S9182qwCDqwer", "recipientAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "claimedByAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "recipientAlias": "+64*****2345", "createdAt": "2020-05-01T12:30:00.000Z", "updatedAt": "2020-05-02T01:03:37.222Z", "suppressNotifications": false } ]}
Cancel an Asset Transfer
Errors
-
INVALID_ASSET_TRANSFER_STATUS
403
curl -X POST \ https://service.centrapay.com/api/asset-transfers/M7Kn2stAxNa6ri7h/cancel \ -H 'x-api-key: <TOKEN>'
{ "id": "M7Kn2stAxNa6ri7h", "status": "cancelled", "assetId": "YGRo6TYYSxH3js7", "value": "6000", "description": "$60 Giftcard", "message": "Happy birthday", "senderName": "My Cafe", "senderAccountId": "aBc932S9182qwCDqwer", "recipientAccountId": "9EDxUT91TMsUjoqoQeBuLQ", "recipientAlias": "+64*****2345", "createdAt": "2020-05-01T12:30:00.000Z", "updatedAt": "2020-05-02T01:03:37.222Z", "suppressNotifications": false}