#alex2_api

1 messages ยท Page 1 of 1 (latest)

weak sandalBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!

โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1213273722996400178

๐Ÿ“ Have more to share? You can add more detail below, including code, screenshots, videos, etc.

crude rivetBOT
obtuse zodiac
#

Hi, what do you mean by 'ChargeSearch to match the receipt with the charge'?

thin nova
#

in the case of 100% discount coupon, there is not "charge". My users still get a receipt ID which I dont know how to query in the stripe API

obtuse zodiac
#

So you just want to know what the receipt number?

thin nova
#

in the first case of the charge, I can confirm with the chargeSearch that the selected receipt is linked to a payment intent which I also store locally. So it's an easy way for me to confirm ownership

#

in the second case with the promo code, I have no way to link that receipt they get to anything.

obtuse zodiac
#

I think the best way to track these on your end is to add metadata, https://docs.stripe.com/api/metadata instead. As you scale, using the Search API functionality is not going to be ideal as you might hit rate limits, https://docs.stripe.com/rate-limits.

So when you create the payment, you can pass in a key value pair, and store information on there to later track.

With 100% discount, there is no charge but an invoice is created for $0 amount. For this reason, you could link that to the invoice. However, I do think using the metadata is going to be best for tracking purposes.

thin nova
#

nice I'll have a look. However when I checked my dashboard, no invoice was created. When I go to invoices I get the starting screen to create invoice

obtuse zodiac
thin nova
#

req_7LyhUavRBY0IP7

obtuse zodiac
#

That is the request for creating the promotion code

thin nova
#

I dont use subscriptions

#

I only have one time payments

obtuse zodiac
#

Ah, you mentioned saas application so I assumed you were creating a recurring charge

#

Can you share the request for the one time payment then where you applied the 100% discount?

thin nova
#

req_7LyhUavRBY0IP7 should be it. This the req that go triggered when I applied it

#

the event after this request is the checkout session

obtuse zodiac
thin nova
#

ok, assuming I pass that metadata, how can I programmatically query for those metadata? Wouldn't I be usingh the searchAPI again?

obtuse zodiac
#

It looks like you're using Checkout so you can listen to checkout.session.completed event and setup webhok, https://docs.stripe.com/webhooks. Then, you can store all of that information on your end.

thin nova
#

ty so much for your time ๐Ÿ™‚ I'll go through your suggestions

#

not sure how to close / archive this discussion ๐Ÿ™‚