Hosted Redirect Initiate

Gateway-hosted redirect with optional split payments. Requires DigetPay DG… format API key.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

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

MethodPOST
URL{baseUrl}/payment/checkout/intiate
Authenticationx-api-key (Required)
Content-Typeapplication/json

Base URL — Test & Live

https://api.digetpay.com/v1
📘

Unified 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 with initiate.


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

ParameterTypeRequiredDescription
merchantOrderIdstring✅Unique merchant order reference.
amountnumber✅Payment amount. Minimum 0.01.
currencystring✅Currency code. Default SAR.
customerNamestringNoCustomer name shown during checkout.
customerEmailstringNoCustomer email address.
customerPhonestring✅Customer mobile number. Required for payment initiation and Apple Pay.
nationalIdstringNoCustomer's national ID or identity document number.
successUrlURLNoRedirect URL after successful payment.
failureUrlURL✅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

FormatExample
Local501223324
With leading zero0501223324
📘

The customerPhone parameter 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.

PropertyValue
ParameternationalId
Typestring
RequiredYes
Example"1234567890"
DescriptionCustomer'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/json

Request 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 merchantOrderId in 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

FieldTypeDescription
idstringUnique checkout session identifier.
redirectUrlstringURL of the DigetPay Hosted Checkout page where the customer completes payment.
🚧

Checkout Session ID vs. Transaction ID

The returned id represents 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

ItemValue
Session Lifetime48 Hours
Initial StatusPENDING
After Successful PaymentPAID
Payment MethodsCards, Mada, Apple Pay, Saved Cards
📘

Hosted Checkout URL

The returned redirectUrl points 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:

  1. The customer selects the preferred payment method.
  2. The customer completes the payment.
  3. DigetPay redirects the customer to the configured successUrl or failureUrl.
  4. The merchant confirms the final payment result using the Transaction Status API or a verified Webhook.
  5. 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 merchantOrderId for 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 redirectUrl returned 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.
Body Params
string
required
number
required
string
required
string
required
string
required
string
required
string
required
string
required
string
required
Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json