If attempting to charge a customer record (which has an associated credit-card) via a connected account, I get an error claiming, "No such customer: cus_xxxx" -- even though making a charge to the same-exact customer will work fine when not using a "connected" account (when charging via the platform account).
For example, consider the following Ruby code, assuming we have a "connected" (Standalone) account with ID acct_ABC123
:
# Use the (secret) API key for the "platform" or base account. Stripe.api_key = 'sk_[...]' customer = Stripe::Customer.create(email: 'customer@example.com') # Associate a credit-card with the customer. token = # Generate a token (e.g., using Stripe Checkout). customer.sources.create(source: token) # Attempt to charge the card via the connected account... Stripe::Charge.create({ amount: 150, currency: 'usd', customer: customer.id, application_fee: 25 }, stripe_account: 'acct_ABC123')
The last line there leads to a Stripe::InvalidRequestError
exception, with the "No such customer" error mentioned above. However, the same charge will go through fine if we just try to run it on the "platform" account (without the stripe_account
parameter and no application_fee
)...
Stripe::Charge.create({ amount: 150, currency: 'usd', customer: customer.id }