我不确定我收到错误的原因。我在作业提交时创建一个令牌,并将其发布到相关客户的数据库中。完成作业后,我使用数据库中的令牌完成交易。以下是我的交易流程代码。
if(isset($_GET["job"])){
$status = $_GET["status"];
if($_GET["status"] == 1){
$jobq = 'SELECT * from jobsubmission WHERE ID='.$_GET["job"];
$jobres = mysqli_query($conn, $jobq);
$data = mysqli_fetch_object($jobres);
$token = $data->stripetoken;
$bookdetail = 'SELECT driver from booking WHERE job='.$_GET["job"];
$res = mysqli_query($conn, $bookdetail);
$data1 = mysqli_fetch_object($res);
$driver = $data1->driver;
$driverdetail = 'SELECT stripe_account from driverinformation WHERE ID='.$driver;
$res = mysqli_query($conn, $driverdetail);
$data2 = mysqli_fetch_object($res);
$accountid = $data2->stripe_account;
$amount = $data->jobpay*100;
require_once('Stripe/lib/Stripe.php');
Stripe::setApiKey($key);
$charge = Stripe_Charge::create(array(
"amount" => $amount,
"currency" => "usd",
"card" => $token,
"description" => "Charge for the booked job in Swift job"
), array('stripe_account' => $accountid));
if($charge->status == "succeeded"){
$transid = $charge->id;
$jobid = $_POST["job"];
$conn = dbconnection();
$updqry = 'UPDATE booking set paid=1, paiddate='.time().', transactionid="'.$transid.'" WHERE job='.$jobid;
$update = mysqli_query($conn, $updqry);