#palminyx
1 messages ยท Page 1 of 1 (latest)
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
could you explain it further? I did not understand what you mean
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
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
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
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
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
is the charge object called latest_charge? And I'm guessing i have to use stripe.charges.retrieve(id) where id is latest_charge
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
https://stripe.com/docs/api/expanding_objects
stripe.charges.retrieve('chargeID', {
expand: ['balance_transaction'],
});
Is this what you meant?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes!
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?