Quickstart
This page is for merchants who already have a website, shopping cart, order system, or membership system. The goal is to create a payment order on your server and redirect the buyer to the Taria Pay hosted checkout page.
If you already have your own checkout page, you can use the Checkout Button to open the same hosted checkout. If you want buyers to pay without ever leaving your site, use the Checkout Panel instead.
Standard flow
Your frontend
-> calls your server
Your server
-> creates a payment intent
-> returns checkoutUrl
Buyer's browser
-> redirects to the Taria Pay checkout page
Taria Pay
-> completes the payment
-> notifies you of the result via webhook
Your system
-> updates the order and fulfills itBefore you start
You will need:
- A Taria Pay merchant account
- A
testAPI key - A server that can call the Taria Pay API
- Success and cancel pages on your own website
- A webhook endpoint for receiving payment results
Key principles:
- API keys belong on the server only — never in browser code.
- The frontend only calls your server and redirects to
checkoutUrl. successUrlonly means the buyer returned to your site; it does not mean the order is ready to fulfill.- The final payment result always comes from webhooks or the status API.
Step 1: Install the SDK
npm install @tariapay/sdkStep 2: Configure environment variables
TARIAPAY_SECRET_KEY=tpk_...
TARIAPAY_WEBHOOK_SECRET=whsec_...
APP_URL=https://merchant.exampleFor local development you can additionally configure the API base URL; in production this usually does not need to be set manually.
Step 3: Create a payment order on your server
import { TariaPay } from "@tariapay/sdk";
const tariapay = new TariaPay({
secretKey: process.env.TARIAPAY_SECRET_KEY!,
});
export async function createCheckout() {
const paymentIntent = await tariapay.paymentIntents.create({
orderId: `order_${crypto.randomUUID()}`,
amount: "49.99",
currency: "USDC",
successUrl: `${process.env.APP_URL}/checkout/success`,
cancelUrl: `${process.env.APP_URL}/checkout/cancel`,
customer: {
email: "buyer@example.com",
},
metadata: {
cartId: "cart_789",
},
});
return paymentIntent.checkoutUrl;
}Step 4: Redirect to the checkout page from the frontend
const response = await fetch("/api/tariapay/create-payment", {
method: "POST",
});
const payload = await response.json();
window.location.assign(payload.checkoutUrl);Step 5: Update your order with webhooks
After the buyer completes payment, Taria Pay sends the payment status to your webhook endpoint. Your system should update the order status only after the webhook signature has been verified.
Continue reading: Receive payment results
Next steps
- Learn the creation parameters in detail: Create a payment order
- Frontend redirect only: Redirect to checkout
- Payment button or Checkout Panel: Checkout Button and Checkout Panel
- Browse the API fields: API reference