Checkout Sessions
Low-effort payment integration with hosted checkout sessions.
Checkout session is a good starting point for teams that want to open a payment page quickly. Some confirm and 3DS steps may remain in the checkout experience; you still need webhooks or a server-side payment query to close the order.
Details: Checkout Session Guide.
Create session
const session = await hsrcpay.checkoutSessions.create({
amount: 25900,
currency: "TRY",
url: "https://pay.merchant.example/checkout",
returnUrl: "https://merchant.example.com/return",
metadata: { orderId: "ORD-42" },
});url is your hosted payment page; the API generates a token and the payer connects to this session.
Redirect
return Response.redirect(
`${session.url}?token=${session.token}`,
303,
);Verification
When the user returns via returnUrl:
- Re-read the session or linked payment via the API.
- Close the order only after
SUCCEEDED/AUTHORIZED(per your business rules). - Reconcile with webhooks.
The return URL ends the user experience; it is not financial proof.