Reputation: 52208
I'd like to be able to quickly run code in automated tests and development to create a payment:
Stripe.api_key = 'sk_test_51HYHSFGtUKse83O9J4QeAib3cp8sHzGaOQRrnwvnghEzuYQKUCKEP3CHE3AIHe5ModevMK7TVAUCyJU0ADSwIUoX00qxZmBI9r'
session = Stripe::Checkout::Session.create({
payment_method_types: ['card'],
line_items: [{
name: 'Kavholm rental',
amount: 1000,
currency: 'aud',
quantity: 1,
}],
payment_intent_data: {
application_fee_amount: 123,
transfer_data: {
destination: '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
},
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/failure',
})
but note that it needs a CONNECTED_STRIPE_ACCOUNT_ID
The problem here is you have to manually go through the browser to create it. Very annoying for automated testing and development if you're constantly seeding new data.
How can I create a connected stripe account using code (rather than going through the browser)?
Upvotes: 0
Views: 237
Reputation: 8727
The answer depends on the type of Connect Account you're using, but the only flavor that would allow that is a Custom Account. If you're using Standard or Express, it makes more sense to specifically create - and reuse - test accounts for this purpose.
Upvotes: 1