Skip to main content

Overview

The Cray Payment Gateway provides a simple hosted checkout experience.

Payment Flow

  1. Create an API key and configure your webhook from the Cray Merchant Dashboard.
  2. Create a payment session.
  3. Redirect the customer to the hosted payment page.
  4. The customer completes the payment.
  5. The customer is redirected back to your redirectUrl.
  6. Receive payment status updates via webhook or query the Order Status API.

Authentication

All API requests require the following header:
Example:

1. Create API Credentials

Before integrating:
  • Create an API Key from the Merchant Dashboard.
  • Configure your webhook endpoint.
You’ll receive:
  • API Key ID
  • API Secret
These credentials are required for all API requests.

2. Create a Payment Session

Creates a hosted checkout session.

Endpoint

Request

Request Body

Supported Currencies

  • USD (default)
  • AED
  • EUR
  • INR

Supported orderType

  • PG (default)
  • POS

Response


3. Redirect the Customer

Redirect your customer to the url 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 the redirectUrl 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 the Authorization header.
Generate the expected HMAC using your API Secret.

Node.js Example

Only process the webhook if the generated signature matches the value received in the Authorization header.

Order Status API

Retrieve the latest payment status for an order.

Endpoint

Example:
By default, this endpoint uses Server-Sent Events (SSE) and streams live status updates.

Server-Sent Events (Default)

Example response:
When the order status changes, another event is sent automatically. Example:

Standard HTTP Response

If you prefer polling instead of SSE, append ?sse=false.
Example response:

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.