I am trying get customer payment using PaymentIntents and if the status is succeeded, create transfers to the correct stripe connect account while using source_transaction.
payment.id in this case was pi_1I7xsjL98Injb3kNT74IwMK8 and I got the error No such charge: pi_1I7xsjL98Injb3kNT74IwMK8 which led to the resource_missing error. It makes sense since I am passing in a paymentIntents Id, but is there a way I could use source_transaction while using paymentIntents?
A sample of what I am doing in my code is below!
return stripe.paymentIntents.create({
amount: data.amount,
currency: data.currency,
customer: stripeCustomerId,
payment_method: data.paymentMethodId,
off_session: false,
confirm: true,
confirmation_method: 'manual',
setup_future_usage: 'off_session',
// transfer_group: idempotencyKey
}, { idempotencyKey })
}).then(payment => {
if (payment.status == 'succeeded') {
let transferPromises = []
transferPromises.push(
stripe.transfers.create({
amount: Math.ceil(payment.amount_received * 0.9),
currency: 'usd',
destination: creator.data().stripeConnectId,
source_transaction: payment.id,
// transfer_group: idempotencyKey,
})
)