Skip to navigation

Quickstart

Signup only asks for an email address and your business name, with no documents and no waiting. You get a Test mode API key straight away, and Test mode simulates payments: no M-PAiSA or MyCash wallet is charged and no real money moves, so you can build and test your whole integration before anyone checks your documents. Live mode opens once your Verification is approved: your company registration, TIN and TIN card photo, your directors and owners, and a few details about what you sell. It’s reviewed in the background.

Building with an AI agent?

Give your coding agent Integrate with an AI agent, one linear recipe from install to Live mode. It can also read the whole site:

  • docs.transxact.io/llms.txt indexes every page, and adding .md to any page’s URL returns it as Markdown.

  • The docs MCP server lets the agent search these docs itself. In Claude Code:

    claude mcp add --transport http transxact-docs https://docs.transxact.io/_mcp/server

    Other MCP clients, such as Cursor, take the same URL.

1. Get a Test mode key

Sign up and choose the Business account. Your Test mode key (sk_test_...) is shown on the next screen, once. Copy it then: we keep only a hash, and the dashboard shows just its last characters. If you lose it, Roll key on the dashboard revokes it and gives you a new one.

Keep the key on your server. It never belongs in a browser or a mobile app (see Mobile integration).

2. Create a Checkout Session

curl https://api.transxact.io/v1/checkout-sessions \
-X POST \
-H "Authorization: Bearer sk_test_..." \
-H "Idempotency-Key: a1b2c3d4-order-9912" \
-H "Content-Type: application/json" \
-d '{ "amount": 5000, "currency": "FJD" }'

It answers 201 with the Checkout Session:

{
"id": "cs_3f9c2b1a",
"status": "pending",
"amount": 5000,
"currency": "FJD",
"hostedUrl": "https://transxact.io/c/cs_3f9c2b1a",
"metadata": {},
"expiresAt": 1717086400000
}

amount is in FJD cents and must be under FJD 5,000.00 (at most 499999), in Test mode and Live mode alike. A larger amount returns 400 invalid_request.

The Idempotency-Key header is required. If your server times out and retries the create call, the same key replays the original response instead of creating a second Checkout Session for the same customer. Replayed responses are stored for ~24h. Use something tied to the order, like its id.

Prefer a library? Install an SDK and make the same call from its client:

npm install @transxact/node # Node and TypeScript
composer require transxact/transxact # PHP

The client sends your key as Authorization: Bearer and calls https://api.transxact.io unless you point it elsewhere. In Node:

import { TransxactApiClient } from "@transxact/node";
const client = new TransxactApiClient({ token: "sk_test_..." });
const session = await client.checkoutSessions.create({
idempotencyKey: "a1b2c3d4-order-9912",
amount: 5000,
currency: "FJD",
});

In PHP:

<?php
use Transxact\TransxactClient;
use Transxact\CheckoutSessions\Requests\CreateCheckoutSessionRequest;
$client = new TransxactClient(token: 'sk_test_...');
$session = $client->checkoutSessions->create(
new CreateCheckoutSessionRequest([
'idempotencyKey' => 'a1b2c3d4-order-9912',
'amount' => 5000,
'currency' => 'FJD',
]),
);

Both return the Checkout Session above, so session.hostedUrl (Node) or $session->hostedUrl (PHP) is where you send your customer next. Each client also has retrieve and cancel under checkoutSessions, taking the session’s id.

3. Send your customer to hostedUrl

Redirect your customer to the session’s hostedUrl. That page offers every way to pay, takes the payment, and handles each wallet’s own steps, so you build one integration, not one per wallet.

To bring your customer back afterwards, add successUrl and cancelUrl to the create call (both optional, HTTPS only):

{
"amount": 5000,
"currency": "FJD",
"successUrl": "https://shop.example/orders/9912/thanks",
"cancelUrl": "https://shop.example/cart"
}

Once the payment succeeds, the hosted page returns them to successUrl. If they cancel, or the payment doesn’t go through, it offers a way back to cancelUrl. Both arrive with ?session_id=cs_... appended. Anyone can open a URL, so use session_id to look the Checkout Session up (GET /v1/checkout-sessions/{id}) or wait for the webhook before fulfilling the order.

To match a session to your own order without keeping a mapping, add "metadata": { "orderId": "9912" }. You can send up to 20 string pairs. They come back on retrieve and in every webhook, and are never shown to your customer.

A Checkout Session expires 24 hours after you create it. To change that, set expiresAt to a Unix-milliseconds time between 30 minutes and 24 hours ahead. Once a session expires it can’t be paid, and it moves to cancelled with a checkout_session.cancelled webhook. To withdraw a session before then, call POST /v1/checkout-sessions/{id}/cancel. That returns payment_in_progress if your customer has already started paying.

4. Pay it yourself in Test mode

Open the hostedUrl and pay as your customer would. The page is marked as a test payment, and in place of each wallet’s own steps it shows a practice version:

  • M-PAiSA: a practice screen with the amount. Approve payment makes the session succeeded; Decline payment makes it failed.
  • MyCash: enter any 7-digit Fiji mobile number, such as 7123456. No text is sent: the page shows the test code, 123456. A wrong code is refused so you can try again, and the right one makes the session succeeded.

Everything after that runs as it does for a real payment: the webhook is sent, the fee is taken, the session shows on your dashboard, and your customer is returned to successUrl.

5. Listen for the webhook

Transxact tells your server the outcome with a webhook, so you don’t have to poll. Add your endpoint’s URL in the Webhooks section of the dashboard. Every event looks like this, with the Checkout Session as it now stands:

{
"id": "evt_9c1e4b7a2d0f4e6b8a1c3d5e7f9a0b2c",
"type": "checkout_session.succeeded",
"data": {
"object": {
"id": "cs_3f9c2b1a",
"status": "succeeded",
"amount": 5000,
"currency": "FJD",
"hostedUrl": "https://transxact.io/c/cs_3f9c2b1a",
"metadata": { "orderId": "9912" },
"expiresAt": 1717086400000
}
}
}

The types are checkout_session.succeeded, checkout_session.failed and checkout_session.cancelled. Check the signature before trusting one: see Verifying webhooks.

Developing on your own machine? Webhook endpoints must be public https:// URLs, so localhost can’t receive them directly. Run a tunnel (such as cloudflared tunnel --url http://localhost:3000 or ngrok http 3000) and add its https:// address as an endpoint. The dashboard’s Send test button sends a signed webhook.test event there, so you can check your endpoint before paying anything.

6. Go live

Send your Verification from the dashboard whenever you’re ready. It’s reviewed in the background, with no blocking step or sales call, and you can keep building in Test mode meanwhile. Once it’s approved, the dashboard offers Create Live mode key. Swap sk_test_... for sk_live_... and nothing else changes. See Test vs Live mode.