Payments with tokens
If you embed payment forms using the Yandex.Checkout’s web and mobile SDKs, you will need to use tokens for payment processing: first, use the SDK to exchange payment data for a one-time payment token, then include this token in the payment creation request to Yandex.Checkout.
 Specifics
Use tokens only when you accept payments via Android SDK, iOS SDK, YandexCheckout.js, YandexCheckout UI.
You need to request a permission from your Yandex.Checkout manager in order to process payments with tokens.
 Processing payments
Step 1. Get the payment token in SDK. It will contain the selected payment method, payment details. If you’re using the mobile SDK, the token will also contain information about payment confirmation scenarios.
Step 2. Send the token to your server.
Step 3. Create a payment  and use the payment token in the
payment_token
parameter. If you’re using the web SDK and 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.
Example of request for the web SDK
cURL
PHP
Python
curl https://payment.yandex.net/api/v3/payments \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "payment_token": "eyJ0eXBlIjoiY2hlY2tvdXRfanNfYmFua19jYXJkIiwiZW5jcnlwdGVkIjoiMFk3Q3dVVXFVSUE0bXVUWW5EVXhBRG9PUFFCRHByQ3F6Y0cvcGw5SDFZV0xKejROaS9wVkZ0amhmT3N1b1NzVGp2cFJzYkRxSTdLWStYNjZjdW45STczTC8zQXFPOGVwV0dtSFEyV1pXR1lHM3pNdUxyNHp1WmJzMW85bDh5czdjT0ZuMEc5T3hma0kyNitQcXBuSGU3NGZwYzRXU1l2TUh4MFpyYVdRNW5UdFlDVWQyZz09IiwiaW5pdFZlY3RvciI6Ik50d0lpZVFFaG9Cb3FJRzFxT29yREE9PSIsImtleUlkIjoiT2pOQUJrL21Uam5kTGtWZlR1U1F0dz09In0=",
        "amount": {
          "value": "2.00",
          "currency": "RUB"
        },
        "confirmation": {
          "type": "redirect",
          "enforce": false,
          "return_url": "https://www.merchant-website.com/return_url"
        },
        "capture": false,
        "description": "Order No. 72"
      }'
Example of request for the mobile SDK
cURL
PHP
Python
curl https://payment.yandex.net/api/v3/payments \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "payment_token": "eyJ0eXBlIjoiY2hlY2tvdXRfanNfYmFua19jYXJkIiwiZW5jcnlwdGVkIjoiMFk3Q3dVVXFVSUE0bXVUWW5EVXhBRG9PUFFCRHByQ3F6Y0cvcGw5SDFZV0xKejROaS9wVkZ0amhmT3N1b1NzVGp2cFJzYkRxSTdLWStYNjZjdW45STczTC8zQXFPOGVwV0dtSFEyV1pXR1lHM3pNdUxyNHp1WmJzMW85bDh5czdjT0ZuMEc5T3hma0kyNitQcXBuSGU3NGZwYzRXU1l2TUh4MFpyYVdRNW5UdFlDVWQyZz09IiwiaW5pdFZlY3RvciI6Ik50d0lpZVFFaG9Cb3FJRzFxT29yREE9PSIsImtleUlkIjoiT2pOQUJrL21Uam5kTGtWZlR1U1F0dz09In0=",
        "amount": {
          "value": "2.00",
          "currency": "RUB"
        },
        "confirmation": {
          "type": "redirect",
          "enforce": false,
          "return_url": "https://www.merchant-website.com/return_url"
        },
        "capture": false,
        "description": "Order No. 72"
      }'
Step 4. Implement the confirmation scenario.
If you use the web SDK and process payments with 3-D Secure authentication, send the user
confirmation_url
that you received in the payment object.
If you use the mobile SDK, send
confirmation_url
to the mobile SDK.
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": "100001",
    "gateway_id": "1000001"
  },
  "refundable": false,
  "test": false
}
Step 5. Wait for the payment to be successfully completed: you will receive a notification from Yandex.Checkout, or you can send periodic requests for payment information .
 See also
iOS SDKAndroid SDKYandexCheckout.jsYandexCheckout UI