Quick Start

Make your first Payzava payment in 5 minutes

Get up and running with Payzava in 5 minutes.

Step 1 — Get your API key

Log in to your Payzava Dashboard and navigate to Settings → Development Info to copy your API key.

For testing, use the Sandbox Dashboard and use your sandbox API key (format: sk_sandbox_XXX-XXXXXXXXXXXX-XXX).

Step 2 — Get available payment methods

Before creating a payment, fetch the payment methods available on your account:

const axios = require("axios");

const response = await axios.get(
  "https://sandbox.payzava.com/cp/api/v1/payment/methods",
  {
    headers: {
      "Content-Type": "application/json",
      "x-api-key": "sk_sandbox_X7k-aB3cDeFgHiJkL-mN9",
    },
  }
);

const methods = response.data.data;
console.log(methods);
// Use the `id` field from a method as your paymentMethodId

Step 3 — Create a payment

const response = await axios.post(
  "https://sandbox.payzava.com/cp/api/v1/payment/create",
  {
    amount: 100,
    description: "Order #12345",
    paymentMethodId: "METHOD_ID_FROM_STEP_2",
    redirect_url: "https://yoursite.com/payment/complete",
    callback_url: "https://yourserver.com/webhooks/payzava",
  },
  {
    headers: {
      "Content-Type": "application/json",
      "x-api-key": "sk_sandbox_X7k-aB3cDeFgHiJkL-mN9",
    },
  }
);

const { payment_url, transactionId } = response.data.data;
// Redirect your user to payment_url

Step 4 — Redirect your user

window.location.href = payment_url;

The user will complete payment on the Payzava hosted page and be redirected back to your redirect_url.

Step 5 — Verify payment status

Always verify status from your server — never trust redirect parameters alone:

const response = await axios.get(
  `https://sandbox.payzava.com/cp/api/v1/payment/retrieve/${transactionId}`,
  {
    headers: { "x-api-key": "sk_sandbox_X7k-aB3cDeFgHiJkL-mN9" },
  }
);

const { status } = response.data.data;
// status: "Processing" | "Completed" | "Cancelled"

In sandbox mode

Use POST /sandbox/trigger-payment to simulate a completed payment:

await axios.post(
  "https://sandbox.payzava.com/cp/api/v1/sandbox/trigger-payment",
  { transactionId: "YOUR_TRANSACTION_ID" },
  { headers: { "x-api-key": "sk_sandbox_X7k-aB3cDeFgHiJkL-mN9" } }
);