Opcja dostępna w przypadku włączonej usługi ING Lease Now.
Do podstawowego zapytania tworzącego płatność należy załączyć obiekt cart z tablicą items wraz z następujacymi parametrami:
| Parametr | Typ | Parametr wymagany | Opis |
|---|---|---|---|
id |
string | TAK |
Identyfikator produktu |
name |
string | TAK |
Nazwa produktu |
amount |
integer | TAK |
Wartość jednostkowa produktu netto w najmniejszej jednostce waluty - grosze. Dopuszczalna jest również wartość 0. |
tax |
integer | TAK |
Wartość jednostkowa podatku |
taxStake |
string | TAK |
Stawka podatku. Dostępne wartości: 23, 22, 8, 7, 5, 3, 0, TAX_EXEMPT, TAX_NOT_LIABLE, TAX_REVERSE_CHARGE, TAX_EXCLUDING |
quantity |
integer | TAK |
Ilość. Minimalna wartość to 1 |
url |
string | TAK |
Adres url dla danego produktu |
categoryId |
string | TAK |
Nazwa kategorii |
unit |
string | NIE |
Jednostka |
state |
integer | NIE |
Stan produktu. Dostępne wartości: NEW, USED |
discount.amount |
integer | NIE |
Wartość rabatu |
discount.tax |
integer | NIE |
Wartość podatku rabatu |
Minimalna wartość dla pojedynczego produktu w Leasingu to 1000 PLN, natomiast wartość całego koszyka musi wynosić minimum 5000 PLN. Podane kwoty są kwotami netto.
Przykładowa struktura danych
$cart = [
'items' => [
[
'id' => 1,
'categoryId' => 'category123',
'name' => 'Product name',
'amount' => 1000,
'tax' => 230,
'taxStake' => 23,
'quantity' => 1,
'unit' => 'szt',
'url' => 'https://product.url',
'state' => 'NEW',
'discount' => [
'amount' => 100,
'tax' => 23,
]
]
]
];
Powyższe parametry należy uwzględnić podczas wyliczania sygnatury zgodnie z punktem Autoryzacja
Przygotowanie obiektu cart
Za pomocą funkcji PHP
Dane zebrane z powyższych parametrów należy zakodować za pomocą funkcji:
base64_encode(gzencode(json_encode($cart), 5));
gdzie:
$cart - przygotowane wcześniej parametry
$cart = [
'items' => [
[
'id' => 1,
'categoryId' => 'category123',
'name' => 'Product name',
'amount' => 500000,
'tax' => 115000,
'taxStake' => 23,
'quantity' => 1,
'unit' => 'szt',
'url' => 'https://product.url',
'state' => 'NEW',
'discount' => [
'amount' => 100,
'tax' => 23,
],
],
],
];
$cart = base64_encode(gzencode(json_encode($cart), 5));
$fields = [
'serviceId' => '63f574ed-d90d-4abe-9cs1-39117584a7b7',
'merchantId' => '6yt3gjtm9p1odfgx8491',
'amount' => '615000',
'currency' => 'PLN',
'orderId' => '123',
'orderDescription' => '#Example transaction',
'customerFirstName' => 'Jan',
'customerLastName' => 'Kowalski',
'customerEmail' => 'jan.kowalski@example.com',
'customerPhone' => '515515515',
'urlSuccess' => 'https://your-shop.com/success',
'urlFailure' => 'https://your-shop.com/failure',
'urlReturn' => 'https://your-shop.com/return',
'cart' => $cart,
];
$serviceKey = 'eAyhFLuHgwl5hu-32GM8QVlCVMWRU0dGjH1c';
$hashMethod = 'sha256';
$signature = createSignature(
$fields,
$serviceKey,
$hashMethod
) . ';' . $hashMethod;
Użycie dodatkowo parametru visibleMethod z wartością lease spowoduje wyświetlenie tylko Leasingu na bramce. Takie działanie daje możliwość na wyodrębnienie danej metody jako osobnej na podsumowaniu.
Przykładowa zawartość formularza
<input type="hidden" value="63f574ed-d90d-4abe-9cs1-39117584a7b7" name="serviceId">
<input type="hidden" value="6yt3gjtm9p1odfgx8491" name="merchantId">
<input type="hidden" value="300" name="amount">
<input type="hidden" value="PLN" name="currency">
<input type="hidden" value="123" name="orderId">
<input type="hidden" value="Example transaction" name="orderDescription">
<input type="hidden" value="John" name="customerFirstName">
<input type="hidden" value="Doe" name="customerLastName">
<input type="hidden" value="johndoe@domain.com" name="customerEmail">
<input type="hidden" value="501501501" name="customerPhone">
<input type="hidden" value="https://your-shop.com/success" name="urlSuccess">
<input type="hidden" value="https://your-shop.com/failure" name="urlFailure">
<input type="hidden" value="https://your-shop.com/return" name="urlReturn">
<input type="hidden" value="<?= $cart ?>" name="cart">