Skip to content

Yandex Pay on own checkout page

If you want to accept payments with the Yandex Pay button on your own checkout, follow the steps below:

  1. Register your website in Yandex Pay. Review and adhere to the regulation on forbidden goods and Yandex Pay branding requirements to display the Yandex Pay button correctly.

  2. Choose and implement one of the integration options:

Registration with Yandex Pay

Before you start accepting Yandex Pay payments in production mode, register your website with Yandex Pay and get your business flow confirmed by Yandex.

If your application is successful, Yandex Pay provides you with merchant_id.

Yandex Pay for websites using bePaid library

To accept Yandex Pay payments on your website, you can use the library developed by bePaid. It is compatible with the parameters and properties of the payment widget library.

1. Install the script for connecting the library on your website:

<script type="text/javascript" src="https://js.bepaid.by/widget/yandex_pay.js"></script>

2. Place a frame on the page where the Yandex Pay button should appear:

<div id="yandex-pay-button">
  <div id="yandex-pay" onclick="pay()" class="yandex-pay-button-with-text" lang="en-US"></div>
</div>

3. Add the following JavaScript-code to start Yandex Pay payment processing. Payment requests will be sent automatically:

<script>
var params = {
  checkout_url: 'https://checkout.bepaid.by',
  yandex_pay: {
    yandex_pay_merchant_id: 'Your Merchant ID',
  },
  yandexPayContainerId: 'yandex-pay-button',
  supportedNetworks: ['visa', 'masterCard', 'mir'],
  token: '3241e439f8c87d941d92621a4bdc030d4c9a69c67f3b0cfe12de4a13cc34aa51'
}
const yandexPay = new YandexPay(params);
this.pay = yandexPay.pay;
</script>
Parameter Description
checkout_url https://checkout.bepaid.by
yandex_pay_merchant_id Yandex merchant identifier issued after registration with Yandex Pay.
yandexPayContainerId ID of the container where Yandex Pay button will be appended.
supportedNetworks An array of supported card payment systems. Set to visa, masterCard, mir.
token A payment token. To get a token, make a request described on Payment token page.
public_key * conditionally required
Shop public key. Required if the token parameter is not sent.

Yandex Pay for websites using Yandex Pay Web SDK

You can integrate Yandex Pay on your websites using Yandex Pay API. Follow the steps below:

1. Get the payment method token from Yandex Pay using Yandex Pay Web SDK.

To get a payment processed by bePaid, at Step 2 of the Yandex Pay API Tutorial send the following parameters in the paymentMethods array:

Parameter Description
gateway bePaid's Yandex Pay ID. Set to {psp.yandex_pay.gateway_id}.
gatewayMerchantId Your Shop ID in the bePaid system.

2. Submit a transaction with the encrypted Yandex Pay token.

Request

Send the payment, authorization or charge request, where you should submit the encrypted Yandex Pay token as the value of request.credit_card.token in the format described below.

For recurring payments and payments with the saved card data, get the bePaid payment token by sending the request.additional_data.contract parameter in the payment, authorization or charge requests.

The required format of the encrypted Yandex Pay token sent as the card token

Submit the encrypted Yandex Pay token in requests as the card token in the $begateway_yandex_pay_1_0_0$<base64_PaymentToken_here> format, where:

  • $begateway_yandex_pay_1_0_0$ is the required prefix for the encrypted Yandex Pay token;
  • <base64_PaymentToken_here> is the received Yandex Pay token in the JSON format converted to the Base64 format.
