🎁Digital Giftcard
To purchase a goftcard using our API it is recommended you use the following flow
1. Get Giftcards
Endpoint:https://api.chainrewardz.net/egift/customer/v3/product?page=0&limit=1
This returns all the active giftcard available for purchase in our system you may also filter the result by using our available parameters. Each gift card have a productCode, this is used to create order in our system.
Example Response
{
"size": 1,
"number": 0,
"totalPages": 17,
"totalElements": 17,
"numberOfElements": 1,
"content": [
{
"id": 165,
"codeType": "url",
"amount": "12.00",
"logoImageUrl": "https://api.chainrewardz.net/static/product_assets/AMZ/AMZ-logo.png",
"deliveryUrl": "https://spend.chainrewardz.net/d3664e49-9a77-403c-8263-bca06547bb31",
"expiryDate": "2033-09-27",
"createdTime": "2023-09-27T05:25:52.000708Z",
"productCode": "AMZ-US",
"productName": "Amazon.com",
"status": "ACTIVE",
"currency": {
"name": "USD",
"symbol": "$",
"number": "840",
"displayName": "USD - $"
}
}
]
}2. Calculate Order
Endpoint:https://api.chainrewardz.net/egift/customer/v3/order/calculate
Use this API to get the price of a gift card for the specified user. The membershipPrice is the price that should be displayed to the user.
Example Request
If you are using Web2 system replace
smartContractAddresswithmembershipId
curl --location 'https://api.chainrewardz.net/egift/customer/v3/order' \
--header 'Authorization: access_token' \
--data-raw '{
"amount": 100.0,
"productCode": "AIRBNB-USA",
"smartContractAddress": "0xb8cb7caa48cbde1c2a2d1c36cbedaa30680b6186a2dcf0de45d322420f7da3e",
}
}'Example Response
{
"quantity": 1,
"totalPrice": 99.42,
"originalPrice": 100,
"calculation": {
"originalAmount": 99,
"baseRate": 99,
"fullRate": 100,
"marginAmount": 1,
"discountAmount": 0.58,
"cashbackAmount": 0,
"earningAmount": 0.42,
"orderCurrency": "USD",
"orderAmount": 99.42
}
}3. Create Order
Endpoint:https://api.chainrewardz.net/egift/customer/v3/order
To create order you will need the productCode of the giftcard and you will get the orderId in return.
Example Request
curl --location 'https://api.chainrewardz.net/egift/customer/v3/order' \
--header 'Authorization: access_token' \
--data-raw '{
"amount": 100.0,
"productCode": "AIRBNB-USA",
"smartContractAddress": "0xb8cb7caa48cbde1c2a2d1c36cbedaa30680b6186a2dcf0de45d322420f7da3e",
"customer": {
"email": "test@sample.com"
}
}'Example Response
In the case below the orderId is 289
{
"id": 289,
"businessId": 2,
"customer": {
"id": 33,
"email": "test@sample.com"
},
"quantity": 1,
"status": "PENDING",
"purpose": "USING",
"productName": "Airbnb USA",
"totalPrice": 99.42,
"originalPrice": 100,
"smartContractAddress": "0xb8cb7caa48cbde1c2a2d1c36cbedaa30680b6186a2dcf0de45d322420f7da3e",
"product": {
"name": "Airbnb USA",
"code": "airbnb-usa",
"logo": "https://assets.chainrewardz.net/images/brands/logos/180x180/airbnb-usa.jpg",
"currency": "USD",
"price": 100,
},
"calculation": {
"originalAmount": 99,
"baseRate": 99,
"fullRate": 100,
"marginAmount": 1,
"discountAmount": 0.58,
"cashbackAmount": 0,
"earningAmount": 0.42,
"orderCurrency": "USD",
"orderAmount": 99.42
},4. Paying for Order
Endpoint: https://api.chainrewardz.net/crypto/v3/payment/:service/pay
Our system will return the wallet address and the amount to be paid for the specified order and the amount in payment currency.
Example Request
In this request, the partner must specify the orderId and payment coin.
For a list of payment method IDs, please visit here.
curl --location 'https://sandbox.chainrewardz.net/crypto/v3/payment/egift/pay' \
--header 'Authorization: access_token' \
--data '{
"coin": "near",
"orderId": 289
}'Example Response
In the response, the payAmount is the total amount of the payCurrency that needs to be paid. In the case below 11.34921 NEAR tokens need to be sent to the payAddress complete the booking.
{
"expirationEstimateDate": "2023-10-05T17:07:56.097Z",
"payAddress": "6f2409bbfce137c880f914e3fdaa6298f338435f4379a7a138bdd7d4a2e10dc3",
"payAmount": 11.34921,
"payCurrency": "near",
"priceAmount": "12.30",
"priceCurrency": "usd"
}5. Checking order status
Endpoint: https://api.chainrewardz.net/egift/customer/v3/order/{id}
Check the status of the order. A list of order statuses can be found in the API Reference.
Example Request
// Some codecurl --location 'https://api.chainrewardz.net/egift/customer/v3/order/12'
--header 'Authorization: access_token'
--header 'Content-Type: application/json'Example Response
{
"id": 12,
"businessId": 2,
"customer": {
"id": 33,
"email": "test@sample.com"
},
"quantity": 1,
"status": "COMPLETED",
"purpose": "USING",
"productName": "Amazon USA",
"totalPrice": 10,
"originalPrice": 10,
"paymentTime": "2023-09-19T16:35:11.656091",
"product": {
"name": "Amazon USA",
"code": "amazon-usa",
"logo": "https://assets.chainrewardz.net/images/brands/logos/180x180/amazon-usa.jpg",
"currency": "USD",
"price": 10,
"provider": "TILLO"
},
"calculation": {
"originalAmount": 9.7,
"baseRate": 9.95,
"fullRate": 10,
"marginAmount": 0.05,
"discountAmount": 0,
"cashbackAmount": 0,
"earningAmount": 0.05,
"orderCurrency": "USD",
"orderAmount": 10
},
"transaction": {
"type": "UNKNOWN",
"status": "SUCCESS",
"paymentAmount": 10,
"currencyInfo": {
"name": "USD",
"symbol": "$",
"number": "840",
"displayName": "USD - $"
}
}
}Last updated