This is a Next.js project that utilizes Mollie's node JS library.
sequenceDiagram
Buyer ->> Merchant: Choose Mollie payment method
Merchant ->>+ Mollie: Create Payment
Mollie -->>- Merchant: hosted checkout URL
Merchant -->> Buyer: Redirect to Mollie hosted checkout
Buyer ->>+ Mollie: Interact on Mondu Hosted Checkout
Mollie -->> Buyer: Redirect to success page
Mollie -->> Merchant: Webhook
sequenceDiagram
Buyer ->> Merchant: Choose Mollie payment method
Buyer ->> Mollie: Load Card Component via mollie.js
Buyer ->> Merchant: "Pay Now"
Buyer ->> Mollie: Send card data
Mollie -->> Buyer: respond with card token
Note over Merchant: retrieve card token in payment form
Merchant ->>+ Mollie: Create Payment (including card token)
Mollie -->>- Merchant: hosted checkout URL
Merchant -->> Buyer: Redirect to Mollie hosted checkout
Buyer ->>+ Mollie: Interact on Mondu Hosted Checkout
Mollie -->> Buyer: Redirect to success page
Mollie -->> Merchant: Webhook
opt capture flow
Merchant ->> Mollie: capture payment
end
After cloning the project, create your own copy of the environment file:
cp .env.example .env.local
nano .env.local
MOLLIE_API_KEY
is your test API key (starts withtest_
)NEXT_PUBLIC_MOLLIE_PROFILE
is your profile ID. This is propagated to the client and is needed for Mollie's components to workDOMAIN
is the domain the app is running on, including protocol (https://
orhttp://
)WEBHOOK_URL
is a URL where Mollie will send webhooks. Can be different. Recommendation for local development: https://webhook.site
You'll need your own Mollie API key from Mollie's merchant dashboard.
If no domain is set, we will simply use localhost for redirects. If no webhook URL is set, webhooks will fail.
Then, run the development server:
npm run dev
Open http://localhost:3000 with your browser and start testing payments.
✅ make payments work
✅ log webhooks
✅ Card Components
✅ Auth/Capture
✅ Get payment methods from methods API
✅ list recent payments
✅ Use Mollie Components where it makes sense
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out the Next.js deployment documentation for more details.