我不确定为什么会收到错误消息。我在提交工作后创建一个令牌,并将其发布到相关客户的数据库中。作业完成后,我使用数据库中的令牌完成交易。以下是我的交易过程代码。

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);

最佳答案

Stripe收费ID旨在立即捕获收费(从创建之日起最多5分钟)。如果要稍后捕获费用,则应将费用ID附加到Customer对象(即shown here)。

10-04 10:34