Hello, I have a problem
The client adds money to my site and buys services
There is a problem that I hope to find a solution to
After successful payment, the money is not credited to the customer in his account
This code
$amount = (double)$amount;
$insert = $conn->prepare("INSERT INTO payments SET client_id=:c_id, payment_amount=:amount, payment_privatecode=:code, payment_method=:method, payment_mode=:mode, payment_create_date=:date, payment_ip=:ip, payment_extra=:extra");
$insert->execute(array("c_id" => $user['client_id'], "amount" => $amount, "code" => $paymentCode, "method" => $method_id, "mode" => "", "date" => date("Y.m.d H:i:s"), "ip" => GetIP(), "extra" => $paymentCode));
$success = 1;
$successText = "Your payment was initiated successfully, you are being redirected..";
$data = [
"redirect_url"=> "https://webhook.site/8c16529b-dab9-4a62-af0e-ea759d1f7abf",
"business_name" => "Dknar",
"customer_email" => $user['email'],
"customer_name" => $user['client_id'].','.$paymentCode.','.$method_id.','.$paymentCode,
"local_price" => [
"amount" => $amount,
"currency" => "USD"
],
"memo" => "Balance recharge - ". $user['email']
];
$fields_string = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.commerce.coinbase.com/invoices');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'X-Cc-Api-Key: '.$extra['api_key'];
$headers[] = 'X-Cc-Version: 2018-03-22';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);
//echo $result;
$result=json_decode($result);
header('location:'.$result->data->hosted_url);
exit;
Sorry, but I don’t understand programming very well