#palminyx

1 messages ยท Page 1 of 1 (latest)

wanton turretBOT
haughty sand
#

Yes so you can track the Transfer link up with the PaymentIntent, and calculate amount based on them

#

You should have webhook to listen to both payment_intent.succeeded and transfer.created

mystic shale
haughty sand
#

Are you a developer? ๐Ÿ™‚ If you are familiar with webhook it will make sense ๐Ÿ™‚ Webhook is where Stripe sends request to your server notify when something happens on your accounts

#

So you can listen to when a PaymentIntent succeeded, and when a Transfer succeeded

mystic shale
#

yeah i'm the developer, i've set up the whole backend

#

My question about tracking the commission for each payment is related to Stripe's api: is there a way to keep track of the commission of the platform without using application_fee as I cannot use it because i'm using transfer_group rather than transfer_data

haughty sand
#

Yes so you have the PaymentIntent and the Transfer, linked up by their transfer_group, right?

#

You can then simply subtract the amount of the PaymentIntent of the Transfer amount

mystic shale
#

transfer_group for both paymentIntent and transfer is the ID of the payment document on my noSQL server, so yeah they're the same.
The amount of the paymentIntent is gross, since it also contains Stripe's commission.
What I want is way to track how much i'm making off each transaction
Customer pays 100, i get 98 (net) due to fees on the transaction, everything goes smoothly and seller receives 90. How can i keep track of how much i've made off that transaction (net amount - seller amount) ?

#

Is there a Stripe's native way to keep track of it in Stripe's dashboard with my payment flow?
Or do you suggest to use a different payment flow?
Keep in mind that I want to keep the same logic on it

haughty sand
#

Sure so you have the gross amount (100) and the transfer amount (90). You need to figure it out the net amount (98), correct?

#

You can then look at the Balance Transaction inside the Charge object, inside the PaymentIntent. It has the fee breakdown and should tell you there is $2 total fee

mystic shale
#

is the charge object called latest_charge? And I'm guessing i have to use stripe.charges.retrieve(id) where id is latest_charge

haughty sand
#

Yes! and you can call Retrieve Charge, and expanding balance_transaction to also have until Balance Transaction level

#

otherwise it will only returns the Balance Transaction id

mystic shale
haughty sand
#

Yes!

mystic shale
#

Okay perfect. and is there a way to associate the fee to the Transfer in Stripe?

#

const transfer = await stripe.transfers.update(
'transfer_ID',
{
metadata: {
stripeFee: balance_trx_fee,
platformFee: platformFee
},
}
);

where platformFee is calculated as netAmount (98) - transfer amount (90)

Is this the way i should go about associating it?

haughty sand
#

Yeah you can! Correct

#

Metadata is basically a memo you can put anything

mystic shale
#

Perfect. Should i just put it in the metadata or can i save it as a variable in the transfer?

#

Or, save it in metadata for tracking purposes in Stripe and save it also in the Transfer document on my database

#

btw thank you so much for your help!