问题描述
我正在将flutterwave与mpesa集成在一起,每次付款时,flutterwave都会卡在加载页面上,并且该站点不会重定向到结果url。即使付款成功,也会发生这种情况,因此我没有机会将付款信息正确存储到我的数据库中。这是代码:
$curl = curl_init();
$customer_email = "myemail@gmail.com";
$PBFPubKey = "mykey"; // get your public key from the dashboard.
$redirect_url = "https://example.com/redirect_url.PHP";
curl_setopt_array($curl,array(
CURLOPT_URL => "https://api.ravepay.co/flwv3-pug/getpaidx/api/v2/hosted/pay",CURLOPT_RETURNTRANSFER => true,CURLOPT_CUSTomrEQUEST => "POST",CURLOPT_POSTFIELDS => json_encode([
'amount' => $amount,'customer_email' => $customer_email,'currency' => $currencyCode,'txref' => $txref,'PBFPubKey' => $PBFPubKey,'redirect_url' => $redirect_url
]),CURLOPT_HTTPHEADER => [
"content-type: application/json","cache-control: no-cache"
],));
$responseCurl = curl_exec($curl);
$err = curl_error($curl);
if ($err) {
// there was an error contacting the rave API
die('Curl returned error: ' . $err);
}
$transaction = json_decode($responseCurl);
if (!$transaction->data && !$transaction->data->link) {
// there was an error from the API
print_r('API returned error: ' . $transaction->message);
}
header('Location: ' . $transaction->data->link);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)