HomeGuidesAPI Reference
API Reference

Initiate

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

Initiate Hosted Checkout Session

This document details how to initiate a hosted checkout session, redirecting your customer to a secure Edfapay payment page.


Endpoint

POST https://app-api.edfapay.com/api/v1/payment-gateway/initiate

Content-Type: application/json


Authentication

All requests to this endpoint must include a valid X-API-KEY in the request header for authentication. The X-API-KEY must be sent from the server side and should not be exposed on the client side.

How to generate API key


Request Parameters

FieldTypeRequiredDescription
orderIdStringYesUnique identifier for the order.
currencyStringYesCurrency code in ISO 4217 format (e.g., SAR).
amountDecimalYesTotal amount to be charged.
customerDetailsObjectYesCustomer information object.
addressObjectOptionalCustomer address object.
recurringInitStringOptionalSet to Y to initialize recurring payment.
successUrlStringYesThe endpoint to which the customer is redirected after a successful 3DS authentication.
failureUrlStringYesThe endpoint to which the customer is redirected after a failed 3DS authentication.
activityIdIntegerOptionalSadad payment activity identifier.
issueDateDateOptionalInvoice issue date (YYYY-MM-DD).
expireDateDateOptionalInvoice expiration date (YYYY-MM-DD).

Customer Details Object

FieldTypeRequiredDescription
nameStringYesFull name of the customer.
emailStringYesEmail address of the customer.
phoneStringYesCustomer phone number.
idNumberStringOptionalCustomer identification number.
idTypeStringOptionalType of identification (e.g., Passport, National ID).
taxNumberStringOptionalCustomer tax number (if applicable).

Address Object

FieldTypeDescription
countryStringCountry code (e.g., SA).
stateStringState or governorate.
cityStringCity name.
addressStringFull address details.
zipStringPostal/ZIP code

Example cURL Request

curl --location 'https://app-api.edfapay.com/api/v1/payment-gateway/initiate' \
--header 'accept: */*' \
--header 'X-API-KEY: <Your API Key>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "orderId": "12345",
  "currency": "SAR",
   "amount": 100,
  "customerDetails": {
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "+9665234678"	
  },
  "address": {
    "country": "SA",
    "state": "Riyadh",
    "city": "Riyadh",
    "address": "10 Olaya St, Floor 5, Apt 12"
  },
	"recurringInit": "N",
 	"successUrl": "https://www.success.com/",
  "failureUrl": "https://www.failure.com/"
}'

📘

If issueDate is not provided or is null, it will default to the current date. If expireDate is not provided or is null, it will automatically be set to 7 days after the issueDate.


Successful Response

{
    "code": 200,
    "message": "Success",
    "errorCode": null,
    "data": {
        "redirectUrl": "https://app.edfapay.com/pay/checkout?sessionId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
}
👍

redirectUrl: Redirect your customer to this URL to complete the payment.


Important Notes

Do not expose your X-API-KEY to the client.

You will find the Initiate Request in the Postman Collection.

Responses

Language
URL
LoadingLoading…
Response
Choose an example:
text/plain