B
B
bigmiruz2020-02-13 14:39:35
PHP
bigmiruz, 2020-02-13 14:39:35

Solve problem with curl request?

There is a merchandising that accepts money from the card. It is necessary that the formation of a link for payment be without kopecks. Examples of links:

With kopecks: https://site.com/pay/?m=2&amount=6000.00&order=175...

It is necessary without kopecks. https://site.com/pay/?m=2&amount=6000.00&order=175...

Sign is generated from merchant_id:amount:order:secretkey hashed by sha256 function

<?php
if (!defined('PAYME')) die('Hacking Attempt!');

$query = $db->query("SELECT * FROM `merchants` WHERE `id` = :id LIMIT 1");
$array = array(
    ':id' => $_GET['m'],
);
$merchant = $query->fetch($array);

$sign_data = array(
    $merchant['id'],
    $_GET['amount'],
    $_GET['order'],
    $merchant['secret'],
);

$sign = hash('sha256',implode($sign_data,":"));


foreach($_GET as $key => $value) {
    $pos = strpos($key, 'xf_');
    if($pos === false) {

    } else {
        $inputs_xf .= '<input type="hidden" name="'.$key.'" value="'.$value.'">';
    }
}

$data_template += array(
    'merchant' => $merchant,
    'sign' => $sign,
    'inputs_xf' => $inputs_xf,
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekssamos, 2020-02-13
@alekssamos

Yes, I told you in the previous question ! Int write in brackets! AND N T! Where? Before the number or before! variable with a number! In your case it will be Try!
(int)5.00

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question