gpt4 book ai didi

php - 为什么我收到 Stripe 400 错误 - 无法多次使用 Stripe token ?

转载 作者:行者123 更新时间:2023-11-29 21:28:00 26 4
gpt4 key购买 nike

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

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

关于php - 为什么我收到 Stripe 400 错误 - 无法多次使用 Stripe token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35423242/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com