#exxmaxx

1 messages ยท Page 1 of 1 (latest)

velvet socketBOT
magic scarab
#

HI ๐Ÿ‘‹

There's not a lot of context here. This appears to be an invoice but how did you create it? Have you completed payment for it? What status is it in?

molten sphinx
#

ok here is the context.

I am integrating stripe for a SaaS platform collecting subscriptions. I am using the pricing tables. I managed to send the call and also succesfully listening to 7 events

"checkout.session.completed":
"invoice.paid":
"customer.subscription.created":
"customer.subscription.updated":
"invoice.payment_failed":
"customer.subscription.deleted":
customer.subscription.trial_will_end":

Now I am testing the stripe webhook responses in test mode. I triggered a subscription in the Front end of my application and managed to ger checkout.session.completed as expected

in the invoice.paid response i channot see a charge_id (ie. char_3213)

#

I was planning on keeping this in my DB as a reference.

I am already keeping the customer_id and invoice_id .. But now i can see the charge property is empty even when i trigger it from the stripe CLI. Why is that ? what is that field.

If there is another reccomended payment reference to keep what would that be?

magic scarab
molten sphinx
#

yes but my question is more around the charge concept

magic scarab
#

What I am saying is that this ID may not be returned in the webhook event but that you can request more data be returned when you use the Retrieve API.

#

Can you provide the invoice id?

molten sphinx
#

aa got you

#

in_1Nk7t2B5fJXbmPGPhM0OVNLT here it is

magic scarab
#

Ah

#

this one has no charge because it collected no funds

#

amount: 0

molten sphinx
#

yea that's what i was wondering

magic scarab
#

Yeah the Charge object is only created when we attempt to collect funds

molten sphinx
#

so basically if a user is starting a free-trial or is in test mode. There wont be a charge id

#

is this statement valid ?:))

magic scarab
#

Correct

#

You will only have a Charge ID on an Invoice where funds are collected

molten sphinx
#

ok i will basically make this value nullable in my database and it should be good. Although, maybe i dont even need to hold this id as i am already keeping the invoice _id

magic scarab
#

If you need it you can always retrieve the ID from the Invoice object.

molten sphinx
#

That should be enough i guess mate. Thank you

magic scarab
#

Happy to help ๐Ÿ™‚