admin管理员组文章数量:1291643
I would like to offer 3 products for Subscription and allow the customer to choose one.
Below is the PHP code to create the checkout session.
$result = $stripe->checkout->sessions->create([
'mode' => 'subscription',
'line_items' => [
[
'price' => 'price_ddd',
'quantity' => 1,
],
[
'price' => 'price_eee',
'quantity' => 1,
],
[
'price' => 'price_fff',
'quantity' => 1,
],
],
'customer_email' => $useremail,
'subscription_data' => ['trial_period_days' => 14, 'trial_settings' => ['end_behavior' => ['missing_payment_method' => 'cancel']],],
'ui_mode' => 'embedded',
'payment_method_collection' => 'if_required',
'return_url' => site_url("billing/callback") . "?session_id={CHECKOUT_SESSION_ID}"
]);
The checkout page shows like this:
I need the customer to choose the product from the 3 products. It doest not offer the option choose. It only shows the 3 products.
How to allow it to choose the product?
I would like to offer 3 products for Subscription and allow the customer to choose one.
Below is the PHP code to create the checkout session.
$result = $stripe->checkout->sessions->create([
'mode' => 'subscription',
'line_items' => [
[
'price' => 'price_ddd',
'quantity' => 1,
],
[
'price' => 'price_eee',
'quantity' => 1,
],
[
'price' => 'price_fff',
'quantity' => 1,
],
],
'customer_email' => $useremail,
'subscription_data' => ['trial_period_days' => 14, 'trial_settings' => ['end_behavior' => ['missing_payment_method' => 'cancel']],],
'ui_mode' => 'embedded',
'payment_method_collection' => 'if_required',
'return_url' => site_url("billing/callback") . "?session_id={CHECKOUT_SESSION_ID}"
]);
The checkout page shows like this:
I need the customer to choose the product from the 3 products. It doest not offer the option choose. It only shows the 3 products.
How to allow it to choose the product?
Share Improve this question edited Feb 13 at 14:35 DarkBee 15.6k8 gold badges72 silver badges116 bronze badges asked Feb 13 at 14:17 arun kumararun kumar 7372 gold badges15 silver badges38 bronze badges1 Answer
Reset to default 1The Checkout payment page does not support 'cart' functionality, where customers can choose which items to purchase. All Price objects passed to the line_items
parameter on session creation are considered a part of the payment
If you want a pre-built UI component that offers plan selection, I'd recommend looking at the pricing table which utilises Checkout for payment.
本文标签: phpChoose a product from 3 products with trialStack Overflow
版权声明:本文标题:php - Choose a product from 3 products with trial - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741535555a2384004.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论