Reputation: 52208
Suppose we wish to perform a simple manual test of stripe connect in an app:
The problem is, unless payouts_enabled
is true in step 2, then we'll always get an error when the regular user tries to pay the connected user.
Also, the way to get details_submitted
is true, is by going through the browser and entering dummy info, but the problem is the test suite doesn't simply allow test info to pass - you have to enter things like social security number, street address etc manually, and it inevitably doesn't pass Stripe's standards, so details_submitted
can be true, but payouts_enabled
inevitably remains false
I need a way to create a connected user with payouts_enabled
in test mode. How can I do this?
I hope there may be two possibilities to achieve this:
payouts_enabled == true
payouts_enabled == true
Upvotes: 1
Views: 835
Reputation: 52208
This took 2 hours' over customer support to figure out. Would love to know to know how to do this with code (will update if I figure that out). Here's how to do it via the UI:
Start by creating an account (this part uses code):
require 'stripe'
# use this if stripe test key is in credentials.yml....
# Stripe.api_key = Rails.application.credentials[Rails.env.to_sym][:stripe][:test_api_key]
# ....otherwise simply use this:
Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
account = Stripe::Account.create({
type: 'express',
country: 'US',
requested_capabilities: ['card_payments', 'transfers']
})
Since Stripe docs don't contain a full set of connected user info, don't enter random values, as there's a very high chance it won't approve something you enter (e.g. an invalid address, phone number, social security number etc etc). Use these instead:
[email protected]
Now the connected account can receive a payment intent like so
payment_intent = Stripe::PaymentIntent.create({
payment_method_types: ['card'],
amount: @amount_minor_unit, # e.g. 1000 for $10
currency: @currency, # e.g. "USD"
application_fee_amount: 123,
transfer_data: {
destination: @user.stripe_account,
},
})
Upvotes: 1