@os-team/yandex-checkout
Yandex.Checkout API v3. All methods described in the official documentation are implemented (payments, refunds and receipts).
Examples
Create a payment
const yandexCheckout = new YandexCheckout({
shopId: 'shopId',
secretKey: 'secretKey',
});
const payment = await yandexCheckout.payments.create(
{
amount: {
value: '2.00',
currency: 'RUB',
},
payment_method_data: {
type: 'bank_card',
},
confirmation: {
type: 'redirect',
return_url: 'https://www.merchant-website.com/return_url',
},
description: 'Order No. 1',
},
'idempotenceKey'
);
Create a recurring payment
const firstPayment = await yandexCheckout.payments.create(
{
amount: {
value: '2.00',
currency: 'RUB',
},
payment_method_data: {
type: 'bank_card',
},
confirmation: {
type: 'redirect',
return_url: 'https://www.merchant-website.com/return_url',
},
description: 'Order No. 1',
save_payment_method: true,
capture: true,
},
'idempotenceKey'
);
const secondPayment = await yandexCheckout.payments.create(
{
amount: {
value: '2.00',
currency: 'RUB',
},
payment_method_id: firstPayment.payment_method.id,
description: 'Order No. 2',
capture: true,
},
'idempotenceKey'
);
Supported methods
- payments.create
- payments.list
- payments.get
- payments.capture
- payments.cancel
- refunds.create
- refunds.list
- refunds.get
- receipts.create
- receipts.list
- receipts.get