Embaded Tamara

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

Accept Tamara payments through DigetPay's Server-to-Server (S2S) Sale API.

Your backend initiates the payment, and DigetPay returns a redirect URL where the customer completes the Tamara checkout process.

Important: Tamara S2S uses the same Direct Sale endpoint as card payments, but requires a different request hash formula and redirect handling.


1. Prerequisites

Before integrating Tamara, ensure that:

  • Tamara is enabled for your DigetPay merchant account.
  • You have a valid Test or Live API Key.
  • Your backend can securely generate the request hash.
  • You have HTTPS success and failure URLs.
  • You can receive payment webhooks and verify transaction status.

The customer's full name should include both first and last name to avoid Tamara customer validation errors.

2. API Endpoint

PropertyValue
MethodPOST
Endpoint/payment/s2s/sale
Base URLhttps://api.digetpay.com/v1
Authenticationx-api-key
Content-Typeapplication/json
Payment Methodtamara

Both Test and Live use the same API base URL. The API key determines the environment.

3. Tamara Request Hash

Tamara requires a different MD5 request hash from standard S2S card payments.

Tamara Hash Formula

MD5(
  UPPERCASE(
    REVERSE(customerEmail)
    + API_KEY
    + REVERSE(orderId)
  )
)

Trim the email and order ID before reversing them. Concatenate the three values without separators, uppercase the resulting string, and calculate its MD5 hexadecimal digest.

Tamara vs. Standard Card S2S

Standard Card S2STamara S2S
Reverse customer emailReverse customer email
Add merchant API keyAdd merchant API key
Reverse first 6 + last 4 card digitsReverse merchant orderId
Uppercase and MD5Uppercase and MD5

Important: Do not use the card payment hash formula for Tamara transactions.

Postman Pre-request Script

Configure a Postman environment variable named digetpay_api_key and use it in the x-api-key header.

function s2sTamaraHash(email, apiKey, orderId) {
    const rev = (s) => s.split("").reverse().join("");

    const combined = (
        rev(email.trim()) +
        apiKey +
        rev(String(orderId).trim())
    ).toUpperCase();

    return CryptoJS.MD5(combined)
        .toString(CryptoJS.enc.Hex);
}

const API_KEY = pm.environment.get("digetpay_api_key");

if (!API_KEY) {
    throw new Error("Missing digetpay_api_key");
}

const body = JSON.parse(pm.request.body.raw);

const hash = s2sTamaraHash(
    body.customer.email,
    API_KEY,
    body.orderId
);

pm.variables.set("tamara_hash", hash);

Use "hash": "{{tamara_hash}}" in the Postman request body.

Security: Generate the hash on your secure backend for production transactions. Never expose API keys in frontend JavaScript or hardcode them in publicly shared Postman collections.

4. Create Tamara Payment

Request Example

curl --location 'https://api.digetpay.com/v1/payment/s2s/sale' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "orderId": "TAMARA-ORDER-1001",
  "amount": 125.52,
  "currency": "SAR",
  "paymentMethod": "tamara",
  "auth": "N",
  "customer": {
    "name": "Ahmed Mohamed",
    "email": "[email protected]",
    "phone": "+966501234567"
  },
  "successUrl": "https://merchant.example/success",
  "failureUrl": "https://merchant.example/failure",
  "hash": "GENERATED_TAMARA_MD5_HASH"
}'

Generate the hash from the same customer email, merchant API key, and order ID used in this request.

Request Parameters

ParameterTypeRequiredDescription
orderIdstringYesUnique merchant order reference, also used in the hash.
amountnumberYesPayment amount.
currencystringYesSAR for this Tamara flow.
paymentMethodstringYesMust be tamara.
authstringYesN for the sale operation shown here.
customer.namestringYesCustomer's full name.
customer.emailstringYesCustomer email used in the hash.
customer.phonestringYesCustomer mobile number.
successUrlstringYesMerchant success return URL.
failureUrlstringYesMerchant failure return URL.
hashstringYesTamara-specific MD5 request hash.

