#emnaruto07 - Django
1 messages · Page 1 of 1 (latest)
I want to save a copy of successfull session in my database
What have you tried so far? Are you getting an error?
i have created a stripe model in my djamgo models
now i don't understand how to create a copy
do i have to use stripe.object.create and call the names of the table and save into it?
I don't know. Can you share the code you've written so far? It's very difficult to help without seeing what you're trying to do.
ok, please dont close this thread. I'm on my phone right now. I'll share my code in 1hr
thanks rubeus
Okay.
Hi
@hazy star had to head out, but i can help!
Can you read the old messages?
Yes I see them - we asked for more context/code
Why are you trying to create a copy? This is more of a question of how to save data in your own database, right?
yes
then i can see who is paid and who is not.
so i can display the output to the paid user
Yeah, so you need to look at the documentation for the database you're using and look into how to create the tables and save information to them. This isn't really related to how to use Stripe at all
ohh, ok
but i want to know, if i'm using the correct place to save the data.
means after the hook
there only i have to right the code to save the data right?
It depends on your integration and what you want it to do, but yes, it is a common use case to save information to a DB as webhook events come in
ok thankyou
Can i ask you a quick question.
do i have to store both session and payment intent in the database?
because only session webhooks have payment status. In indent webhook i can't find the payment status variable
The paymentintent itself has a status as well https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status
Catching up on the rest of the context here, one minute...
The paymentintent status also indicates that https://stripe.com/docs/payments/intents
So you can store and refer to either as long as it has the data you want
That decision is up to you and what makes sense for your integration. If you are only trying to save if the session is paid, then just the session or payment intent can work.
what if user payment failed and i want to send and email? i think this 2 indent is useful.
Yes that can definitely make sense. Especially if you will be making off-session charges on the same card at some point after the Checkout session