# Charge an Israeli direct debit authorization Building with an AI agent? Start at https://docs.payme.io/agents.md - Sandbox: `POST https://sandbox.payme.io/api/generate-sale` - Production: `POST https://live.payme.io/api/generate-sale` ## Credentials - Request body field `seller_payme_id` (required): The seller's MPL, in the JSON body. - Request body field `payme_client_key` (optional): Partners only: your partner key (or send the `PayMe-Partner-Key` header). With `seller_payme_id`, the seller must belong to you, otherwise error `20`. ## Overview > **Availability.** Israeli Direct Debit is offered to high-volume sellers only. It is enabled per account after approval by your PayMe sales representative; it is not self-service. Until then, `generate-sale` returns `720`. Israeli direct debit works in two phases: 1. [Set up the bank authorization](/payments/il-direct-debit/post-generate-sale-il-direct-debit) and receive its token (`buyer_key`). 2. Charge the authorization (this page). `POST https://sandbox.payme.io/api/generate-sale` (production: `https://live.payme.io/api/generate-sale`), with a JSON body (`Content-Type: application/json`). ### Charge the authorization Call `generate-sale` with: 1. `buyer_key` – the token from the authorization setup; 2. `sale_type: sale`; 3. `sale_payment_method: il-direct-debit`. The call submits the debit at once: there is no payment page and no `sale_url`. The token's own payment method is used either way. Constraints: - `currency` must be `ILS` (otherwise error `320`). - The token must be active: the setup's `sale-complete` callback has arrived. A token whose authorization isn't active yet, was rejected or was revoked returns `604`. - Installments aren't allowed (`351`). ### Credentials Send `seller_payme_id` (the MPL) in the JSON body: this endpoint doesn't read the `PayMe-Merchant-Key` header, so a request without a body MPL returns error `1`. Partners add `payme_client_key` (or the `PayMe-Partner-Key` header) and may name the seller by `seller_id` instead. See [Authentication](/payments/getting-started/authentication). ### Callbacks | `notify_type` | When | |---|---| | `sale-paid` | The debit was submitted to the bank. | | `sale-complete` | About 8 days later: the debit is final. | | `sale-failure` | The bank returned the debit. | The fields are on [Callbacks](/payments/getting-started/callbacks#israeli-direct-debit). ### Testing Sandbox bank accounts are on [Test Cards and Payment Methods](/payments/getting-started/test-cards-and-payment-methods#israeli-direct-debit-testing-information). ## Parameters This endpoint takes no path, query or header parameters. ## Request body Content type: `application/json` | Field | Type | Required | Description | | --- | --- | --- | --- | | `seller_payme_id` | string | yes | The seller's MPL, in the JSON body. | | `payme_client_key` | string | no | Partners only: your partner key (or send the `PayMe-Partner-Key` header). With `seller_payme_id`, the seller must belong to you, otherwise error `20`. | | `buyer_key` | string | yes | The token from the authorization setup. It must be active: the setup's `sale-complete` callback has arrived (otherwise error `604`). | | `sale_type` | string | no | `sale` (default). | | `sale_payment_method` | string | no | `il-direct-debit`. The token's own method is used either way. | | `sale_price` | integer | yes | Amount to debit, in minor units. The default allowed range is `500`–`4000000` (error `352`). | | `currency` | string | yes | `ILS` (anything else returns `320`). | | `product_name` | string | yes | Shown on the seller's records and invoice. Missing returns `353`. | | `transaction_id` | string | no | Your own order reference, up to 50 characters. PayMe returns it in responses and callbacks but doesn't check it for uniqueness. | | `sale_callback_url` | string | no | Where PayMe sends `sale-paid`, `sale-complete` and `sale-failure`. If omitted, your partner's default callback URL is used, if one is set; a seller has no dashboard setting for it, so send it. Must be a public address: `localhost`, private or loopback IP addresses and IPv6 addresses are refused with error `21`, which fails the whole call. | | `language` | string | no | Language of the payment page and the error messages. Default `he`. `he` and `en` are fully supported; `es`, `ru` and `ar` are accepted, but messages and the payment page are then mostly in English. Case-insensitive; any other value, or an empty string, returns error `51`. | ### Request example ```json { "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567", "buyer_key": "BUYERDEMO-BUYERDEMO-BUYERDEMO-1234567", "sale_type": "sale", "sale_payment_method": "il-direct-debit", "sale_price": 1000, "currency": "ILS", "product_name": "Monthly membership", "transaction_id": "order-1003", "sale_callback_url": "https://your-server.example.com/payme/callback", "language": "en" } ``` ## Code samples ### curl ```bash curl -X POST 'https://sandbox.payme.io/api/generate-sale' \ -H 'Content-Type: application/json' \ --data-raw '{ "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567", "buyer_key": "BUYERDEMO-BUYERDEMO-BUYERDEMO-1234567", "sale_type": "sale", "sale_payment_method": "il-direct-debit", "sale_price": 1000, "currency": "ILS", "product_name": "Monthly membership", "transaction_id": "order-1003", "sale_callback_url": "https://your-server.example.com/payme/callback", "language": "en" }' ``` ### Node.js ```javascript const response = await fetch("https://sandbox.payme.io/api/generate-sale", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567", "buyer_key": "BUYERDEMO-BUYERDEMO-BUYERDEMO-1234567", "sale_type": "sale", "sale_payment_method": "il-direct-debit", "sale_price": 1000, "currency": "ILS", "product_name": "Monthly membership", "transaction_id": "order-1003", "sale_callback_url": "https://your-server.example.com/payme/callback", "language": "en" }), }); console.log(await response.text()); ``` ### Python ```python import requests response = requests.post( "https://sandbox.payme.io/api/generate-sale", json={ "seller_payme_id": "MPLDEMO-MPLDEMO-MPLDEMO-1234567", "buyer_key": "BUYERDEMO-BUYERDEMO-BUYERDEMO-1234567", "sale_type": "sale", "sale_payment_method": "il-direct-debit", "sale_price": 1000, "currency": "ILS", "product_name": "Monthly membership", "transaction_id": "order-1003", "sale_callback_url": "https://your-server.example.com/payme/callback", "language": "en", }, ) print(response.text) ``` ### PHP ```php 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => $body, ]); $response = curl_exec($ch); curl_close($ch); echo $response; ``` ## Responses ### 200 — Debit submitted. The response holds the sale and transaction fields and has no `sale_url`. A refused charge also returns HTTP 200, with `status_code: 1`: always check `status_code`. (success) | Field | Type | Description | | --- | --- | --- | | `status_code` | integer | `0` the debit was submitted; `1` it was refused. | | `payme_status` | string | `success` or `error`. | | `payme_sale_id` | string | PayMe's sale ID. | | `payme_sale_code` | integer | Short numeric sale code, for display only. | | `sale_status` | string | `initial` until the debit completes (`completed`, about 8 days later) or fails. | | `sale_payment_method` | string | `il-direct-debit`. | | `price` | integer | Amount in minor units. | | `currency` | string | `ILS`. | | `transaction_id` | string | Your order reference, as sent. | | `payme_transaction_id` | string | PayMe's ID for this debit. | | `payme_transaction_total` | integer | Amount of this transaction, in minor units. | | `payme_signature` | string | Signature, computed as described on [Callbacks](/payments/getting-started/callbacks). | | `sale_paid_date` | string | When the debit was submitted. | ```json { "status_code": 0, "payme_status": "success", "payme_sale_id": "SALE1700-000000AA-EXAMPLE1-SALE0001", "payme_sale_code": 12345678, "sale_status": "initial", "sale_payment_method": "il-direct-debit", "price": 1000, "currency": "ILS", "transaction_id": "order-1003", "payme_transaction_id": "TRAN1700-000000AA-EXAMPLE1-TXN00001", "payme_transaction_total": 1000, "payme_signature": "f8ffc5bb45fe6c3ad326c439f1a21c28", "sale_paid_date": "2026-11-09 10:15:02" } ``` ### 500 — Request refused. Most request errors return HTTP 500 with `status_code: 1`; some return 400, 403, 422 or 429. See [Errors](/payments/getting-started/errors). (error) | Field | Type | Description | | --- | --- | --- | | `status_code` | integer | `1` for an error. | | `status_error_code` | integer | PayMe's error code, for example `251` (seller not found) or `352` (invalid price). | | `status_error_details` | string | The error message, in the requested `language` (Hebrew by default). | | `status_additional_info` | string | Extra detail, usually the name of the field at fault. | | `session` | string | Request ID. Quote it when you contact PayMe. | ```json { "status_code": 1, "status_error_details": "Seller was not found", "status_additional_info": "seller_payme_id", "status_error_code": 251, "session": "AtsJ0as5" } ```