Embedded Direct Sale

Process a card payment from your backend (PCI DSS required). If result is REDIRECT, send the customer to 3-D Secure by rendering html or redirecting to redirect_url. Save trans_id: you send it to the S2S Transaction Status and S2S Refund endpoints.

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

Process a card payment directly from your backend using the Embedded Integration flow. This endpoint supports both sale and authorization-only transactions, and automatically handles 3-D Secure authentication when required.

❗️

PCI DSS Required

This endpoint accepts raw cardholder data. Your backend must be PCI DSS compliant and card data must never be collected or transmitted from client-side JavaScript.

📘

Request Hash Required

Every Direct Sale request must include a valid hash generated on your backend. See the hash generation section in the Embedded Integration Overview.


Request

MethodPOST
URLhttps://api.digetpay.com/v1/payment/s2s/sale
AuthenticationHeader x-api-key (Test API Key or Live API Key)

The same URL is used in Test Mode and Live Mode. Your API key decides the mode.


Request Body

ParameterTypeRequiredDescription
orderIdstringYesYour unique order reference
amountnumberYesPayment amount
currencystringYesISO currency code (for example SAR)
paymentMethodstringYesPayment method. Use card
authstringYesN = Sale • Y = Authorization Only
saveTokenstringNoY = save the card as a token for recurring payments • N = do not save
cardobjectYesCard details (see below)
customerobjectYesCustomer information (see below)
successUrlstringYesRedirect URL after successful 3DS (HTTPS)
failureUrlstringYesRedirect URL after failed 3DS (HTTPS)
hashstringYesRequest signature

card object

ParameterTypeRequiredDescription
cardNumberstringYesCard number, digits only
cardHolderstringYesName on the card
cardExpiryMonthstringYesTwo-digit expiry month, e.g. 01
cardExpiryYearstringYesFour-digit expiry year, e.g. 2039
cardCvvstringYesCard security code

customer object

ParameterTypeRequiredDescription
namestringYesCustomer full name
emailstringYesCustomer email. Also used in the request hash
phonestringYesCustomer phone number, e.g. +966501223324
idNumberstringNoCustomer national ID or Iqama number

Generate the request hash immediately before sending the request. The hash must match the card number, customer email, and merchant API key used in the request.


Request Example

This example uses a DigetPay Test Card and works with your Test API Key.

{
  "orderId": "TEST-S2S-0001",
  "amount": 0.11,
  "currency": "SAR",
  "paymentMethod": "card",
  "auth": "N",
  "saveToken": "N",
  "customer": {
    "name": "Ahmed Emad Abd-Alfatah",
    "email": "[email protected]",
    "phone": "+966501223324",
    "idNumber": "1234567890"
  },
  "card": {
    "cardNumber": "5123450000000008",
    "cardHolder": "Ahmed Emad Abd-Alfatah",
    "cardExpiryMonth": "01",
    "cardExpiryYear": "2039",
    "cardCvv": "100"
  },
  "successUrl": "https://yourstore.com/payment/success",
  "failureUrl": "https://yourstore.com/payment/failure",
  "hash": "COMPUTED_MD5_HASH"
}
🚧

Never log or store full card numbers or CVV values. Sensitive payment data should only exist in memory during request processing. Use Test Cards only with your Test API Key, and never use real cards or real customer data in Test Mode.


Responses

{
  "code": 200,
  "message": "Success",
  "data": {
    "result": "ACCEPTED",
    "paymentId": "c09fba3c-59e2-434a-9ec1-5d2e71a44a8d",
    "status": "APPROVED",
    "html": null
  }
}

Response Fields

FieldDescription
resultPayment result. REDIRECT means the customer must complete 3-D Secure (see below)
actionOperation type: SALE (auth: N) or authorization (auth: Y)
statusGateway payment status, e.g. PENDING, APPROVED, DECLINED
amountPayment amount
currencyPayment currency
order_idYour orderId from the request
transactionIdDigetPay transaction ID (UUID)
paymentIdPayment ID from the processor. Also returned as trans_id and acquirerPaymentId
trans_dateTransaction date and time
rrnRetrieval Reference Number, when available
card_brandCard brand, e.g. Visa, Mastercard, Mada
decline_reasonReason for a declined payment, when available
CardMasked card details: number, expiry, brand, issuer, funding method. Token is filled when saveToken is Y
Card.Is3DSVerifiedtrue after 3-D Secure has been completed
result_urlYour successUrl or failureUrl, where the customer returns after 3-D Secure
htmlSelf-submitting HTML page that sends the customer to 3-D Secure
redirect_url3-D Secure page URL. Use it instead of html if you prefer a direct redirect
📘

When result is REDIRECT: send the customer to 3-D Secure, either by rendering html in the customer's browser or by redirecting the browser to redirect_url. The payment stays PENDING until 3-D Secure is completed. Do not fulfill the order until you confirm the result with the Transaction Status API. The redirect to your successUrl and webhooks are notifications, not proof of payment.

Store both transactionId and paymentId with your order. You need them for Status, Capture, Void, Recurring and refunds, and for reconciliation.


Related APIs


Embedded code example (PHP)

Body Params
string
required
number
required
string
required
string
required
string
enum
required

N = Sale, Y = Authorization only

Allowed:
card
object
required
customer
object
required
string
required
string
required
string
required

MD5 request signature generated on your backend

string
enum

Y = save the card as a token for Tokenization Sale

Allowed:
Responses

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