#dotDeveloper

1 messages · Page 1 of 1 (latest)

dire cloakBOT
manic moat
#

Hi there, how can I help?

still raven
#

Hey Jack! Hope you are having a amazing day!
Context: (I work as a FS dev at DOT)
I am confused regarding 2 topics!

  1. 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.
manic moat
#

Ok, I assume you are using checkout sessions for both one-time payments and subscriptions, am I right?

still raven
#

yes

manic moat
#

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)

still raven
#

okay! Got it!
2nd part is where I am very much confused right now:

  1. 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
manic moat
#

What's the checkout session ID?

still raven
#

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!

manic moat
#

Are you asking why there's a tax of 43980?

still raven
#

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)",)