Добрый день, не могу понять, почему выскакивает ошибка, прогуглил поискал, ничего не нашёл.
Пытаюсь отправить запрос яндекс кассе:
require __DIR__ . '/lib/autoload.php';
use YandexCheckout\Client;
if(isset($_POST['amount']) && isset($_SESSION['uid'])) {
$amount = $_POST['amount'];
if($amount >= $donate_min) {
$m = "id";
$secret_key1 = "secterkey";
$currency = 'RUB';
$client = new Client();
$client->setAuth($m, $secret_key1);
$response = $client->createPayment(
array(
'amount' => array(
'value' => $amount,
'currency' => $currency,
),
'confirmation' => array(
'type' => 'redirect',
'return_url' => 'https://domen.com/?pay=noti',
),
'payment_method_id' => $sign,
'capture' => true,
'description' => 'Заказ №',
),
uniqid('', true)
);
}
Принять пытаюсь так:
if($_GET['pay'] == 'noti') {
$result = json_decode(json_encode($response), true);
print $result;
}
Ошибка которая появляется:
AH01215: PHP Fatal error: Uncaught exception 'YandexCheckout\\Common\\Exceptions\\BadApiRequestException' with message '\xd0\x94\xd0\xb0\xd0\xbd\xd0\xbd\xd1\x8b\xd0\xb9 payment_method \xd0\xbd\xd0\xb5 \xd1\x81\xd0\xbe\xd1\x85\xd1\x80\xd0\xb0\xd0\xbd\xd1\x91\xd0\xbd. \xd0\x9f\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb4\xd0\xb0\xd0\xb9\xd1\x82\xd0\xb5 \xd0\xb5\xd0\xb3\xd0\xbe \xd1\x81\xd0\xbe \xd0\xb7\xd0\xbd\xd0\xb0\xd1\x87\xd0\xb5\xd0\xbd\xd0\xb8\xd0\xb5\xd0\xbc saved=true. \xd0\xa7\xd1\x82\xd0\xbe\xd0\xb1\xd1\x8b \xd1\x81\xd0\xbe\xd1\x85\xd1\x80\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x82\xd1\x8c \xd0\xbc\xd0\xb5\xd1\x82\xd0\xbe\xd0\xb4 \xd0\xbf\xd1\x80\xd0\xb8 \xd1\x81\xd0\xbe\xd0\xb7\xd0\xb4\xd0\xb0\xd0\xbd\xd0\xb8\xd0\xb8 \xd0\xbf\xd0\xbb\xd0\xb0\xd1\x82\xd0\xb5\xd0\xb6\xd0\xb0, \xd0\xbf\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb4\xd0\xb0\xd0\xb9\xd1\x82\xd0\xb5 save_payment_method=true .Error code: invalid_request.Parameter name: payment_method_id.' in /var/www/barvmsk/data/www/domen.com/engine/lib/Client/BaseClient.php:303, referer: https://domen.com/
Stack trace:, referer: https://domen.com/
#0 /var/www/barvmsk/data/www/domen.com/engine/lib/Client.php(237): YandexCheckout\\Client\\BaseClient->handleError(Object(YandexCheckout\\Common\\ResponseObject)), referer: https://domen.com/
#1 /var/www/barvmsk/data/www/domen.com/engine/payment.php(33): YandexCheckout\\Client->createPayment(Array, '5d31c6c5484242....'), referer: https://domen.com/
#2 /var/www/barvmsk/data/www/domen.com/index.php(18): require('/var/www/barvms...'), referer: https://domen.com/
#3 {main}, referer: https://domen.com/
thrown in /var/www/barvmsk/data/www/domen.com/engine/lib/Client/BaseClient.php on line 303, referer: https://domen.com/