#mattsulima
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
If you're using Payment Links the webhook events you need to listen to is checkout.session.completed
Oh I'll look into it now, thanks!
I have another question, someone makes payment, we authorize only. Then I am capturing e.g. half of it (payment 200 gbp, I am capturing 100gbp). Then when I receive webhook and I read transaction balance I only see 200 gbp , and frees and everyting matching to 200 gbp, not 100 gbp
How to load real "balance" for this transaction ?
I'm not sure I follow
I need exactly all balance transaction usually has - so amount, net amount, fee
would you mind sharing the request IDs or Payment Intent Ids?
I think that's one of examples : pi_3MZX8mGEyV5mPs8i0JjI5oSy
In other words:
- someone pays (card authorize, not capture) 200 gbp
- I look into it, I need to capture only 100, not 200.
- I am doing capture (100 gbp)
- then webhook appears (charge.captured)
- charge usually has .BalanceTransaction obejct, this obejct has amount, net and fee
and then I am doing this capture (100 gbp) I still see 200 gbp in balance transaction
So my db sees we charged user for 200, when we really charged user for 100 only
Sure, thanks
Re this, I just checked, Yeah I am able to load metadata but paymentintent id is null (setup intent id too) so I am unable to load payment and charge and can't get balance?
would you mind sharing an event id?
evt_1MZYedGEyV5mPs8iLhuzwWnc
yes it's normal because you have a subscription
from there you need to look at the subscription's latest_invoice
Ok, thanks, I'll check it
let me know if you need any more help
I still need reponse to second question
oh yes sorry my bad
you're looking at the balance_transaction?
e.g. txn_3MZX8mGEyV5mPs8i0lSvXxbF ?
yeah I need balance transaction, but txn_3MZX8mGEyV5mPs8i0lSvXxbF shows wrond data. It shows 405 gbp, but we really captured 300 only
and 105 refunded
yes I agree, this info is shown on the charge object
ch_3MZX8mGEyV5mPs8i06wodqeE
I'll try to look into this even more to see whether this is a normal behavior or not
yeah, it is, but isn't fee and net wrong then?
For each contract we make we track all payments and we collect 3 things:
- amount
- net
- fee
thanks
Fyi
Originally we were importing csv files but now we want to switch to webhooks. Csv is very often incomplete - e.g. dispute ("adjustment") charge don't have metadata. Payment via link too. And we have many types of payments - single payment, recurring payments, payment links ect. So I hoped I need to connect to charge.succeded or charge captured, load contract id from metadata and load balance.
But it looks I can't ๐
Take your time, I'll wait for response, fingers crossed we have simple solution to achieve it! ๐
basically what happens in a partial capture is that we create 2 balance transactions: 1 for the original amount and 1 for the refunded amount
Oh that's good news, is there separate webhook event I need to listed to catch refund part?
no actually you need to look at the refund which is no longer included by default on that charge
you need to expand on refunds to get the list and from there get the balance transaction to have the negative net amount
to finally get the correct amount
yes but apparently since your webhook is still on a older API version
when you listen to charge.captured event you will get a list of refunds
which has the balance_transaction that you were missing
so you need to just retrieve both balance transactions
the one from the charge
and the one from the refund
Okay, thanks I'll look into it. makes sense now
This seems worrying, Is my webhook old? Should I upgarde?
We are still in development stage so we must have all up to date
your webhook is using the same API version as your account which is 2022-08-01
since then we have deployed other API versions
ok cool, I'll update it then. Thanks!
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!