Endpoints for SDK authentication and token management
ChicksX Payments API (1.0.0)
REST API that provides an interface to ChicksX cryptocurrency exchange ecosystem. This API enables merchants to offer their users cryptocurrency purchases, sales, and swaps through a simple integration.
We provide an interactive demo tool to test the complete SDK integration:
This demo allows you to:
- Test SDK configuration with different operation types
- Generate public access tokens
- Simulate webhook events
- View code examples in real-time
Before you can integrate with the ChicksX Payments API, you need to obtain your merchant credentials:
- merchant-api-key: Your unique API key for authentication
- merchant-client-id: Your merchant client identifier
Important: If you don't have these credentials yet, please contact our support team at support@chicksx.com
🔒 All endpoints requiring merchant-api-key and merchant-client-id headers MUST be called from your backend server only. These credentials should never be exposed in client-side applications (web browsers, mobile apps, etc.) as they provide full access to your merchant account.
Contact support@chicksx.com to receive:
merchant-api-keymerchant-client-id
From your backend server, make a request to create a public access token:
POST https://develop-api.chicksx.com/v1/public_token/create
Headers:
merchant-api-key: your-api-key
merchant-client-id: your-client-idThis returns a public access token that can be safely used in your client-side application.
In your frontend application, add the ChicksX SDK script tag with the required parameters:
<script src="https://develop-api.chicksx.com/v1/sdk/chicksx.js?merchantId=your-merchant-id&env=dev&accessToken=your-public-token&baseCurrency=cad&targetCurrency=usdt&baseAmount=100&paymentMethod=interac"></script>Then configure and initialize the SDK:
<script>
window.chicksX.configure({
merchantId: 'your-merchant-id',
env: 'dev',
accessToken: 'your-public-token',
operationType: 'buy',
baseCurrency: 'cad',
targetCurrency: 'usdt',
baseAmount: 100,
paymentMethod: 'interac',
walletAddress: '0xYourWalletAddressOptional'
});
window.chicksX.init();
</script>Note: window.chicksX.init() opens the payment popup/modal. You typically want to call it in response to a user action (e.g., a button click) to avoid unexpected popups:
<button id="payButton">Pay with ChicksX</button>
<script>
document.getElementById('payButton').addEventListener('click', function () {
window.chicksX.init();
});
</script>Required Parameters:
merchantId- Your merchant identifierenv- Environment (dev,staging, orprod)accessToken- The public token obtained from Step 2
Optional Parameters:
operationType- Type of operation:buy(default),sell,swap-fiat, orswap-cryptobaseCurrency- Source currency code (default: based on merchant config)targetCurrency- Target cryptocurrency code (default: based on merchant config)baseAmount- Amount in base currencytargetAmount- Amount in target currencypaymentMethod- Payment method identifier (e.g.,interac,cash-in-mail,cash-in-person,bill-payment,balance)walletAddress- Cryptocurrency wallet address
The operationType parameter determines the URL path structure for the payment flow:
| Operation Type | Description |
|---|---|
buy | Buy cryptocurrency with fiat |
sell | Sell cryptocurrency for fiat |
swap-fiat | Swap between fiat currencies |
swap-crypto | Swap between cryptocurrencies |
Payment Methods by Operation:
- Buy:
interac,cash-in-mail,cash-in-person,bill-payment,balance - Sell:
interac,cash-in-mail,cash-in-person - Swap Fiat:
cash-in-mail,cash-in-person - Swap Crypto: No payment method required (crypto-to-crypto)
The API provides comprehensive wallet management capabilities for storing and managing user cryptocurrency wallets associated with your merchant account.
ChicksX uses webhooks to notify your application when events occur in your account. Webhooks are particularly useful for asynchronous events like order status changes.
To receive webhook notifications:
- Contact Support: Email support@chicksx.com to register your webhook endpoint URL
- Provide Your URL: Supply a publicly accessible HTTPS endpoint that can receive POST requests
- Environment-Specific: You can configure different webhook URLs for development, staging, and production environments
Triggered when a new order is created in the system.
{
"eventType": "OrderCreated",
"details": {
"orderId": 1092114,
"status": "pending",
"paymentMethod": "Interac E-Transfer",
"fulfilled": false,
"totalPrice": 100.00,
"totalPriceCurrency": "CAD",
"exchangeDetails": {
"baseCurrency": "CAD",
"amountReceived": 100.00,
"targetCurrency": "BTC",
"amountToSend": 0.00112180,
"operationType": "B"
}
}
}Triggered when an order the order fulfills.
{
"eventType": "OrderFulfillment",
"details": {
"orderId": 1092114,
"status": "completed",
"paymentMethod": "Interac E-Transfer",
"fulfilled": true,
"totalPrice": 100.00,
"totalPriceCurrency": "CAD",
"exchangeDetails": {
"baseCurrency": "CAD",
"amountReceived": 100.00,
"targetCurrency": "BTC",
"amountToSend": 0.00112180,
"operationType": "B"
}
}
}| Field | Type | Description |
|---|---|---|
eventType | string | Event type: OrderCreated or OrderFulfillment |
details.orderId | integer | Unique order identifier |
details.status | string | Current order status |
details.paymentMethod | string | Payment method used |
details.fulfilled | boolean | Whether the order has been fulfilled |
details.totalPrice | number | Total price of the order |
details.totalPriceCurrency | string | Currency of the total price |
details.exchangeDetails.baseCurrency | string | Source currency |
details.exchangeDetails.amountReceived | number | Amount received in base currency |
details.exchangeDetails.targetCurrency | string | Target currency |
details.exchangeDetails.amountToSend | number | Amount to send in target currency |
details.exchangeDetails.operationType | string | Operation type: B (Buy), S (Sell), SF (Swap Fiat), SC (Swap Crypto) |
Your webhook endpoint should:
- Return 200 OK: Respond with HTTP 200 status to acknowledge receipt
- Process Asynchronously: Handle the webhook data asynchronously to avoid timeouts
- Be Idempotent: Handle duplicate webhook deliveries gracefully (use
orderIdas unique identifier) - Validate Data: Verify the webhook data matches expected formats
app.post('/webhook/chicksx', (req, res) => {
const { eventType, details } = req.body;
console.log(`Received ${eventType} for order ${details.orderId}`);
switch (eventType) {
case 'OrderCreated':
// Handle new order
handleNewOrder(details);
break;
case 'OrderFulfillment':
// Handle order status update
handleOrderUpdate(details);
break;
}
// Always respond with 200 to acknowledge receipt
res.status(200).send('OK');
});Request
Creates a public access token for SDK authentication. This endpoint must be called from your secure backend server using your merchant credentials.
The returned access token can be safely used in client-side applications to authenticate with the ChicksX SDK.
Security: Never expose your merchant-api-key or merchant-client-id in client-side code.
Array of permission scopes for the token
- Mock serverhttps://chicksx-payments-api.redocly.app/_mock/apis/openapi/public_token/create
- Development serverhttps://develop-api.chicksx.com/v1/public_token/create
- Staging serverhttps://staging-api.chicksx.com/v1/public_token/create
- Production serverhttps://api.chicksx.com/v1/public_token/create
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://chicksx-payments-api.redocly.app/_mock/apis/openapi/public_token/create \
-H 'Content-Type: application/json' \
-H 'merchant-api-key: YOUR_API_KEY_HERE' \
-H 'merchant-client-id: string' \
-d '{
"scope": [
"wallet.read",
"merchant.read"
]
}'{ "code": "OK", "data": { "accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjaGlja3N4LWFwaSIsInN1YiI6Im1lcmNoYW50LWRlbW8iLCJhdWQiOiJjaGlja3N4LXNkayIsImV4cCI6MTY5NjUzNDgwMCwiaWF0IjoxNjk2NTMxMjAwLCJqdGkiOiJmNDdhYzEwYi01OGNjLTQzNzItYTU2Ny0wZTAyYjJjM2Q0NzkiLCJlbnZpcm9ubWVudCI6InNhbmRib3giLCJzY29wZSI6WyJ3YWxsZXQucmVhZCIsIm1lcmNoYW50LnJlYWQiXX0.signature", "tokenType": "Bearer", "expiresIn": 3600, "expiresAt": 1696534800, "scope": [ … ], "jti": "f47ac10b-58cc-4372-a567-0e02b2c3d479" } }