Example of the encrypted Yandex Pay token
{
  "type":"Yandex",
  "signedMessage":"{\"encryptedMessage\":\"3EIGHhaRWlLBY3CQ4+hMWfbiE8vDLy2vwG5VkY5XgILaq5Vjh/MED5XO1w6KwWnQiT3TJDV5rj/ixLHzPjpN4eUwkaQTgwUcFGYSCbwu4paBhuaOlYKvx3UhxlGs+sWfCxlJHawFWlEcX254u/4yc45CnIAmaJLGR7RLvAX66VOiCO/GpeqPZXpctRzj068TThESmRKv/2Vb9S54CRID1Z0+QIamZIwoKhkEt99F0EXwnfKdlzakpL+N4i99X3EkavQA2Im3lFJ6C9MvIKqahnNF9E89MIAigsnYZ+/Zu7QvtfAe1mVbLDMGJRFqk7NYF0Q/XXrwajJCMFcCvTNkSXh0WmyWI7Fa9r1+EydJmaou1XTo/RUvvbfJ3l7asepcvFcs7wcKUgi9wWGKe9td0ny4EqzVi++hm/ZiJhcSknQBwsNBSHOy7aJZVoxI5DUL7gEV7X3KAS0Q\",\"tag\":\"nPCkBdXgdvb+VhTSM5Rc9QdvEpPFd1mNtSyE0cWCuZU=\",\"ephemeralPublicKey\":\"BFig2qqGHsX/LA6GrFbHcG83eLjTAiBkTTkJe5lki37WMMZUJjfT8tTLOd+vhRmkIru4hcMRfpxfER13WIhNayE=\"}",
  "protocolVersion":"ECv2",
  "signature":"MEUCIQDOBSSB1yFm3E9gM1kTp3CHMkhHM1g4dsYKo9/TXiEhmwIgSMCp2t1tCorBjhGw1k9Ev9tw4IyKVUrMAbJnfAg0Ng0=",
  "intermediateSigningKey":{
      "signedKey":"{\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqYNePt6BPgCv5JxfO9dF2vrSqmnp4Mhe/vF+XO+Devbs6/KVpVVoTD8LLcAo4TZh6IuODVnVpHrTObhg3HJVJA==\",\"keyExpiration\":\"1764950892000\"}",
      "signatures":[
        "MEQCIDRslMW7wNZbpqVw/dD7hDQh30hGhqfjfWTBvc7zAYJSAiAGAvjAslA2AxwdAEuOfacFr6DaE5yiiUuUtM6DUreZYg=="
      ]
  }
}
Example of the payment request with the encrypted Yandex Pay token
{
  "request": {
    "amount": 100,
    "currency": "RUB",
    "description": "Yandex Pay test transaction",
    "tracking_id": "Your unique ID",
    "credit_card": {
      "token": "$begateway_yandex_pay_1_0_0$eyJ0eXBlIjoiWWFuZGV4Iiwic2lnbmVkTWVzc2FnZSI6IntcImVuY3J5cHRlZE1lc3NhZ2VcIjpcInExNHBnMzNWQlV6NW9WTE1vN2R6WVFHcDNRb2h3MGY5dWtqN0dOV2w4VXVZL2hwQ0cwaDUxOHVPVjBCSzJ6TXJEZDI2YXR5TFJReWtMeWdyZ2tIWS80SXJhSWFTV29wYVN1a0h5dkJhZ3RSdENqbWwvSXJJK2dhdVNwSXRnL3ZWY2FXdkJLcnhzbzlaQkd5SWlqeGI0TzRwUGtna3BEc1g3NTZuSjVGTlAxelhKNnFLSUFWemtxb1JHWS9aOVBXZ2Ryd3IvMjdyWi9iRzNCT2RIOUtKVFpkNDV5MVhlWEhaYWZ4K3lzSjhsclVEUlpsWmFwZUlSYTNLbDZ2ekhiTkpRak42RjNJWkYxL2g5Q3FwcFQ5VDJ1VWpVb29PQ1hERVVmMUZjNTc0SHJ3eW82SDBTaWpFQnRocHluUWxMai80cUdlSjFudWlpYTR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icHFWdy9kRDdoRFFoMzBoR2hxZmpmV1RCdmM3ekFZSlNBaUFHQXZqQXNsQTJBeHdkQUV1T2ZhY0ZyNkRhRTV5aWlVdVV0TTZEVXJlWllnPT0iXX19"
    }
  }
}
Response

The response to the payment request with Yandex Pay token will be returned with transaction processing statuses. It fully matches the responses to payment or authorization requests.