Reputation: 379
I am building an application that allows (potentially anonymous) users to send money to a third-party. It is a requirement that the money go directly and not touch the app's account. Stripe's Connect platform seems to allow this, by the third-party connecting an account: https://stripe.com/docs/connect/payments-fees
The "Charge Directly" option seems to do as desired. However, my current implementation seems to be sending the money to my platform's account instead of the third-party connected account. I am using Ruby, so this format applies:
Stripe.api_key = PLATFORM_SECRET_KEY
Stripe::Charge.create({
:amount => 1000,
:currency => "usd",
:source => {TOKEN}
}, {:stripe_account => CONNECTED_STRIPE_ACCOUNT_ID})
The TOKEN
is obtained via Stripe.js from the user inputting their credit card information. I have substituted the PLATFORM_SECRET_KEY
variable for the secret key obtained in my platform's Stripe account under API keys. I have stored the third-party's user_id
from when they connected their account via Stripe Connect, which I input for CONNECTED_STRIPE_ACCOUNT_ID
.
As the payments are showing up in my platform's dashboard under 'Payments', I clearly have some keys mixed up. Can anyone point me in the right direction for which keys go where? Thank you!
Upvotes: 0
Views: 583
Reputation: 4648
If you're seeing it in your dashboard either:
1) the version of the Stripe library you're using is not new enough to support the Stripe-Account header.
2) You're passing a null as the connected account id
3) You're passing your own account id as the connected account id.
Upvotes: 3
Reputation: 379
The Stripe.api_key
value should be the connected account's access_token
. Stripe's example code incorrectly labels it as PLATFORM_SECRET_KEY.
Upvotes: -2