#cabba_best-practices

1 messages ¡ Page 1 of 1 (latest)

swift duneBOT
quiet wingBOT
#

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.

swift duneBOT
#

👋 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.

quiet wingBOT
worldly chasm
#

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).

grave oasis
#

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)

worldly chasm
#

can you show me an example/some code/some API calls and responses?

grave oasis
#

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)
worldly chasm
#

yeah, the fee amount is based on how much you auth'd, not how much you captured(my answer earlier was wrong).

grave oasis
#

Any suggestion on how I can compute the fees on the captured amount?

worldly chasm
#

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?

grave oasis
#

in my dashboard I see this

worldly chasm
#

what's the ID pi_xxx of that PaymentIntent?

grave oasis
#

pi_3PGIW02Kaq5K0lsu0xrMJznr

worldly chasm
#

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.

grave oasis
#

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?

worldly chasm