Customer Journey
Step-by-step hosted checkout flow from redirect to payment confirmation.
This guide walks through the customer-facing journey on DigetPay hosted checkout — from your store redirect to payment confirmation on your server.
The journey is the same in Test Mode and Live Mode. The API key you send (Test API Key or Live API Key) decides which one runs, and the Status API confirms the final result in both.
Your server creates the link via
POST /payment/checkout/intiateand redirects the customer toredirectUrl.
API base URL:
https://api.digetpay.com/v1(same for Test and Live). The path is spelled/payment/checkout/intiate— not/session.
Critical: Redirect to
successUrldoes not guarantee payment succeeded, and a webhook is only a notification. Always confirm with the Status API before fulfilling the order.
End-to-end flow
sequenceDiagram participant Customer as Customer participant Shop as Your Server participant API as DigetPay API participant Checkout as DigetPay Checkout Customer->>Shop: Starts checkout Shop->>API: POST /payment/checkout/intiate API-->>Shop: redirectUrl + session id Shop->>Customer: HTTP 302 to redirectUrl Customer->>Checkout: Selects payment method Checkout->>Customer: 3DS / Apple Pay if needed Checkout->>Customer: Redirect to successUrl / failureUrl Customer->>Shop: Returns to your site Shop->>API: GET /payment/checkout/status API-->>Shop: transactionStatus SUCCESS Shop->>Customer: Order confirmation
Step-by-step
1. Customer starts checkout on your site
Customer selects items and proceeds to pay. Your server knows the order total and customer details.
2. Your server creates a payment link
POST /payment/checkout/intiate
{
"merchantOrderId": "ORD-1001",
"amount": 10.00,
"currency": "SAR",
"customerName": "Ahmed Ali",
"customerEmail": "[email protected]",
"customerPhone": "501223324",
"successUrl": "https://yourstore.com/checkout/success",
"failureUrl": "https://yourstore.com/checkout/failure"
}Send the request to https://api.digetpay.com/v1 with your API key in the x-api-key header. Store the session id in your database before redirecting.
3. Customer redirected to DigetPay checkout
Your server returns HTTP 302 to redirectUrl. Use the URL exactly as returned by the API; do not build it yourself. Customer sees the hosted checkout page.
4. Customer selects payment method and pays
Options include card, Mada, saved card, and Apple Pay (when customerPhone was sent).
See Payment Methods.
5. Customer returns to your site
- Success → redirect to
successUrl(DigetPay may appendsessionId,txn, etc.) - Failure → redirect to
failureUrl
Show a "processing" message — do not show "payment confirmed" yet.
6. Your server confirms payment
Call GET /payment/checkout/status?id={gatewayTransactionId}. If you receive a webhook notification, use it as a signal to check, not as proof of payment.
Only after transactionStatus === SUCCESS should you mark the order paid and send confirmation email.
Success and failure URLs
successUrl and failureUrl are your own HTTPS pages, in both Test Mode and Live Mode.
| Outcome | Example |
|---|---|
| Success | https://yourstore.com/checkout/success |
| Failure | https://yourstore.com/checkout/failure |
These URLs are for navigation only. Do not use DigetPay-hosted pages for them, and do not treat a visit to either one as proof of the payment outcome.
What you do NOT build
| Feature | Where it happens |
|---|---|
| Apple Pay button | DigetPay checkout page |
| Mada / card form | DigetPay checkout page |
| 3-D Secure | DigetPay checkout page |
Next steps
Updated about 2 months ago

