Charges a saved card token. Get the token from Card.Token of a Direct Sale made with saveToken: "Y". A declined charge also returns HTTP 200: the charge succeeded only when data.status is SUCCESS.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Charge a customer with a saved card token from an earlier Embedded (S2S) payment. Use it for recurring or repeat payments without asking the customer to enter their card again.
Get a token first: Make a Direct Sale payment with
"saveToken": "Y". When the payment succeeds, the token is returned inCard.Token(for exampleTKN-...). Store it securely on your backend.
Flow
sequenceDiagram
autonumber
participant Merchant as Your Server
participant DigetPay as DigetPay API
participant Gateway as Payment Gateway
Note over Merchant: Direct Sale with saveToken: "Y" returned Card.Token
Merchant->>DigetPay: POST /payment/s2s/tokenization/sale
Note right of Merchant: orderId, amount, currency, token
DigetPay->>Gateway: Charge saved card
Gateway-->>DigetPay: Payment result
DigetPay-->>Merchant: Result
Request
| Method | POST |
| URL | https://api.digetpay.com/v1/payment/s2s/tokenization/sale |
| Auth | Header x-api-key (Test API Key or Live API Key, required) |
Use the API key of the same mode (Test or Live) that created the token.
Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
orderId | string | Yes | Your unique order reference for this charge |
amount | number | Yes | Amount to charge |
currency | string | Yes | ISO currency code, e.g. SAR |
token | string | Yes | Saved card token from Card.Token of the original Direct Sale |
successUrl | string | Yes | HTTPS URL where the customer returns after the payment |
Important: Use a new, unique
orderIdfor every charge. The token can be charged more than once, but each charge is a separate order.
Request payload
{
"orderId": "SUB-2026-10-0001",
"amount": 0.11,
"currency": "SAR",
"token": "TKN-00000000-0000-0000-0000-000000000000",
"successUrl": "https://yourstore.com/payment/callback"
}Security: Never expose the card token in browser JavaScript, URLs, mobile applications, or logs. Store it securely on your backend.
Responses
{
"code": 200,
"message": "Success",
"errorCode": null,
"data": {
"transactionId": "edf02325-b1e0-48e8-bfb2-a910aa2125a3",
"paymentId": "07077295180390238873",
"order_id": "SUB-2026-10-0002",
"status": "SUCCESS",
"amount": "0.11",
"currency": "SAR",
"paymentFlow": "TOKENIZATION",
"Card": {
"NameOnCard": "Ahmed Emad Abd-Alfatah",
"Number": "512345xxxxxx0008",
"Token": "TKN-00000000-0000-0000-0000-000000000000",
"ExpiryMonth": "01",
"ExpiryYear": "39",
"Brand": "Mastercard",
"Issuer": "Test Bank",
"FundingMethod": "credit"
},
"operationType": "PAY",
"transactionType": "TOKENIZATION",
"invoice": {
"id": "7295180",
"status": "PAID",
"reference": "2026001567",
"externalIdentifier": "SUB-2026-10-0002",
"creationDate": "2026-10-21T08:19:21.5807867Z",
"expirationDate": "2026-10-24T08:19:21.5807867Z"
},
"transaction": {
"id": "130955",
"status": "SUCCESS",
"paymentId": "07077295180390238873",
"referenceId": "629408130955",
"trackId": "21-10-2026_3902388",
"authorizationId": "130955",
"paymentMethod": "VISA/MASTER",
"transactionDate": "2026-10-21T08:19:22.3386814Z",
"networkTransactionId": "777123456789",
"error": {
"message": "",
"responseCode": "00"
}
},
"result_url": "https://yourstore.com/payment/callback?paymentId=07077295180390238873&Id=07077295180390238873"
}
}{
"code": 200,
"message": "DECLINED : Invalid card number",
"errorCode": null,
"data": {
"transactionId": "6a9bbc68-a932-47cc-acad-50fa7fe05776",
"paymentId": "07077295146390237073",
"order_id": "SUB-2026-10-0001",
"status": "FAILED",
"amount": "0.11",
"currency": "SAR",
"paymentFlow": "TOKENIZATION",
"Card": {
"NameOnCard": "Ahmed Emad Abd-Alfatah",
"Number": "512345xxxxxx0008",
"Token": "TKN-00000000-0000-0000-0000-000000000000",
"ExpiryMonth": "01",
"ExpiryYear": "39",
"Brand": "Mastercard",
"Issuer": "TEST BANK",
"IssuerCountry": "SAU",
"FundingMethod": "credit"
},
"operationType": "PAY",
"transactionType": "TOKENIZATION",
"invoice": {
"id": "7295146",
"status": "PENDING",
"reference": "2026001565",
"externalIdentifier": "SUB-2026-10-0001",
"creationDate": "2026-10-21T08:14:42.8803979Z",
"expirationDate": "2026-10-24T08:14:42.8803979Z"
},
"transaction": {
"id": "07077295146390237073",
"status": "FAILED",
"paymentId": "07077295146390237073",
"trackId": "21-10-2026_3902370",
"paymentMethod": "VISA/MASTER",
"transactionDate": "2026-10-21T08:14:42.8970875Z",
"error": {
"message": "DECLINED : Invalid card number",
"responseCode": "14"
}
},
"result_url": "https://yourstore.com/payment/callback?paymentId=07077295146390237073&Id=07077295146390237073"
}
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Missing API key",
"path": "/v1/payment/s2s/tokenization/sale",
"timestamp": "2026-10-21T08:03:53.456Z"
}Response fields
A declined charge still returns HTTP 200 and code: 200. Always check data.status: the charge succeeded only when it is SUCCESS.
| Field | Description |
|---|---|
message | Success, or the decline reason when the charge fails |
data.transactionId | DigetPay transaction ID (UUID) |
data.paymentId | Payment ID for this charge. Use it for Transaction Status and Refund |
data.order_id | Your orderId from the request |
data.status | Payment status: SUCCESS, FAILED or PENDING |
data.amount / currency | Charged amount and currency |
data.paymentFlow | TOKENIZATION for charges made with a saved token |
data.Card | Masked card details and the Token used |
data.transactionType | TOKENIZATION |
data.invoice | Invoice reference, status (PAID when successful) and dates for this charge |
data.transaction | Processor transaction details: authorizationId, referenceId, networkTransactionId, transactionDate |
data.transaction.error | Decline details: message and the card network responseCode (00 = approved) |
data.result_url | Your successUrl with the payment ID added |
Confirm the payment: Before fulfilling the order, verify the charge with Transaction Status.
Best practice: Save the returned payment reference for reconciliation, refunds, and transaction tracking.
If the token becomes invalid, expires, or the card is blocked by the issuer, the charge is declined. Ask the customer to pay again with a Direct Sale and
"saveToken": "Y"to get a new token.

