Browse guides
DocsPayment guides
Hosted checkout
Create a Chapa checkout URL and redirect customers to the provider's payment page.
Create a checkout link
import { easyPay } from "@realkal/easy-pay/server";
const payments = new easyPay({
secretKey: process.env.CHAPA_SECRET_KEY!,
callbackUrl: "https://shop.example/payments/callback",
returnUrl: "https://shop.example/orders",
});
const result = await payments.createPayment({
paymentType: "chapa",
txRef: order.txRef,
amount: order.totalETB,
customization: { title: "My shop" },
meta: { payment_reason: "Order payment" },
});
if (result.status === "checkout_created") {
return Response.redirect(result.data.checkoutUrl, 303);
}The SDK submits JSON and returns the merchant reference alongside the checkout URL. Supply a phone number when your merchant category requires it.
Handle the return
Your return page can display order progress. On the backend, load the stored order and call transaction verification. Creating the link or receiving a browser redirect leaves the order unfulfilled. Chapa hosted payments