How do I charge an account's external account in the Stripe Connected Accounts API?
I create invoices on my system then I want to let the users pay them.
On the first screen I list their payment accounts that are saved on the system. This will be bank accounts, credit cards, debit cards.
When they select the account to pay with this is where my trouble starts.
Here is my code
def pay_invoice invoice_id, source_id
invoice = Invoice.find(invoice_id)
account = Stripe::Account.retrieve(@account)
charge_source = account.external_accounts.retrieve(source_id)
c = Stripe::Charge.create(
:amount => invoice.cents,
:currency => "usd",
#:customer => @account,
:source => charge_source,
:description => "Charge for invoice ##{invoice_id}"
)
end
the source_id passed in to the method is the id of the external account I got earlier.
My first attempt was to pass that as the source and I got the error "No such token"