Points Bank API
Use these APIs to leverage the qiibee blockchain as the single source of truth that keeps track of all your loyalty transactions (reward, redeem& exchange) and customer point balances.
Get User Balances
GET /users/:auth_id/balances
Will return an array of balances with the token type (erc20
or erc721
).
eg.
Responses
Success:
HTTP 200
with an array of balancesBad data:
HTTP 404
with error messageeg. not found
Get user engravings
GET /nfts
This endpoint retrieves all of the user's personalised data. The user's auth_id must be sent with the user_auth_id
query param - this is mandatory in order to get the user's data. The data is returned for all of your NFTs.
Eg
Responses
Success:
HTTP 200
with an array of NFT data or empty array if no data present.
Credit/Debit Points
POST /transactions
The following transaction/loyalty event types are supported to perform points bank transactions:
credit_points
- credit point's to a user's accounteg. reward a user for spends
debit_points
- debit points from a user's accounteg. redeem points for a reward like a coupon
Based on the transaction type the body will differ.
All fields are mandatory.
If you try to debit more points than the user currently has you'll receive a 400
.
Body:
amount
can be an integer or string. Must be greater than 0.send_email
(optional) can be used only fortype
credit_points
Defaults:
false
.
Responses
Accepted:
HTTP 202
Ifsend_email
has been set totrue
, the email will be sent to the registered email ID of the user withuser_auth_id
.Bad Request:
HTTP 400
eg. unknown transaction type
Bad data:
HTTP 404
with error messageeg. not found
Transaction History
GET /transactions
This request returns paginated transaction history.
By default, it returns the last 100 transactions associated with your brand. The most recent transactions are returned first.
You can query transactions using the following query parameters:
limit
: (optional) sets the required limit of transaction history to be requested.Defaults:
100
Maximum:
100
offset
: (optional) number of transactions to offset when getting the remaining transactions.Default:
0
user_auth_id
: (optional) Use this parameter to query transactions for a particular user of your brand. If not passed returns all the transactions for your brand. Can be used along withlimit
andoffset.
types
: (optional) Use this parameter to query transactions for specific loyalty event types. The events must be sent in a list.Defaults: List of all loyalty event types
token_id
: (optional) This will let you query the transactions for a specific token ID.Defaults: All tokens that belong to the brand.
from_time
: (optional) queries for transactions that begin from the specified datetime.Defaults: The datetime at which the brand was created in the qiibee database.
to_time
: (optional) queries for transactions until the specified datetime.Defaults: The current datetime.
The params, limit and offset, work exactly as they’re used in SQL.
Responses
Success:
HTTP 200
with data in the following format:
If there are no transactions, an empty transactions
list will be returned. total_tx_count
is the total number of transactions available for the given params.
Bad data:
HTTP 404
with error messageeg. not found
Last updated
Was this helpful?