Generate New Authorization

This is a variant of POST /generate-sale — Generate Payment; the request and responses below are the ones documented for IL Direct Debit.

Credentials

Overview

The Israeli Direct Debit alternative payment method works in a two-phase setup:

  1. Setting up the bank authorization <- You are here
  2. Completing the payment using the bank authorization

Bank Authorization Setup

In order to setup the bank Authorization, you will need to use our generate-sale endpoint, using a few specific parameters.

  1. sale_type = token
  2. sale_payment_method = il-direct-debit

The authorization page is based on our hosted-payment-page and will collect information regarding the buyer's identity and bank account.

After the buyer completes the setup, the authorization will be sent to the bank and will be inactive until we receive an update (takes up to 96 hours).

Callbacks

You will get two callbacks:

  1. Callback that indicates that the sale complete - Not relevant, as the sale_type is from type "token" and not sale.
  1. Callback that inditates the authorization status - You can find all the bank authorization statuses here.
{
"status": 1,
"error_code": "11",
"internal_reference_id": 10000,
"customer_name": "Test test",
"charge_limit": 200
}

Testing

Information for testing can be found here - Israeli Direct Debit Testing Information.

Please note that in our sandbox environment you will receive only bank authorization statuses from type 1 or 2 (Success/failure). You can find all the bank authorization statuses here.

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 MPL the authorization will be given for
sale_price string yes Must be included, won't be charged as a part of the authorization setup
currency string yes Sale currency. 3-letter ISO 4217 name.
product_name string yes Use a generic value here (will not affect the authorization setup process)
language string no The language the page will be presented in
sale_type string yes The sale type. For authorization setup, use token by default
sale_payment_method string yes The sale payment method. Must be il-direct-debit for the authorization setup process
sale_return_url string no The URL the user will be redirected to after completing the authorization setup process

Request example

{
  "seller_payme_id": "MPL16370-57351SJQ-0DTLUQXA-NJ916MXU",
  "sale_price": "1000",
  "currency": "ILS",
  "product_name": "Shirt",
  "language": "en",
  "sale_type": "token",
  "sale_payment_method": "il-direct-debit",
  "sale_return_url": "https://sport5.co.il"
}

Code samples

curl

curl -X POST 'https://sandbox.payme.io/api/generate-sale' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "seller_payme_id": "MPL16370-57351SJQ-0DTLUQXA-NJ916MXU",
  "sale_price": "1000",
  "currency": "ILS",
  "product_name": "Shirt",
  "language": "en",
  "sale_type": "token",
  "sale_payment_method": "il-direct-debit",
  "sale_return_url": "https://sport5.co.il"
}'

Node.js

const response = await fetch("https://sandbox.payme.io/api/generate-sale", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "seller_payme_id": "MPL16370-57351SJQ-0DTLUQXA-NJ916MXU",
    "sale_price": "1000",
    "currency": "ILS",
    "product_name": "Shirt",
    "language": "en",
    "sale_type": "token",
    "sale_payment_method": "il-direct-debit",
    "sale_return_url": "https://sport5.co.il"
  }),
});

console.log(await response.text());

Python

import requests

response = requests.post(
    "https://sandbox.payme.io/api/generate-sale",
    json={
        "seller_payme_id": "MPL16370-57351SJQ-0DTLUQXA-NJ916MXU",
        "sale_price": "1000",
        "currency": "ILS",
        "product_name": "Shirt",
        "language": "en",
        "sale_type": "token",
        "sale_payment_method": "il-direct-debit",
        "sale_return_url": "https://sport5.co.il",
    },
)

print(response.text)

PHP

<?php

$body = <<<'BODY'
{
  "seller_payme_id": "MPL16370-57351SJQ-0DTLUQXA-NJ916MXU",
  "sale_price": "1000",
  "currency": "ILS",
  "product_name": "Shirt",
  "language": "en",
  "sale_type": "token",
  "sale_payment_method": "il-direct-debit",
  "sale_return_url": "https://sport5.co.il"
}
BODY;

$ch = curl_init('https://sandbox.payme.io/api/generate-sale');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => $body,
]);

$response = curl_exec($ch);
curl_close($ch);

echo $response;

Responses

200 — OK (success)

Field Type Description
status_code string Status of the request (0 - success, 1 - error)
sale_url string The URL of the IFRAME secured payment form to display to the buyer
payme_sale_id string Our unique sale ID
payme_sale_code integer Our unique sale code (for display purposes only)
price integer Sale final price. For example, if the price is 50.75 (max 2 decimal points) the value that needs to be sent is 5075
transaction_id string Transaction ID
currency string
sale_payment_method string The sale payment method. Must be il-direct-debit for the authorization setup process
{
  "status_code": 0,
  "sale_url": "https://sandbox.payme.io/sale/generate/SALETEST-XXXXXXXX-XXXXXXXX-XXXXXXXX",
  "payme_sale_id": "SALE1687-957072WX-0MEX63QM-GMHDMGNU",
  "payme_sale_code": 1234567,
  "price": 1000,
  "transaction_id": "12345",
  "currency": "ILS",
  "sale_payment_method": "il-direct-debit"
}