Gateway-hosted redirect with optional split payments. Requires DigetPay DG… format API key.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Creates a Hosted Checkout session and returns a payment URL that redirects the customer to the DigetPay hosted checkout page to complete the payment securely.
Recommended API: This is the primary endpoint for Hosted Checkout integrations. After creating the payment session, redirect the customer to the returned
redirectUrl.
Endpoint
| Method | POST |
| URL | {baseUrl}/payment/checkout/intiate |
| Authentication | x-api-key (Required) |
| Content-Type | application/json |
Base URL — Test & Live
https://api.digetpay.com/v1Unified API Environment
DigetPay uses the same API base URL for both Test and Live environments.
- Test API Key: Used for sandbox transactions and test cards.
- Live API Key: Used for real payment transactions.
The environment is determined by the API key, not the endpoint URL.
Endpoint Naming: The endpoint path is intentionally spelled
intiate. Do not replace it withinitiate.
Integration Flow
sequenceDiagram
autonumber
participant Merchant as Merchant Server
participant API as DigetPay API
participant Customer
participant Checkout as Hosted Checkout
Merchant->>API: POST /payment/checkout/intiate
Note over Merchant,API: Include required customerPhone and nationalId
API-->>Merchant: 201 Created (id + redirectUrl)
Merchant-->>Customer: Redirect to redirectUrl
Customer->>Checkout: Open Hosted Checkout
Customer->>Checkout: Select payment method and pay
Checkout-->>Customer: Redirect to successUrl / failureUrl
Note over Merchant,API: Confirm payment using Status API or Webhook
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
merchantOrderId | string | ✅ | Unique merchant order reference. |
amount | number | ✅ | Payment amount. Minimum 0.01. |
currency | string | ✅ | Currency code. Default SAR. |
customerName | string | No | Customer name shown during checkout. |
customerEmail | string | No | Customer email address. |
customerPhone | string | ✅ | Customer mobile number. Required for payment initiation and Apple Pay. |
nationalId | string | No | Customer's national ID or identity document number. |
successUrl | URL | No | Redirect URL after successful payment. |
failureUrl | URL | ✅ | Redirect URL after failed payment. |
Customer Information Requirements
Customer Phone Number
The customerPhone parameter must contain a valid customer mobile number.
Supported Phone Number Formats
| Format | Example |
|---|---|
| Local | 501223324 |
| With leading zero | 0501223324 |
The
customerPhoneparameter is mandatory for Hosted Checkout payment initiation and is also required for Apple Pay.
Customer National ID
The nationalId parameter is Optional for every Hosted Checkout payment initiation request.
| Property | Value |
|---|---|
| Parameter | nationalId |
| Type | string |
| Required | Yes |
| Example | "1234567890" |
| Description | Customer's national ID or identity document number. |
Request Example
POST https://api.digetpay.com/v1/payment/checkout/intiate
Headers
x-api-key: YOUR_API_KEY
Content-Type: application/jsonRequest Body
{
"merchantOrderId": "PAY-1781872369616",
"amount": 0.20,
"currency": "SAR",
"customerName": "Mohamed Ashour",
"customerEmail": "[email protected]",
"customerPhone": "501223324",
"nationalId": "1234567890",
"successUrl": "https://fin-admin.digetpay.com/pay/checkout/success",
"failureUrl": "https://fin-admin.digetpay.com/pay/checkout/failure"
}Best Practice: Store
merchantOrderIdin your system before initiating the payment session.This reference helps you match the payment with webhook notifications and transaction status responses.
Responses
201 Created — Successful Session
The API returns a checkout session identifier and a redirect URL.
{
"id": "de308605-420c-4cf3-a31e-cb7ab21ab1c5",
"redirectUrl": "https://pay.digetpay.com/pay/checkout?sessionId=de308605-420c-4cf3-a31e-cb7ab21ab1c5"
}After receiving a successful response, redirect the customer to redirectUrl to complete the payment.
400 Bad Request — Validation Error
Returned when the request contains missing or invalid required information.
Example: Missing Customer Phone
{
"statusCode": 400,
"message": [
"customerPhone should not be empty"
],
"error": "Bad Request"
}401 Unauthorized — Authentication Error
Returned when the API key is missing or invalid.
{
"statusCode": 401,
"message": "Missing API key",
"error": "Unauthorized"
}Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique checkout session identifier. |
redirectUrl | string | URL of the DigetPay Hosted Checkout page where the customer completes payment. |
Checkout Session ID vs. Transaction ID
The returned
idrepresents the checkout session ID, not the payment transaction ID.To query payment status or process refunds, use the gateway transaction ID obtained after payment completion.
See Transaction Identifiers for more details.
Session Behavior
| Item | Value |
|---|---|
| Session Lifetime | 48 Hours |
| Initial Status | PENDING |
| After Successful Payment | PAID |
| Payment Methods | Cards, Mada, Apple Pay, Saved Cards |
Hosted Checkout URL
The returned
redirectUrlpoints to the DigetPay hosted checkout page.The merchant should use the exact URL returned by the API rather than constructing a checkout URL manually.
Payment Confirmation
A successful checkout session creation does not mean that the payment has been completed.
After redirecting the customer to the Hosted Checkout page:
- The customer selects the preferred payment method.
- The customer completes the payment.
- DigetPay redirects the customer to the configured
successUrlorfailureUrl. - The merchant confirms the final payment result using the Transaction Status API or a verified Webhook.
- The merchant updates the order status based on the confirmed payment result.
Important: Never mark an order as paid based only on the customer's redirect to
successUrl.Always verify the transaction's actual payment status.
Best Practices
- Generate a unique
merchantOrderIdfor every payment request. - Always provide a valid
customerPhone. - Validate required customer information before submitting the request.
- Use the correct Test or Live API Key for the intended environment.
- Redirect customers using the exact
redirectUrlreturned by DigetPay. - Never consider the checkout redirect alone as proof of successful payment.
- Verify payment status using the Transaction Status API or authenticated Webhooks.
- Store the gateway transaction ID after payment completion for refunds and future operations.
Related Documentation
- Environments Overview — Test and Live API configuration.
- API Credentials — Managing Test and Live API Keys.
- Transaction Identifiers — Checkout Session ID vs. Gateway Transaction ID.
- Transaction Status API — Verifying final payment status.
- Webhooks — Receiving asynchronous payment notifications.
- Test Cards — Testing payment flows before going live.

