Stripe is a great payment processor to use if you are looking to take recurring and one off payments using a credit or debit card.
There are two parts to setting up Stripe, obtaining your Stripe Secret and Publishable Keys and setting up your Stripe Webhook. Please remember to do both.
Create your Stripe account
- Sign Up for Stripe
How to find your secret and publishable keys
- Log into your Stripe Dashboard.
- In the right top menu click Developers then API Keys on the left hand side menu.
- Click Reveal live key Token.
- Copy the Live Secret Key string of characters.
- Open your SubHub site in a new tab/window.
- Log in and go to your Site Settings > Payment Processor tab.
- Paste in your Stripe Live Secret Key into the field.
- Copy and paste your Stripe Publishable Key into the field.
- Click Save Settings.
Your Stripe account will be set to Test as default. Change this to Live to start accepting payments.
We would also advise you to take a test payment immediately to ensure it's working correctly.
Please remember to verify your Stripe account by clicking on the verification link which will be sent to your email address.
Setting up your webhook
- Login to Stripe.
- In the right top menu click Developers.
- In the left-hand menu, select Webhooks.
- Click Add an endpoint button.
- In the Endpoint URL field add: https://www.yoursite.com/stripe
- For a sub domain use the format: https://yoursite.com/stripe
- Select Latest API Version (2020-08-27)
Select events to listen to
- Click +Select events
From the list, tick these events:
Under Checkout tick:
- checkout.session.completed
Under Customer tick:
- customer.subscription.deleted
- customer.subscription.trial_will_end
- customer.subscription.updated
Under Invoice tick:
- invoice.payment_failed
- invoice.payment_succeeded
Under Payment Intent tick:
- payment_intent.payment_failed
- payment_intent.succeeded
To complete: Click Add Events
FINAL STEP: Always make a test payment before launching your site.