#cabba_best-practices
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- cabba_best-practices, 1 day ago, 12 messages
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1239893397205155890
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
hi! makes sense I think. Do you have a specific example? Generally, the BT is not created until after you capture the payment, and that's when the fee is calculated(based on the actual amount captured).
Hi! Yes in my current workflow I capture the payment specifing the amount_to_capture (in this case below the total payment intent amount) and capture the payment. After that i transfer the amount captured to my customer without the stripe fees.
But currently I'm applying the stripe fee computed on the total amount of the payment intent (not only the captured one)
can you show me an example/some code/some API calls and responses?
yes sorry, just a sec
// compute the amount to capture and capture payment
params := &stripe.PaymentIntentCaptureParams{}
params.AddExpand("latest_charge.balance_transaction")
if partialCapture {
params.AmountToCapture = stripe.Int64(int64(amountToCapture))
}
pi, err := paymentintent.Capture(o.StripePaymentID, params)
if err != nil {
return err
}
// Compute tokino fee and transfer net to customer
platformFee := pi.LatestCharge.BalanceTransaction.Fee + 100 // 100 is an example fee of my plafrom
tp := &stripe.TransferParams{
Amount: stripe.Int64(amountToCapture - platformFee),
Currency: stripe.String(string(stripe.CurrencyEUR)),
Destination: stripe.String(fa.StripeID),
SourceTransaction: stripe.String(pi.LatestCharge.ID),
TransferGroup: stripe.String(o.ID.String()),
}
_, err = transfer.New(tp)
yeah, the fee amount is based on how much you auth'd, not how much you captured(my answer earlier was wrong).
Any suggestion on how I can compute the fees on the captured amount?
hmm. can you explain more? To be clear, Stripe is charging the fee based on the auth'd amount, so what exactly are you looking for? What Stripe would have charged if the pricing worked differently?
in my dashboard I see this
what's the ID pi_xxx of that PaymentIntent?
pi_3PGIW02Kaq5K0lsu0xrMJznr
ah right.
sorry yeah, the way it works is there's a Refund object created when you do the partial capture, and the BT associated with that Refund has the fee refund.
ok, so I have to subtract the BT fee associated with the latest charge of the payment intent with the fee that I obtain from the Refund?