Purchase Flow

1

Browse Services

Use the GET /skus endpoint to retrieve the list of available services.
const response = await fetch("https://api.chipipay.com/v1/skus", {
  method: "GET",
  headers: {
    "Authorization": `Bearer sk_prod_xxxx`
  }
});
const data = await response.json();
This will return a list of SKUs that are available for purchase. You will need the sku_id to buy a service. The rest of the fields are useful for displaying the service details to the user.
2

Pay the crypto Amount for the desired service

Before you can complete the purchase, you must deposit the exact crypto amount required for the selected service into the Chipi Pay smart contract.This payment must be made on-chain using your wallet. Once the transaction is confirmed, you will receive a transaction hash from the blockchain. This hash serves as proof of payment and will be validated by our backend when you finalize the purchase.
Make sure to send the exact amount specified for the service. Sending an incorrect amount may result in a failed or delayed purchase.
3

Execute Purchase

Use the POST /buy-sku endpoint to complete the transaction. Use the transaction hash from step 2 and call the endpoint to buy the service.
const response = await fetch("https://api.chipipay.com/v1/sku-transactions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer sk_prod_xxxx`
  },
  body: JSON.stringify({
    "walletAddress": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
    "skuId": "test_100",
    "chain": "STARKNET",
    "chainToken": "ETH",
    "mxnAmount": 250.00,
    "reference": "TET_PURCHASE_20241201",
    "transactionHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
  })
});

const data = await response.json();
Once the transaction is confirmed, you’ll receive a response with the status of the transaction in your webhook URL.
4

Monitor Status

Track the purchase status through webhooks and API responses.

Next Steps

  • Review the Get SKUs endpoint documentation
  • Learn about the Buy SKU endpoint
  • Set up webhook endpoints in your dashboard
  • Test the integration using our development environment
Start with the development environment to test your integration without processing real transactions. This allows you to verify your implementation before going live.

Celebrate & Learn More!

If you need to do something more customized, we are developing a more comprehensive API. Stay tuned for updates! Need help? Join our Telegram Community to ask us anything on your mind.