add receipt

This commit is contained in:
Andrey Kuvshinov
2021-12-25 15:15:59 +00:00
parent c5ae43e87f
commit f1115f428b

View File

@@ -13,6 +13,7 @@ function anpay_kuri($order_id){
`buy_id`, `buy_id`,
`buy_status`, `buy_status`,
`pricename`, `pricename`,
`buy_email`,
`anbuy`.`price` as `currprice` `anbuy`.`price` as `currprice`
FROM FROM
`anbuy` `anbuy`
@@ -43,7 +44,7 @@ function anpay_kuri($order_id){
$return_url = SITE.'status/'.$buy_id['buy_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'])){ if (isset($payment['confirmation']['confirmation_url'])){
$pay_url = $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 == '') if ($return_url == '')
$return_url = SITE; $return_url = SITE;
@@ -153,15 +154,32 @@ function resultpay_kuri(){
$items = array( $items = array(
'amount' => array( 'amount' => array(
'value' => $price, 'value' => $buy['currprice'],
'currency' => 'RUB', 'currency' => 'RUB',
), ),
'confirmation' => array( 'confirmation' => array(
'type' => 'redirect', 'type' => 'redirect',
'return_url' => $return_url, '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, 'capture' => true,
'description' => $name, 'description' => $buy['pricename'],
); );
$id = uniqid('', true); $id = uniqid('', true);