$(".payBtn").click(function(){
var sumPay = $(".payPrice:checked").data("price");
$.ajax({
url: 'pay.php',
data: {
'price': sumPay
},
success: function(result) {
alert(result)
}
})
})
<?php
use YandexCheckout\Client;
$client = new Client();
$client->setAuth('**', '***');
$payment = $client->createPayment(
array(
'amount' => array(
'value' => $_GET['price'],
'currency' => 'RUB',
),
'confirmation' => array(
'type' => 'redirect',
'return_url' => 'http://kendiz.ru',
),
'capture' => true,
'description' => 'Заказ №1',
),
uniqid('', true)
);
$url = json_decode($payment)->confirmation->confirmation_url;
echo $url;
?>
$payment = array(
'amount' => array(
'value' => $order["total"],
'currency' => $order["currency"],
),
'payment_method_data' => array(
'type' => 'bank_card',
),
'confirmation' => array(
'type' => 'redirect',
'return_url' => $returl,
),
"receipt" => array(
"customer" => array(
"full_name" => $customer["fullname"],
"phone" => preg_replace("/[^0-9]/", "",$customer["phone"]),
"email" => $customer["email"]
),
"email" => $customer["email"],
"items" => $items
),
'capture' => true,
'description' => $order["reason"],
);