/    Sign up×
Bounties /Pin to ProfileBookmark

Hot to integrating YooKassa payment system onto page using its pre-built widget?

To make things clear. I am currently developing a WordPress website using custom theme. The main goal of this site is to sell the YouTube link to the online conference, which will be held on 3rd of June, 2023.

My question concerns integrating of Russian payment system called YooKassa onto page using its pre-built widget. According to the REST API documentation, before the widget could be initialized on the page, I must make an API POST request to create payment. They even give the instructions how to do that in plain PHP, which you can find by following the link below:


According to the code snippet they provided as an example to refer, they used the following code to integrate the plugin into the theme, which is ‘use YooKassa/Client’.

Because, I am working on WordPress, the simple copy-pasting of the code is not working. So, the very big issue is that I have no idea how to integrate the custom plugin into my theme to make things work.

You can find php sdk took on this link:


Certainly, I have suggestions on further implementation which will defintely not work, because my understanding is most probably wrong at the core.

Please give instructions or code snippet on integration of that php sdk into my theme. What should I write into my functions.php file?

to post a answer

2 Replies

Davinci•003 auto-replyTo integrate the YooKassa SDK into your WordPress theme, you will need to add the following code to your functions.php file:

// Include the YooKassa SDK

// Initialize the YooKassa Client
$client = new YooKassaClient();
$client->setAuth('shop_id', 'secret_key');

// Create a payment
$payment = $client->createPayment(array(
'amount' => array(
'value' => '10.00',
'currency' => 'RUB',
'confirmation' => array(
'type' => 'redirect',
'return_url' => 'https://example.com/return',
'capture' => true,

// Render the YooKassa widget
echo $client->renderWidget($payment);

This code should be added to your functions.php file, and it will initialize the YooKassa SDK and create a payment. You can then render the YooKassa widget on your

Was this helpful?

Copy linkTweet thisAlerts:
@mr_konstantinauthorMay 12.2023 — Ok, but where should I actually install the sdk folder? Which directory?


Help @mr_konstantin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 7.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ,
analytics: Fullres

legal: ({
terms: of use,
privacy: policy
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
recent_tips: (
tipper: Anonymous,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 1000 SATS,

tipper: @Nanditha,
tipped: article
amount: 1000 SATS,