Accept Stablecoin Payments
Before you start: Create your API credentials and configure your webhook URL in the Cray Merchant Dashboard.
1. Create a Payment
Method:POST
2. Generate a QR Code
Method:POST
Important: The QR code expires in 2 minutes. Generate a new QR code if it expires before the payment is completed.
3. Test the Integration
Use the Cray Testing Wallet to test the payment flow without using a regular customer wallet.Testing flow
- Create a payment using the Create Payment API.
- Generate the payment QR code.
- Open the Cray Testing Wallet.
- Use the testing wallet to scan or process the payment QR code, following the wallet’s interface.
- Complete the test payment.
- Monitor the order status through the Status API or your configured webhook.
Order Status API
Retrieve the latest payment status for an order or subscribe to real-time status updates.Endpoint
Method:GET
Server-Sent Events (Default)
Standard HTTP Response (Polling)
If you prefer polling instead of SSE, append?sse=false.
Possible Status Values
The Status API can return the following statuses.Complete POS Integration Flow
TheQR_Scanned, QR_Expired, QR_Rejected, and Low_Balance events are POS-specific. Handle them in your POS interface to guide the customer through the payment process.
Recommended Architecture
The SSE connection is primarily for real-time status updates to the client, while the webhook should be treated as the authoritative server-to-server notification. The recommended architecture is:Important Integration Guidelines
- Use SSE for live updates. Display the latest payment status and provide customer feedback in real time.
- Use webhooks for backend processing. Treat verified webhook events as the authoritative server-to-server notification.
- Verify webhook signatures. Validate the HMAC signature before processing webhook events.
- Handle QR expiration. If the status becomes
QR_Expired, guide the customer through generating a fresh QR code. - Support retries where appropriate. When
Low_Balanceis received, guide the customer to resolve the balance issue and retry using the supported payment flow. - Test before going live. Use the Cray Testing Wallet to validate the POS integration.
