如何描述Stripe Checkout中的订单项?
这是我创建结帐函数的方式:
foreach($request->arrayOfObjects as $req) {
array_push($lineItems, [
'price' => $req['priceID'],
'quantity' => (int) $req['quantity']
]);
}
if (Auth::check()) {
$charge = $stripeClient->checkout->sessions->create([
'payment_method_types' => [
'card',
'sepa_debit',
'giropay',
'sofort',
'alipay'
],
'success_url' => env('APP_URL').'/success',
'cancel_url' => env('APP_URL').'/cancel',
'shipping_address_collection' => [
'allowed_countries' => ['DE'],
],
'shipping_options' => [
[
'shipping_rate' => $request->lieferung ? env('SHIPPING_RATE_LIEFERUNG') : env('SHIPPING_RATE_ABHOLUNG')
],
],
'line_items' => [$lineItems],
'mode' => 'payment',
'metadata' => [
'lieferung' => $request->lieferung,
'isCustomer' => true
],
'allow_promotion_codes' => true,
'customer' => Auth::user()->stripe_id
]);
}
但是它可以正常工作...但是,我想知道是否可以描述文章的测量值?
例如,我已经订购了10套包装的镶木地板经典,每个包装都有3m2的镶木地板。
我想在法案中看到它,就像:
第1001条 - 镶木地板经典(10倍软件包-3m2)
我发现可以提供元数据,但仅适用于全球结帐级别,而不是每个项目。
有什么办法做到这一点吗?
This is the way how I create checkout function:
foreach($request->arrayOfObjects as $req) {
array_push($lineItems, [
'price' => $req['priceID'],
'quantity' => (int) $req['quantity']
]);
}
if (Auth::check()) {
$charge = $stripeClient->checkout->sessions->create([
'payment_method_types' => [
'card',
'sepa_debit',
'giropay',
'sofort',
'alipay'
],
'success_url' => env('APP_URL').'/success',
'cancel_url' => env('APP_URL').'/cancel',
'shipping_address_collection' => [
'allowed_countries' => ['DE'],
],
'shipping_options' => [
[
'shipping_rate' => $request->lieferung ? env('SHIPPING_RATE_LIEFERUNG') : env('SHIPPING_RATE_ABHOLUNG')
],
],
'line_items' => [$lineItems],
'mode' => 'payment',
'metadata' => [
'lieferung' => $request->lieferung,
'isCustomer' => true
],
'allow_promotion_codes' => true,
'customer' => Auth::user()->stripe_id
]);
}
It works fine though... However, I'd like to know is there way to describe measurements of an article?
For example I have ordered 10 packages of Parquet Flooring Classic and each package has 3m2 of parquet.
I'd like to see it in the bill, like:
Article 1001 - Parquet Flooring Classic (10x Packages - 3m2 each)
I found that metadata could be provided but only for the global checkout level, not per item.
Is there any way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您 can 使用条纹结帐提供每个项目的元数据。这是一个示例:
列表,
在结帐时,它将为您提供整洁的检查 以 Stripe API文档(单击所有可能的键以及它们的用途的'显示儿童属性'按钮。)
You can provide metadata per item using Stripe Checkout. Here's an example:
At checkout, it will give you a neat list of
Check all the information on line_items in The stripe API documentation (click on the 'show child attributes' button for all the possible keys and what they're for.)