Stripe Checkout, stripe hosts the payments page.
- config/initializers/stripe.rb
- config/initializers/pay.rb
- app/models/user.rb
bin/rails pay:install:migrations
- pay_customers
- pay_subscriptions
- pay_charges
- pay_webhooks
- pay_merchants
- pay_payment_methods
By including pay_customer in the User model, the gem internally associates a User with the pay_customer model via the owner_type and owner_id fields.
Easiest to configure via the instructions described in the docs. Once you've saved the credentials, you can verify the setup by running User.first.payment_processor.customer
in rails console.
The stripe-cli is used to trigger events and test the webhook integration (locally). Download, install, and setup stripe-cli to work with your account.
Plans are a deprecated concept. Stripe has introduced products and prices. The "price_id" is the relevant field, and it's what is used to generate the checkout url (to direct the user to).
Run stripe listen --forward-to localhost:3000/pay/webhooks/stripe
- app/views/static/home.html.erb
- app/controllers/checkouts_controller.rb
- config/environments/development.rb
- app/services/stripe_checkout.rb
- app/services/payment_succeded_handler.rb
- config/initializers/pay.rb
- (no routing config required)
Stripe redirects back to 'success_url' with 'session_id' query param from stripe.
Using the "stripe.invoice.payment_succeeded" to update user, etc.