The Yandex.Checkout API allows accepting online payments in the web and mobile apps. This article will help you accept your first payment, and your customers will be able to access all of the payment methods you've implemented.
To start working with Yandex.Checkout, you need to sign up and get access to Merchant Profile.
To authenticate requests in the API, you will need a secret key and the Shop ID from the Merchant Profile.
You can make this payment in the demo store. Demo store has its own ID (start with the test_ prefix) and secret key (you can find it in the Merchant Profile). The payment process in the demo store is identical to the actual payment process, except the money is not transferred anywhere. You can only test two payment methods: bank cards and Yandex.Money.
Step 1. Create a payment
Payment is the main entity of the Yandex.Checkout API. To create a payment, you will need the payment amount and the URL for redirecting the user after they complete the payment. You will also need to send the
parameter with the
so that you will receive the money immediately after the payment (if the value is
, the required amount will be held on the user's account, and you'll be able to debit it whenever it's convenient for you).
If you want to add a payment description that'll be displayed in the Merchant Profile to you, and during the payment to the user, include it in the
parameter. The description must not exceed 128 characters.
Send a request to Yandex.Checkout and include data for creating a payment, data for authentication (Shop ID and secret key) and the idempotence key (any random value).
All requests to the Yandex.Checkout API must be sent from your server. You can use ready-made server SDKs to interact with Yandex.Checkout.
If you're creating a payment for the demo store, use one of the test cards for the payment, for example, 5555555555554444 (use any CVC and future date).
After a successful payment (or if something goes wrong), Yandex.Checkout will return the user to
that you specified during payment creation.
Step 3. Wait for the successful payment completion
Payment can be considered completed once its status changes to
. If the user decides not to proceed with the payment or if something goes wrong, the payment status will change to
You can check the payment status by subscribing to the notifications from Yandex.Checkout.
You can also track status changes by requesting payment information with a convenient frequency (for example, after the user returns to
For that, you will need the payment ID (value of the
parameter in the created payment object).
Great, you have accepted your first payment!
In this example, the user selected the payment method and entered the payment details on the Yandex.Checkout's side. This scenario is called Smart payment. If it doesn't suit your mode of operation, you can use another integration scenario.
Remember: to accept real payments, you will need to use the ID and secret key of your real store.