You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.7 KiB
2.7 KiB
The YooKassa API PHP Client Library
Russian | English
This product is used for managing payments under The YooKassa API For usage by those who implemented YooKassa using the API method.
Requirements
PHP 5.3.2 (or later version) with the libcurl library
Installation
Under console using Composer
- Install Composer, a package manager.
- In the console, run the following command:
composer require yoomoney/yookassa-sdk-php
Do the following for the composer.json file of your project:
- Add a string
"yoomoney/yookassa-sdk-php": "^2.0"
to the list of dependencies of your project in the composer.json file
...
"require": {
"php": ">=5.3.2",
"yoomoney/yookassa-sdk-php": "^2.0"
...
- Refresh the project's dependencies. In the console, navigate to the catalog with composer.json and run the following command:
composer update
- Adjust your project's code to activate automated uploading of files for our product:
require __DIR__ . '/vendor/autoload.php';
Manually
- Download the YooKassa API PHP Client Library archive, extract it and copy the lib catalog to the required place of your project.
- Adjust your project's code to activate automated uploading of files for our product:
require __DIR__ . '/lib/autoload.php';
Commencing work
- Import required classes
use YooKassa\Client;
- Create a sample of a client object, then set the store's identifier and secret key (you can get them under your YooKassa's Merchant Profile). Issuing a secret key
$client = new Client();
$client->setAuth('shopId', 'secretKey');
- Call the required API method. More details in our documentation for the YooKassa API