5. API Response

Redirect Response

{
  "code": 200,
  "message": "Success",
  "errorCode": null,
  "data": {
    "result": "REDIRECT",
    "action": "SALE",
    "status": "PENDING",
    "amount": "125.52",
    "currency": "SAR",
    "order_id": "TAMARA-ORDER-1001",
    "trans_date": "2026-10-21 10:18:02",
    "transactionId": "713d8ecf-61a4-4661-b877-de90e3aba778",
    "paymentId": "7295722",
    "card_brand": "TAMARA",
    "merchant_name": null,
    "decline_reason": null,
    "Card": null,
    "result_url": "https://merchant.example/success?paymentId=7295722&Id=7295722",
    "html": null,
    "redirect_url": "https://pay.digetpay.com/En/KWT/PayInvoice/Checkout?invoiceKey=EXAMPLE_INVOICE_KEY&paymentGatewayId=2417"
  }
}

Response Fields

FieldDescription
data.resultREDIRECT indicates customer redirection is required.
data.actionTransaction action, such as SALE.
data.statusCurrent payment status, initially PENDING.
data.amountTransaction amount.
data.currencyTransaction currency.
data.order_idMerchant order reference.
data.transactionIdDigetPay transaction UUID.
data.paymentIdPayment provider identifier.
data.card_brandTAMARA for Tamara payments.
data.redirect_urlURL where the customer completes payment.
data.result_urlMerchant return URL supplied in the response.
data.htmlNull for this redirect example.
data.decline_reasonDecline reason, when available.

Important: code: 200 means the API request was processed. result: REDIRECT and status: PENDING do not confirm successful payment.

6. Customer Payment Flow

The Tamara payment process follows these steps:

  1. The customer selects Tamara as the payment method.
  2. The merchant backend generates the Tamara request hash.
  3. The backend submits POST /payment/s2s/sale.
  4. DigetPay returns result: REDIRECT, status: PENDING, and redirect_url.
  5. The merchant redirects the customer to data.redirect_url.
  6. The customer completes the Tamara payment process.
  7. DigetPay updates the transaction outcome.
  8. The merchant verifies the final transaction status and updates the order accordingly.

Important: Always redirect the customer to data.redirect_url, not data.result_url.

The returned checkout URL should be used as provided by DigetPay without manually reconstructing it.

7. Payment Verification

A successful API initiation does not confirm that the customer has completed payment.

The merchant should:

  1. Receive the payment webhook notification when configured.
  2. Retrieve the latest transaction status through the appropriate authenticated S2S status API.
  3. Verify the merchant order reference, amount, and currency.
  4. Update the order as paid only after confirming a successful payment state.

Store the returned transactionId, paymentId, and order_id for tracking and reconciliation.

See Embedded Transaction Status for status lookup details. Confirm the supported identifiers and final status values for Tamara before implementing automatic fulfillment.

8. Troubleshooting

IssuePossible Cause / Solution
Invalid Request HashCheck the email reversal, API key, reversed orderId, uppercase conversion, and MD5 calculation.
Invalid Customer DataProvide full customer name, valid email, and valid phone number.
Invalid API KeyVerify the Test or Live API Key is active and matches the environment.
Status remains PENDINGCustomer may not have completed the payment. Query the transaction status.
Customer not redirectedVerify that data.redirect_url is being used.
Order not updatedCheck webhook delivery and server-side payment verification.
Duplicate Order ReferenceUse a unique orderId for each new payment attempt and retain the transaction identifiers.

9. Important Notes

  • Tamara uses the S2S Sale endpoint with paymentMethod: "tamara".
  • Tamara requires its own request hash formula.
  • The hash uses the customer email, API key, and order ID.
  • Do not include a card object in the Tamara request shown here.
  • Customer payment completion takes place through the returned redirect URL.
  • PENDING is not a completed payment.
  • Payment status must be verified before fulfilling the merchant order.
  • Test and Live API Keys use the same DigetPay base URL.

10. Related Documentation

Response
200
Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here!