#bugkiller.
1 messages ยท Page 1 of 1 (latest)
Can you please help me to figure out the issue
Have you checked your logs in the Stripe Dashboard?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I'm not sure what you're askign
month ago, we migrated stripe payment (popup style) into stripe checkout session
we have ui user to be able to add their card
once user clicks the add card, we're doing this api call in backend and redirect them to stripe
so user did it, and then user now have payment sourse
Just to preface this, I'm just another Stripe user. ๐
I'm suggesting that you could review the logs to understand why the subscription wasn't created.
once user click subscribe button after that, we're trying to mkae subscription with. stripe.Subscription.create
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Can you please check this?
Stripe does a really great job capturing all sorts of logs for the various lifecycle steps and reviewing the logs is a great first step. Since I'm just another Stripe customer, like you, I won't be able to check specific resources you link to, but you might check the logs yourself in the meantime.
๐ Let me take a look
in the prev, once I give id, they checked it to find a reason
I can see this message , but not sure where user needs to do it.
we're creating subscription inside backend when user clciks button in frontend (because user already added payment source by this api)
session = stripe.checkout.Session.create(
payment_method_types=['card'],
mode='setup',
customer=stripe_customer.id,
# setup_intent_data={
# },
success_url=os.getenv('BACKEND_HOST') + '/api/execute-add-card-stripe-session/?session_id={CHECKOUT_SESSION_ID}',
cancel_url=os.getenv('BACKEND_HOST') + '/api/cancel-add-card-stripe-session/'
It sounds like you're on the right track.
Some payment cards require 3D Secure validation as an added form of confirmation of the payment. For a normal credit card, you just get the result immediately. But some cards require 3D Secure validation where the customer is redirected to the card issuer's site for validation before it redirects to you.
Did the customer mention anything about that?
no, when it will be redirected to the card issue?
how can I make user to be redirected to the card issuer`s site if needed
I when user add card , no any issue
session = stripe.checkout.Session.create(
payment_method_types=['card'],
mode='setup',
customer=stripe_customer.id,
# setup_intent_data={
# },
success_url=os.getenv('BACKEND_HOST') + '/api/execute-add-card-stripe-session/?session_id={CHECKOUT_SESSION_ID}',
cancel_url=os.getenv('BACKEND_HOST') + '/api/cancel-add-card-stripe-session/'```
once I try to create subscrption in backend it didn't complete
so I'm not sure what I need to do
I appreciate you trying to help @crude geyser ๐
I'm juggling in between a few threads so I'll remove you so that I can help @stuck coral when I get bandwidth, it would be difficult for me to maintain context otherwise
So it seems like the creation request failed as customer did not complete 3DS
You have a couple of options here
Depending on how/where you want to handle the 3DS flow,
You can either bring back your customer to your own site & use Stripe.js to handle 3DS completion for the PaymentIntent in requires_action status
https://stripe.com/docs/js/payment_intents/handle_next_action
OR
You can email your customers a stripe hosted invoice link where they can complete the required action
https://dashboard.stripe.com/settings/billing/automatic
I'm creating subscription by
stripe.Subscription.create
how can I know if there's a required action or not
The subscription will have a latest_invoice property with the ID of the current invoice, that Invoice will have a payment_intent property and that PaymentIntent status is what you want to check to see if the status is requires_action
If you are talking about webhook events, you can listen for the invoice.payment_action_required event https://stripe.com/docs/api/events/types#event_types-invoice.payment_action_required
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
how can I simulate this 3ds required testing in my local
Can you please leave this chat to be opened ?
I want to test quickly and be back asap
which one is best for my test then?
I guess 2nd one
Yeah second one is usually the one to use with subscriptions. It will cause 3DS requests on each renewal
is there any way user to complete 3ds when he setup 'adding card'?
not at point creating subscription
Not sure what you mean. Can you explain what you want to test a bit more?
what user is doing first i
is
session = stripe.checkout.Session.create(
payment_method_types=['card'],
mode='setup',
customer=stripe_customer.id,
# setup_intent_data={
# },
success_url=os.getenv('BACKEND_HOST') + '/api/execute-add-card-stripe-session/?session_id={CHECKOUT_SESSION_ID}',
cancel_url=os.getenv('BACKEND_HOST') + '/api/cancel-add-card-stripe-session/'
)
adding card
so can I make user to complete 3ds at this stage ?
If you use that 3184 card, it will ask them to complete 3DS on setup and on every subsequent payment that uses that card
I can see this.
but user shared video and when user trying to add card, it didn't ask 3ds
Was this for a live payment?
my test is local
but user's reported failure on live payment
we simply migrated to new stripe checkout session, so no any code to handle 3ds case exactly
I thought it will be handled by stripe so no action is needed from me
but now, it looks like I need to do something for it
Whether 3DS is requested or not is ultimately up to the bank so this may be a case of the bank not requesting 3DS. You can talk to our support team to look in to that specific transaction if you have the ID of their live payment.
https://support.stripe.com/?contact=true
If 3DS is working for your test flow with that 3184 card, it should be able to handle 3DS for your live payments. So this may be something with the specific live transaction but definitely test your integration thoroughly with those test cards
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
3184, doesn't work
adding card, it works, create checkout session for mode='setup', and redirect to the strpie, and then stripe is displaying 3ds popup there. so good
but once user click 'subscribe' button our our fronend, we're doing stripe.subscription.create, and it failed due to 3ds
for now, we're doing like
s = stripe.Subscription.create(..)
if s status is active status then compled page in frontend
if not, check card warning modal
It means, if user needs exatra action, we're not handling it
so wanted to know what's teh best way to handle it
after creating subscription with stripe.Subscription.create(), I need to check invoice by retreiving it by calling another stripe api (get invoice), and need to check if addtional. action needed or not?
Can you send me the ID of the request where you got an error when trying to make a subscription like that? (req_1234)
https://dashboard.stripe.com/test/logs
You may need to set the payment_behavior to one of the settings that lets subscriptions be created even if the first payment cannot be completed immediately https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_behavior
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
To the hosted invoice page? Yes similar to before, your subscription will have the newest invoice ID as its latest_invoice parameter, that Invoice object will have a hosted_invoice_url parameter that you can direct your users to https://stripe.com/docs/api/invoices/object#invoice_object-hosted_invoice_url
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so subscription object will have latest_invoice, and from it, I need to get invoice object ?
I'm asking this to know if there's way to get latest_invoice as object not key value
You can also use expansion to get the full object back along with the subscription https://stripe.com/docs/api/expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
when creating subscription (like expanding result)
Yeah if you expand latest_invoice the API will return the full Invoice object as the Subscription's latest_invoice property
sorry for my dummy questions
so I can use expand on this api call ? stripe.Subscription.create
No worries, happy to help. And yes, the expand parameter is a parameter on all of our API calls basically
stripe.Subscription.create(...., expand=['latest_invoice'])
this is correct syntax then?
Yep, should be
so hosted_invoice_url will be there even if subscription succeed?
if I make user redirect to hosted_invoice_url, how user will be back to our website
?
I mean, if I make user to be redirected to the hosted_invoice_url, then how user will be back to our website after completing it
Hosted invoice won't redirect back to your site as far as I know unfortunately. To make sure they stay/end up on your site, you can display the 3DS modal right on your page https://stripe.com/docs/payments/3d-secure#when-to-use-3d-secure
how to display it?
wait a moment, maybe then I need to expand the payment_intent not latest invoice right?
Correct, for showing the modal on your page you would expand the payment intent, use its client_secret and then use that client secret with Stripe.js to display the modal
should I import stripe.js in my frontend?
Sorry I jumped ahead a bit there. That page has three options:
- Do a full page redirect (will check in to how to set
return_urlif you want to do this one) - Display the 3DS modal on your site (this requires Stripe.js)
- Display 3DS in an iframe (would require custom logic to detect when 3DS is done)
- is hwat I like
Then use import Stripe.js and use the code from that doc to display the modal
yes, I have imported it already
let me check payment intent object
@maiden raptor
I got this error
This property cannot be expanded (payment_intent).
๐ stepping in here as Pompey needs to step away
want to expand
Can you clarify why you are expanding a PaymentIntent here?
so how payment_intent is inside latest invoice. then how to expand
subscription = stripe.Subscription.create(
customer=stripe_customer.id, trial_from_plan=trial_from_plan, coupon=coupon_code,
items=[{'plan': product_code, 'quantity': seat_counts}],
expand=['payment_intent', 'latest_invoice'])```
expand=['latest_invoice.payment_intent']
then latest invoice will also expanded?
You must expand the latest_invoice in order to access the payment_intent property to expand that
Why are you handling 3DS yourself here as opposed to just letting Stripe.JS handle all of this for you?
read this
this
Yeah you don't have to host the modal yourself though
If you confirm a PaymentIntent with Stripe.JS and 3DS is required then we will display the necessary modal for you
how to confirm
general flow in our website, user add stripe card first in profile, and click subscribe,
once user clicke subscribe, we do stripe.Subscription.create (because user already added card in stripe by stripe checkout session with mode='setup')
but for few users, they're failing (actually we're failing creating subscriptino) due to like 3ds
so now I got subscription object which is not succeed (payment_intent is expanded)
now how to display 3ds by stripe.js?
how to confirm?
Well let's back up. Why are you using setup mode to begin with instead of subscription mode with Stripe Checkout?
Then Checkout would handle 3DS for you as well
that's our work flow
we have ui to manage card
so once user click the subscribe in somewhere, we will display modal like 'use cards on file'
then added card will be used
?
hi
?
Ah okay so this is for starting Subscriptions with previously saved cards
You are going to need to be patient, I'm helping multiple folks at once.
So I won't always respond immediately.
ah, ok
So it isn't going to be that they set up the card then immediately start the Subscription
They set up the card in the past, then they return to your site and start the Subscription later on, correct?
yes, like that,
even some users will add card today, and today will try subscribe with that card added
Ok well I'd recommend using subscription mode if the user is going to start a new Subscription immediately without using a card saved in the past.
Regardless, what you want to do is you want to pass the PaymentIntent's client_secret to your client and use confirmCardPayment() to reconfirm the PaymentIntent client-side if 3DS is required.
That will then allow Stripe.JS to display the 3DS modal.
The initial payment attempt will fail with authentication_required
please consider that I'm so dummy ๐
where can I get that info if addtional action needed (like 3ds) in
from result stripe.Subscription.create()
Yep
yep means? how?
From stripe.Subscription.create()
Best thing to do is test this scenario out in test mode
You want to use the 4000002760003184 test card
Which always reuires 3DS
yes yes.
my question is not abou tit
how to know if 3ds is needed
from subscription object I got by 'stripe.Subscription.create'
??
Go test it out. I can't walk you through every single step here. Run a test and look at your Dashboard and the objects that are returned to you, their statuses and properties.
The Subscription creation request will fail here with a 4xx and return you an error response about authentication being required.
So it should be pretty clear
But the best thing to do is to actually test it.