Old versions of the API
Help
Sign up for YooMoney
Processing a payment via Checkout.js
If you are using Checkout.js, you will need to exchange payment data for a one-time payment token in the library, then include this token in the payment creation request to the API.

You need to request a permission from your YooMoney manager in order to process payments with tokens.

Payments with tokens
Step 1. Get the payment token in Checkout.js.
Step 2. Send the token to your server.
Step 3. Create a payment , send the payment token in the payment_token parameter. If you’re planning to process the payment via 3-D Secure authentication, send the confirmation object with the redirect type and the URL of the page the user will return to.

The token is for single-use only. If not used, the token will expire after 1 hour. If you don't create a payment within an hour, you will need to request the token again.

Example of request
cURL
PHP
Python
curl https://api.yookassa.ru/v3/payments \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "payment_token": "pt-28cd3959-0000-500c-a000-03b4de9b24a7",
        "amount": {
          "value": "2.00",
          "currency": "RUB"
        },
        "confirmation": {
          "type": "redirect",
          "enforce": false,
          "return_url": "https://www.example.com/return_url"
        },
        "capture": false,
        "description": "Order No. 72"
      }'
Step 4. If the payment status is pending, redirect the user to confirmation_url.
Example of a created payment object
JSON
{
  "id": "23d93cac-000f-5000-8000-126628f15141",
  "status": "pending",
  "paid": false,
  "amount": {
    "value": "2.00",
    "currency": "RUB"
  },
  "confirmation": {
    "type": "redirect",
    "confirmation_url": "<Link for 3-D Secure authentication>"
  },
  "created_at": "2019-01-22T14:30:45.129Z",
  "description": "Order No. 72",
  "metadata": {},
  "recipient": {
    "account_id": "100500",
    "gateway_id": "100700"
  },
  "refundable": false,
  "test": false
}
Step 5. Wait for the payment to be successfully completed: you will receive a notification from YooMoney, or you can send periodic requests for payment information .
See also
Processing a payment via Checkout.js