Reputation: 52648
I'm creating a payment intent as per the Stripe documentation:
payment_intent = Stripe::PaymentIntent.create({
payment_method_types: ['card'],
amount: '1000',
currency: 'aud',
application_fee_amount: '10',
}, stripe_account: 'pi_1IwLlIJuxAkCMV')
When stripe_account
is an Express account, the payment intent gets created and appears in the dashboard as expected.
But when stripe_account
is a Standard account, the payment intent appears to be created and is visible in the console, but the payment intent is not visible in the stripe dashboard, and nor can it be retrieved with Stripe::PaymentIntent.retrieve(id)
:
Stripe::PaymentIntent.retrieve(payment_intent.id)
Stripe::InvalidRequestError: No such payment_intent: 'pi_1IwLlIJuxAkCMV'
from stripe-5.26.0/lib/stripe/stripe_client.rb:592:in `handle_error_response'
Why does creating a payment intent work for express connected accounts but not standard connected accounts?
Upvotes: 0
Views: 724
Reputation: 7459
In your initial snippet, you likely meant to include an account id like acct_123
in the optional stripeAccount
header (ref). That optional parameter also should be within an {}
object/hash, though that appears to not be used in the example you linked.
Authenticating as one of your connected accounts like this creates the payment intent as a direct charge on the connected account itself (as described eslewhere on the doc you linked).
After creating a direct charge like this, you need to include that same stripeAccount
header to authenticate during the retrieval:
Stripe::PaymentIntent.retrieve(payment_intent.id, { stripeAccount: 'acc'})
Edit to add: Confirming this curl
example works as expected:
curl --request POST \
--url https://api.stripe.com/v1/payment_intents \
-u sk_test_123: \
--header 'Stripe-Account: acct_123' \
--data amount=10000 \
--data currency=usd \
--data confirm=true \
--data payment_method=pm_card_visa \
--data application_fee_amount=500
Creates pi_456
, then:
curl --request GET \
--url https://api.stripe.com/v1/payment_intents/pi_456 \
-u sk_test_123: \
--header 'Stripe-Account: acct_123' \
Upvotes: 0