#DaanVDH
1 messages · Page 1 of 1 (latest)
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"}```
Taking look
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
}
This typically happens if you're trying to retrieve an object from another account, like a connect account etc. Looking at the object ids
Ahh yeah, this is indeed a connected account
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
Any way to get the PI using the platform account?
You'd want to retrieve it by the same account as you created the payment intent.
To be clear, on that retrieve request, also use the Stripe Account header: https://stripe.com/docs/connect/authentication
So do params.SetStripeAccount() to and set the accountId for the connected user?
yes, params.SetStripeAccount("{{CONNECTED_ACCOUNT_ID}}")