Standard Integration
Learn how to accept payments in your application.
Prerequisites
- A Paylinker account.
- Your API keys.
1. Create a Product
Create your first product in the Product Dashboard. Fill in the name, description, and price.
2. Create a Checkout Session
The Checkout Session is the core of the Paylinker payment flow. You need to create a session on your backend.
First, install the SDK:
npm install @paylinker/nodeThen, create the session in your backend route:
const Paylinker = require('@paylinker/node');
const client = new Paylinker('YOUR_SECRET_KEY');
app.post('/create-checkout-session', async (req, res) => {
const session = await client.checkout.sessions.create({
product_id: 'prod_abc123', // From Dashboard
success_url: 'https://your-site.com/success',
cancel_url: 'https://your-site.com/cancel',
mode: 'payment',
});
res.json({ url: session.url });
});Test Mode
Use Test Mode to simulate payments without real money during development.
3. Redirect the User
When your frontend receives the url from the backend, redirect the user to it.
// Frontend example
const response = await fetch('/create-checkout-session', { method: 'POST' });
const { url } = await response.json();
window.location.href = url;Browser Security
Best Practice: Redirect in the same window to avoid browser popup blockers.
4. Handle the Result
After payment, Paylinker redirects the user back to your success_url.
The URL will contain query parameters like: https://your-site.com/success?session_id=cs_test_123&status=success
Security Verification
For security, we recommend configuring Webhooks to receive asynchronous notifications of the final result, rather than relying solely on the redirect URL.