Skip to main content
Direct Integration gives you precise control over which payment method your customer uses. Instead of routing through Payzah’s hosted Transit Payment Page, Payzah returns a direct_url that sends your customer straight to the chosen payment provider — K-Net or Credit Card — without an intermediate step. Choose this integration method when you want to present payment options in your own UI and route customers based on their selection.

When to Use Direct Integration

Use Direct Integration when:
  • You have a custom-designed checkout that already shows K-Net and Credit Card as separate buttons
  • You want to eliminate the intermediate Payzah-hosted page from the redirect chain
  • You need independent control over which payment methods are available at specific points in your flow
Direct Integration does not support Apple Pay. If you need Apple Pay, use the Transit Payment Page with payment_type: "3" instead.

How Direct Integration Works

1

Choose the Correct payment_type for Your Method

Direct Integration uses two distinct payment_type values — one for K-Net and one for Credit Card. Select the value that matches the payment method your customer chose on your checkout page.
Payment methodpayment_type value
K-Net"1"
Credit Card (VISA / MasterCard)"2"
You must set this value dynamically based on your customer’s selection before you send the initialization request.
2

Send the Initialization Request

From your server, send a POST request to the Payzah initialization endpoint with the appropriate payment_type. The request structure is identical to the Transit integration — only the payment_type value changes.Endpoints
EnvironmentURL
Testhttps://development.payzah.net/ws/paymentgateway/index
Productionhttps://payzah.net/production770/ws/paymentgateway/index
Headers
HeaderValue
Content-Typeapplication/json
Authorizationbase64_encode($privateKey)
Your private key must never appear in client-side code, front-end JavaScript, or mobile app binaries. Always make this request from your backend server.
The tabs below show sample request bodies for each payment method:
{
  "trackid": "ORDER-20240927-00456",
  "amount": "11.250",
  "success_url": "https://yourstore.com/payment/success",
  "error_url": "https://yourstore.com/payment/error",
  "currency": "414",
  "language": "ENG",
  "payment_type": "1",
  "customer_name": "Fatima Al-Rashidi",
  "customer_email": "[email protected]",
  "customer_phone": "96598765432",
  "udf1": "order-ref-002"
}
3

Read the direct_url from the Response

A successful initialization response returns status: true with a populated direct_url field. The transit_url field will be empty — this is the opposite of what you see with Transit Integration.
Success Response
{
  "status": true,
  "data": {
    "PaymentUrl": "https://development.payzah.net/pgaction",
    "PaymentID": "2019070115360420",
    "transit_url": "",
    "direct_url": "https://development.payzah.net/pgaction?PaymentID=202409271806248183"
  }
}
The direct_url already contains the PaymentID as a query parameter, pointing directly to the payment provider’s page. Store the PaymentID value from data.PaymentID before redirecting, so you can reconcile the callback with your order.
If status is false, do not redirect the customer. Display a user-friendly error, log the response details, and allow them to retry. Never redirect to a URL from a failed response.
Comparing Transit and Direct response URLs
FieldTransit (payment_type 3)Direct (payment_type 1 or 2)
transit_urlPopulated — redirect hereEmpty
direct_urlEmptyPopulated — redirect here
4

Redirect Your Customer to the direct_url

Redirect your customer’s browser to the direct_url returned in the response. They will land directly on the K-Net or Credit Card payment provider’s page.
PHP Redirect
<?php

if ($result['status'] === true) {
    $directUrl = $result['data']['direct_url'];
    header('Location: ' . $directUrl);
    exit;
}
Express.js Redirect
if (result.status === true) {
  res.redirect(result.data.direct_url);
}
The redirect URL follows this pattern:
https://development.payzah.net/pgaction?PaymentID=2019070115360420
In production, the domain changes but the path and query string format remain the same. Always use the direct_url value from the response rather than constructing the URL manually.
5

Handle the Success and Error Redirects

Once your customer completes or abandons payment on the provider’s page, Payzah redirects them back to your success_url or error_url with the transaction result appended as query parameters.Payment response fields
FieldDescription
payzahReferenceCodePayzah’s unique reference ID for this transaction
trackIdThe trackid value you sent in the initialization request
knetPaymentIdUnique ID assigned by the payment gateway (K-Net or card network)
transactionNumberUnique identifier for this specific transaction
trackingNumberTrack ID echoed back from your original request
paymentDateDate on which the payment was processed
paymentStatusFinal outcome of the transaction (see table below)
udf1udf5Any user-defined fields you included in the initialization request
paymentStatus values
StatusMeaningRecommended action
CAPTUREDFunds captured successfullyFulfil the order
VOIDEDTransaction voided before captureDo not fulfil; notify customer
NOT CAPTUREDAuthorised but capture incompleteInvestigate before acting
CANCELEDCustomer cancelled on provider’s pageAllow customer to retry
DENIED BY RISKBlocked by fraud/risk controlsDo not fulfil; ask customer to contact support
HOST TIMEOUTGateway timed out — outcome unknownHold the order and confirm status manually
Only fulfil an order when paymentStatus is CAPTURED. A redirect to your success_url without a CAPTURED status does not confirm that funds were collected.

Request Field Reference

Use this table when constructing your initialization request body for Direct Integration.
FieldTypeMax lengthMandatoryDescription
trackidAlphanumeric255YesUnique ID per transaction — must not be reused
amountNumeric10YesTransaction amount, e.g. 11.250
success_urlAlphanumeric255YesYour URL for successful payment callbacks
error_urlAlphanumeric255YesYour URL for failed or cancelled payment callbacks
currencyNumeric3YesISO 4217 numeric code, e.g. 414 for KWD
payment_typeFixed1No*"1" for K-Net, "2" for Credit Card
languageAlpha3NoENG or ARA
kfast_idNumeric8NoK-Net faster checkout identifier
customer_nameAlphanumeric255NoCustomer’s full name
customer_phoneAlphanumeric255NoCustomer’s phone number
customer_emailAlphanumeric255NoCustomer’s email address
udf1udf5Alphanumeric255NoAdditional fields for your own reference
Although payment_type is technically optional, you should always supply it explicitly ("1" for K-Net or "2" for Credit Card) when using Direct Integration to ensure the correct provider page is returned in direct_url.