#emnaruto07 - Django

1 messages · Page 1 of 1 (latest)

hazy star
#

Hello! What's your question?

proud skiff
#

I want to save a copy of successfull session in my database

hazy star
#

What have you tried so far? Are you getting an error?

proud skiff
#

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?

hazy star
#

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.

proud skiff
#

ok, please dont close this thread. I'm on my phone right now. I'll share my code in 1hr

#

thanks rubeus

hazy star
#

Okay.

proud skiff
#

Hi

uneven halo
#

@hazy star had to head out, but i can help!

proud skiff
#

Can you read the old messages?

uneven halo
#

Yes I see them - we asked for more context/code

proud skiff
#

yes, providing

uneven halo
#

Why are you trying to create a copy? This is more of a question of how to save data in your own database, right?

proud skiff
#

yes

#

then i can see who is paid and who is not.

#

so i can display the output to the paid user

uneven halo
#

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

proud skiff
#

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?

uneven halo
#

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

proud skiff
#

ok thankyou

proud skiff
#

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

main finch
#

Catching up on the rest of the context here, one minute...

proud skiff
#

i'm talking about this status

main finch
#

So you can store and refer to either as long as it has the data you want

proud skiff
#

So, this means for every event type i have to save the data.

#

correct?

main finch
#

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.

proud skiff
#

what if user payment failed and i want to send and email? i think this 2 indent is useful.

main finch
#

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