Overview
The Cray Payment Gateway provides a simple hosted checkout experience.Payment Flow
- Create an API key and configure your webhook from the Cray Merchant Dashboard.
- Create a payment session.
- Redirect the customer to the hosted payment page.
- The customer completes the payment.
- The customer is redirected back to your
redirectUrl. - Receive payment status updates via webhook or query the Order Status API.
Authentication
All API requests require the following header:1. Create API Credentials
Before integrating:- Create an API Key from the Merchant Dashboard.
- Configure your webhook endpoint.
- API Key ID
- API Secret
2. Create a Payment Session
Creates a hosted checkout session.Endpoint
Request
Request Body
Supported Currencies
USD(default)AEDEURINR
Supported orderType
PG(default)POS
Response
3. Redirect the Customer
Redirect your customer to theurl returned from the Create Payment Session API.
The customer completes the payment on the hosted Cray checkout page.
4. Customer Redirect
Once the payment completes (success or failure), the customer is redirected to theredirectUrl provided during payment session creation.
Important: Do not rely solely on the redirect to determine payment success. Always verify the payment using either the webhook or the Order Status API.
Webhooks
Configure your webhook URL from the Merchant Dashboard to receive payment status updates.Order Status
The following statuses may be received:Webhook Payload
Verify Webhook Signature
Each webhook request includes an HMAC signature in theAuthorization header.
Node.js Example
Authorization header.
Order Status API
Retrieve the latest payment status for an order.Endpoint
Server-Sent Events (Default)
Standard HTTP Response
If you prefer polling instead of SSE, append?sse=false.
Possible Status Values
Complete Integration Flow
Best Practice
Use both:- Webhook as the primary source of truth for payment status.
- Order Status API to recover from missed webhooks or to display live payment progress.
