多个产品(购物车)条纹 API

Multiple products (shopping cart) stripe API

我希望在使用条纹充电时能够逐项列出多个产品API。这样自动发出的收据将列出每个产品。我不想只收取购物车总金额和一般描述。

我如何在下面的费用中添加带有描述 'tie' 的 5 美元领带。

$charge = \Stripe\Charge::create(array(
    "amount" => 1100,
    "currency" => "usd",
    "source" => $_POST['stripeToken'],
    'receipt_email' => $email,
    "description" => 'shirt'))

这不是 Stripe 今天支持的东西。当您通过API创建一次性收费时,您只能通过总金额进行收费。

另一种选择是使用订单 API. This lets you define Products in your account and then create an Order that lists all the products being bought. The limitation though is that email receipts still won't display the list of items and you would have to use a third-party application

我准备购物车 collection 作为

<?php 

$purchased='';


for($i=0;$i<count($POST['items']);$i++){

    $purchased.=( "=> item id : ".$POST['items'][$i]." unit price  ".$POST['price'][$i]." qnt ".$POST['qnt'][$i]." ;");
}

?>

然后将其传递给条纹描述

<?php 


$charge=\Stripe\Charge::create(array(
"amount"=>$total_fee*100,
    "currency"=>"usd",
    "description"=>$purchased,// the trick
    "customer"=>$customer->id
));
?>

这对我来说很好,但我们需要更多