Collect SEPA payment details from users via Stripe Checkout, via Cloudflare Workers.
A full walkthrough is available here.
Wrangler is Cloudflare's toolkit for developing Workers. If it is not already set up on your system, install it.
It can be installed using either npm:
npm install -g wrangler
or yarn:
yarn add -g wrangler
wrangler login
This will create an authentication session in your browser. Once you approve the connection in the browser, go back to the console. If you have more than one Cloudflare account under your login, you'll be asked to select the specific one to authorise.
Clone the repository:
git clone [email protected]:square1-io/stripe-checkout-sepa-bank-details-cloudflare-workers-example.git
Install dependencies:
npm install
Get your secret key from the Stripe Dashboard
wrangler secret put STRIPE_API_KEY
This will prompt you to save a value to Cloudflare's secret storage, using the key name STRIPE_API_KEY
.
wrangler deploy
To set up a route in the dashboard:
- Log in to the Cloudflare dashboard and select your account.
- Go to Workers & Pages and in Overview, select your Worker.
- Go to Triggers > Routes > Add route.
- Enter the route and select the zone it applies to.
- Select Add route.
Routes can be configured to have matching behaviour, rather than matching only a particular keyword. More information on matching behaviour can be found on the Cloudflare docs.