Skip to content

В документации отсутствует idempotenceKey #2

@sergeyfilimonov

Description

@sergeyfilimonov

Во-первых, спасибо за библиотеку с промисом!

Замечание к документации — там отсутствует idempotenceKey, а это вроде обязательный параметр.

То есть по идее должно быть так:

const YooKassa = require('yookassa');

const yooKassa = new YooKassa({
    shopId: '<Идентификатор магазина>',
    secretKey: '<Секретный ключ>'
});

const idempotenceKey = Math.floor(Math.random() * 100000000) + 1
// Случайное число или ID заказа в БД

const payment = await yooKassa.createPayment({
    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: "Заказ №72"
}, idempotenceKey);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions