#DaanVDH

1 messages · Page 1 of 1 (latest)

leaden depotBOT
sleek mason
#
t_intent: 'pi_3MmliIFp2tS5qYiw0CojSeGW'","param":"intent","request_id":"req_nUfKLh6UpRB1g9","request_log_url":"https://dashboard.stripe.com/test/logs/req_nUfKLh6UpRB1g9?t=1679091945","type":"invalid_request_error"}```
past willow
#

Taking look

sleek mason
#

code:

func (s service) GetFeesFromPaymentIntent(pi *stripe.PaymentIntent) (primitive.Decimal128, error) {
    params := &stripe.PaymentIntentParams{}
    params.AddExpand("latest_charge.balance_transaction")

    pi, err := paymentintent.Get(pi.ID, params)
    if err != nil {
        return primitive.Decimal128{}, nil
    }

    var total int64
    ts := pi.LatestCharge.BalanceTransaction.FeeDetails
    for _, t := range ts {
        total += t.Amount
    }
    dec, err := pkg.Int64ToDecimal128(total)
    if err != nil {
        return primitive.Decimal128{}, err
    }
    return dec, nil
}
past willow
#

This typically happens if you're trying to retrieve an object from another account, like a connect account etc. Looking at the object ids

sleek mason
#

Ahh yeah, this is indeed a connected account

past willow
#

Yeah, it looks like the payment intent was created as a Direct charge on
acct_1MTWgDFp2tS5qYiw but you're trying to retrieve it from a different account,
acct_1K41U4C2wI1d2ers

sleek mason
#

Any way to get the PI using the platform account?

past willow
#

You'd want to retrieve it by the same account as you created the payment intent.

sleek mason
#

So do params.SetStripeAccount() to and set the accountId for the connected user?

past willow
#

yes, params.SetStripeAccount("{{CONNECTED_ACCOUNT_ID}}")