#dotDeveloper
1 messages · Page 1 of 1 (latest)
Hi there, how can I help?
Hey Jack! Hope you are having a amazing day!
Context: (I work as a FS dev at DOT)
I am confused regarding 2 topics!
- This one is pretty straight forward:
we have two payment options for user, one time, recurring, I am confused as to which webhook should be on which event to handle all the scenarios regarding payment.
Right now I am using checkout.session.completed to handle only time payments and invoice.paid to handle recurring payments scenarios. What do you suggest here would be the ideal usage.
Ok, I assume you are using checkout sessions for both one-time payments and subscriptions, am I right?
yes
OK, you can listen to checkout.session.completed event, and retrieve the checkout session object with line_items expanded, and check if any of the prices has a recurring hash (https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items-data-price-recurring)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
okay! Got it!
2nd part is where I am very much confused right now:
- In recurring payment there is also VAT getting added and a side one time product of 199 that user can opt in, but while trying to update user balance using webhook and invoice.paid object I get that invoice.paid.amount_paid is not what I want I want the amount user initially entered in dot dashboard post which he was redirected to the checkout.session.potal
What's the checkout session ID?
cs_test_a1VTyWFHjbGQFATtuE45u6aMtz1Lysmzk6Vc51qAUfGYernX8sDcw8DptE
invoice id: in_1NXeB4K28YrklIdiYlKlbSAF
also I am using invoice.paid right for recurring payemnts update, both after the checkout session , and after the time interval is hit for recurring!
Are you asking why there's a tax of 43980?
I am using invoice.paid (id: in_1NXeB4K28YrklIdiYlKlbSAF ) for recurring payments and the reason is I get lines.data array which has all the products in this array I just want to have the amount for this product : ( "description": "1 × Advertising Credit (at $2,000.00 / month)",)