#Yashish
1 messages · Page 1 of 1 (latest)
Stripe does not guarantee delivery of events in the order in which they are generated.
https://stripe.com/docs/webhooks/best-practices#event-ordering
i want to ask the customer in stripes are created by looking which detail
1 the email used during the payment
2 cards used during payment
3 name on the card used during the payment
if i do again the transaction with same detail then a new customer will be created or not
if not then what details does the stripe look for when creating the customer
if i do again the transaction with same detail then a new customer will be created or not
Yes, a new customer with the same details will be created
so on every transaction a new customer is created
whether it is for subscription buy or renewal of the subscription or update the subscription plan
Wait, what you mean by "transaction"?
No. only wen creating a new customer using the API:
https://stripe.com/docs/api/customers/create
What is the issue you are facing exactly here ?
then what about this
That's not clear sorry, could you please provide an example of what you are trying to achieve ?
1.in stripe, the first time when I buy a subscription plan at that time a new user is created ?
- when a customer tries to update its subscription plan at that time a new customer is created ?
if the customer are created then on what bases they are being created
1 the email used during the payment
2 cards used during payment
3 name on the card used during the payment
1.in stripe, the first time when I buy a subscription plan at that time a new user is created ?
How are you creating a Subscription ? please share more details.
- when a customer tries to update its subscription plan at that time a new customer is created ?
Nope.
i am working in python
first creating the plan
plan = stripe.Plan.create( amount=50000, currency='usd', interval='month', product={ 'name': 'Test advance plan' }, nickname='test product advance', metadata={'plan_id':"test_advance_id"} )
then through the plan user can buy the subscription
plan = stripe.Plan.retrieve(subscription_plan.stripe_plan_id) stripe_session = stripe.checkout.Session.create( success_url=domain + '/payments/stripe-success?session_id={CHECKOUT_SESSION_ID}', cancel_url=domain + '/payments/stripe-failed/', mode='subscription', line_items=[{ 'price': plan.id, 'quantity': 1, }], customer_email=user_id.email, # customer_email='the_just_email@gmail.com', metadata={'user_id': (request.user).id, 'plan_id': subscription_plan.id, 'plan_name': subscription_plan.plan_name }, )
To make sure that there is no duplicate customers created:
You can updates the Checkout Creation request by adding customer_creation: if_required:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer_creation
And if the customer exists in Stripe, you pass that Customer Id when creating the Checkout session and not the customer_email:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer
still unable to get the clear idea
What part exactly ?
i will need to look further in it
can you tell how can i create a plan for 4 month interval?
plan = stripe.Plan.create( amount=self.plan_price, currency='usd', interval='month', product={ 'name': 'Test advance plan' }, nickname='test product advance', metadata={'plan_id':"test_advance_id"} )
or
plan = stripe.Plan.create( amount=self.plan_price, currency='usd', interval='month', interval_count=4, product={ 'name': 'Test advance plan' }, nickname='test product advance', metadata={'plan_id':"test_advance_id"} )
Between, you should be using prices instead of Plans. Plans are deprecated.
BY setting interval_count
but i want to create a subscription plan
You can use prices with subscriptions.
I invite you to follow our recommended integration for Subscriptions:
https://stripe.com/docs/billing/subscriptions/build-subscriptions
here it is mentioned that
notify your customer and send them to the customer portal to update their payment method.
how can we do this?
You can follow this guide in order to understand integrating customer portal:
https://stripe.com/docs/customer-management
in customer portal can we handle it through success and fail urls
or we need to do it with the webhook call
what you mean by success and fail urls?
plan = stripe.Plan.retrieve(subscription_plan.stripe_plan_id)
stripe_session = stripe.checkout.Session.create(
success_url=domain + '/payments/stripe-success?session_id={CHECKOUT_SESSION_ID}',
cancel_url=domain + '/payments/stripe-failed/',
mode='subscription',
line_items=[{
'price': plan.id,
'quantity': 1,
}],
customer_email=user_id.email,
# customer_email='the_just_email@gmail.com',
metadata={'user_id': (request.user).id,
'plan_id': subscription_plan.id,
'plan_name': subscription_plan.plan_name
},
)
like this
When using Customer Portal, you can just set a return url, there isn't success or failure urls.
Here are all the supported attributs:
https://stripe.com/docs/api/customer_portal/sessions/create
Request req_RM4ipnLGDSHj7h: You can’t create a portal session in test mode until you save your customer portal settings in test mode at https://dashboard.stripe.com/test/settings/billing/portal.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yes complete your portal setting first.
Hi there 👋 jumping in as my teammate needs to step away soon. It does look like you will need to configure your customer portal settings before you can create a portal session, please let me know if that error persists after you've done so.
what to configure
The settings for the Customer Portal, those settings can be found in your dashboard via the URL provided in the error message.