Processing a payment via mobile SDKs
If you are using the YooMoney’s mobile SDKs, you will need to exchange payment data for a one-time payment token in the SDK, 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 iOS or Android SDK. It will contain the selected payment method, payment details, and 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.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" }, "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