#mathan
1 messages · Page 1 of 1 (latest)
Hi there, you should create a graduated price first (https://stripe.com/docs/products-prices/pricing-models#graduated-pricing), and pass the price ID to the line_items when creating a subscription mode CheckoutSession
let me check
this errors comes when i using following code **You specified payment mode but passed a recurring price. Either switch to subscription mode or use only one-time prices.
**
$stripe->checkout->sessions->create(
[
'cancel_url' => 'http://127.0.0.1:8000/',
'line_items' => [['price' => 'plan_N7OtH9opxAc149']],
'mode' => 'payment',
'success_url' => 'http://127.0.0.1:8000/',
]
);
You need to set mode to subscription as the error message suggests
'mode' => 'subscription',
when checkout it creates new customers with a price. in this scenario I need to set -> the existing customer can go to this checkout page and subscribe to the plan.?
Then you need to specify a customer when creating a checkout session
Is any examples for this?
$stripe->checkout->sessions->create(
[
'cancel_url' => 'http://127.0.0.1:8000/',
'line_items' => [['price' => 'plan_N7OtH9opxAc149']],
'mode' => 'payment',
'success_url' => 'http://127.0.0.1:8000/',
'customer' => 'YOUR_CUSTOMER_ID',
]
);
its add the another price, i want to update the subscription by this checkout!
Do you mean you want the customer to manage the susbcription?
Checkout is not built for this purpose, but you can use customer billing portal instead https://stripe.com/docs/customer-management
👋 Taking over this thread, catching up now
Checkout page is for the subscription/payment that the customers have selected the price/plan to purchase
its also foe usage based right
if customer purchase the plan by checkout, after the cycle ends(30days) then they need to pay the amount via customer portal right?
No, an invoice will be sent to customer after the cycle ends, or the payment will be charged to customer's card if the subscription is set to charge_automatically. Customer portal is simply for customer to manage their subscription plan (such as upgrade/downgrade the plan), update payment details... etc
let me check
where i can manage checkout page in stripe dashboard?
What do you want to manage for Checkout Session specifically?
like this https://checkout.stripe.dev/configure
Preview some of the features available in our prebuilt, hosted payment page.
I see! You can customise Checkout in https://dashboard.stripe.com/settings/checkout
i saw it
but i f upgrade one plan using checkout mail also updated i dont want to update email!!
Sorry, I don't understand what you meant. A plan can't be upgraded using Checkout. Checkout can only create a subscription, but not upgrading existing subscription.
okay, but ist update the email also?
What do you mean by updating the email? What is updating email for?
in checkout page there is input for email!
If customer is set during Checkout Session creation, customer won't be able to update the email address
but i update that email
$session = $stripe->checkout->sessions->create(
[
'cancel_url' => 'http://127.0.0.1:8000/',
'line_items' => [['price' => 'plan_N7OtH9opxAc149']],
'mode' => 'subscription',
'success_url' => 'http://127.0.0.1:8000/',
'customer' => 'cus_N9zsdpwJk74sQY',
]
);
this is my code
but i update that email
Do you mean that the Checkout Session page you created allow you to update the email? If so, could you share the Checkout Session ID (cs_xxx), so that I can have a look?
Thanks for sharing. I can see that you created the customer without email: https://dashboard.stripe.com/test/logs/req_P56RGX1VxjTSwE
In this case, email address will be updated in Checkout since it's not set in the first place.
oookk now i understand