From f1115f428bf6647a81e35b7cf38d8de2d4846fc0 Mon Sep 17 00:00:00 2001 From: Andrey Kuvshinov Date: Sat, 25 Dec 2021 15:15:59 +0000 Subject: [PATCH] add receipt --- app/routes/anpay.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/app/routes/anpay.php b/app/routes/anpay.php index a3cb695..803f961 100644 --- a/app/routes/anpay.php +++ b/app/routes/anpay.php @@ -13,6 +13,7 @@ function anpay_kuri($order_id){ `buy_id`, `buy_status`, `pricename`, + `buy_email`, `anbuy`.`price` as `currprice` FROM `anbuy` @@ -43,7 +44,7 @@ function anpay_kuri($order_id){ $return_url = SITE.'status/'.$buy_id['buy_id']; # получить ссылку на оплату - $payment = yk_pay($buy_id['currprice'], $buy_id['pricename'], $return_url); + $payment = yk_pay($buy_id, $return_url); if (isset($payment['confirmation']['confirmation_url'])){ $pay_url = $payment['confirmation']['confirmation_url']; @@ -142,7 +143,7 @@ function resultpay_kuri(){ } - function yk_pay($price, $name, $return_url = ''){ + function yk_pay($buy, $return_url = ''){ if ($return_url == '') $return_url = SITE; @@ -153,15 +154,32 @@ function resultpay_kuri(){ $items = array( 'amount' => array( - 'value' => $price, + 'value' => $buy['currprice'], 'currency' => 'RUB', ), 'confirmation' => array( 'type' => 'redirect', 'return_url' => $return_url, ), + "receipt" => array( + "customer" => array( + "email" => $buy['buy_email'], + ), + "items" => array( + array( + "description" => $buy['pricename'], + "quantity" => "1.00", + "amount" => array( + "value" => $buy['currprice'], + "currency" => "RUB" + ), + "payment_mode" => "full_prepayment", + "payment_subject" => "commodity" + ) + ) + ), 'capture' => true, - 'description' => $name, + 'description' => $buy['pricename'], ); $id = uniqid('', true);