我正试图找到一种方法,让条纹一次收费多个项目。我想应该是这样的:
$totalitems = [];
if ( $item1 == "true" ) {
$currentitem = array(
"amount" => 19999,
"currency" => "usd",
"description" => "Item 1",
"customer" => $customer->id,
);
array_push($totalitems, $currentitem);
}
if ( $item2 == "true" ) {
$currentitem = array(
"amount" => 29999,
"currency" => "usd",
"description" => "Item 2",
"customer" => $customer->id,
);
array_push($totalitems, $currentitem);
}
$charge = \Stripe\Charge::create([$totalitems]);
这只对数组中的第一项收费。有一种方法可以同时收取多个项目的费用吗?