I started development on the payment system for our subscription website using Stripe's custom form: https://stripe.com/docs/custom-form. I have the development site working such that when somebody chooses a subscription, it pops up a form to collect the credit card data, that data is submitted to Stripe, and stripe sends back a token.
In the "Next steps" at the bottom, it seems to indicate that I can then use this token to sign the user up for a subscription. However, the subscription page doesn't show how to use that token when creating a subscription. It appears from that page that when a subscription is created, Stripe will create an invoice and email it to the user.
I'd really like to handle the first payment directly on the website rather than lose users in an email flow. I think it can be done, but I can't find an example. How do I use the Stripe token from the collected credit card to charge the user for the first period of the subscription? The only code for creating a subscription is:
Stripe::Subscription.create(
:customer => customer.id,
:plan => "basic-monthly",
)
Which doesn't pass the token in. Where do I pass the token?