Integration with Yandex Pay over API

You can use two methods to integrate with Yandex Pay:

Integrating by adding a button

In this integration, to install a Yandex Pay button and widget, you need to implement the Merchant API's /order/render and /order/create methods on the backend, and integrate them into the merchant's frontend. It also enables you to extend your integration to support Yandex Pay Checkout. To implement this integration, follow the instructions for adding a Yandex Pay button.

Demo:

For more examples with the button or widget, see the Web SDK documentation.

The following sequence of steps is provided for paying (and also creating a new order for Yandex Pay Checkout):

  1. The buyer clicks the Yandex Pay button. The merchant uses the SDK on the frontend to specify the order ID or items in the cart in case of Yandex Pay Checkout.
  2. Based on the order ID or items in the cart, Yandex Pay gets the information about the order and products using order/render.
  3. Based on the merchant's data and the user's personal data, Yandex Pay shows the payment form or checkout form.
  4. The buyer selects the payment method and delivery option (if needed) and initiates payment.
  5. Yandex Pay requests the permission to pay for the order by calling /order/create.
  6. The merchant checks the order details, reserves the items, and authorizes the payment.
  7. Yandex Pay sends the payment through the merchant's payment gateway or Split.
  8. Yandex Pay notifies the merchant about the payment status using the /webhook call, if the Callback URL has been set up.

Before paying, the buyer can update the form: change the delivery address, or apply a discount coupon. After each change, the Yandex Pay backend will repeat the steps 2-3.

ShopperShopperMerchant FrontMerchant FrontMerchant BackendMerchant BackendYandex Pay BackendYandex Pay BackendYandex Pay FormYandex Pay FormPSPPSP1. Click on the Yandex Pay buttonCart or Order ID2. POST/order/renderPrices and delivery options3. Yandex Pay form data4. Click Pay button5. POST/order/create6. Approve payment7. Payment via PSP or Yandex Split8. Webhook with status

This integration model is simple, but it can only be used to paying for orders. Use it when you want to quickly add a payment method to your site. For this kind of integration, follow the instructions with link generation.

Demo:

The order is paid in the following sequence:

  1. The user selects a Yandex Pay payment method and proceeds to the payment page. The interface for selecting a payment method is implemented by the Merchant according to the branding rules.
  2. The merchant's backend receives a link to the payment form using the /orders request sent to the Yandex Pay API.
  3. The merchant's frontend redirects the user to the Yandex Pay payment form.
  4. The user proceeds to the Yandex Pay payment form that renders the cart and payment amount.
  5. The user clicks Buy.
  6. Yandex Pay sends the payment through the merchant's payment gateway or Split.
  7. Yandex Pay notifies the merchant about the payment status using the /webhook call, if the Callback URL has been set up.

ShopperShopperMerchant frontendMerchant frontendMerchant backendMerchant backendYandex Pay backendYandex Pay backendYandex Pay formYandex Pay formPSPPSP1. Click on the Yandex Pay button2. POST/ordersCart or Order IDpaymentUrlpaymentUrl3. Redirectto paymentUrl4. Load Yandex Pay formLoad Order5. Click Pay button6. Payment via PSP or Yandex Split7. Webhook with status

Managing orders

The merchant can manage the order using the Yandex Pay API and console: confirm and cancel payments, make a refund, etc.

What's next

To set up two-step payments, read the instructions. To generate receipts for the Federal Taxation Service in Yandex Pay, you need to transmit the receipt data along with the cart.