Developer Hub

    Build with TX Fabric

    Integration guides, API references, and code examples to get your payment flows live, from hosted cashier to full server-to-server control.

    Quickstart

    From setup to first transaction

    Four steps to get your integration running in the sandbox environment.

    01

    Get Your API Keys

    Register as a merchant and receive your sandbox API credentials from the TX Fabric dashboard.

    02

    Choose Your Integration

    Select from hosted cashier, embedded SDK, or server-to-server API based on your requirements.

    03

    Integrate & Test

    Integrate in your sandbox environment, test payment flows, and validate webhook handling.

    04

    Go Live

    Complete onboarding verification, switch to production credentials, and start processing.

    Authentication

    API keys & credentials

    All API requests are authenticated with Bearer tokens. TX Fabric provides separate keys for sandbox and production environments.

    • Sandbox keys (sk_test_...) for development and testing
    • Production keys (sk_live_...) for live transactions
    • Idempotency keys recommended for mutation requests
    • Rate limiting with generous thresholds per environment
    javascript
    // Authentication - all requests require a Bearer token
    const headers = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
      "X-Idempotency-Key": "unique-request-id",  // recommended
    };
    
    // API keys are environment-specific:
    // Sandbox: sk_test_...
    // Production: sk_live_...
    
    // Rate limits: 100 req/s per merchant (sandbox)
    //              500 req/s per merchant (production)

    Frontend Integration

    Two ways to integrate the cashier

    Use the hosted redirect for the fastest setup, or embed the SDK directly in your application for a seamless branded experience.

    Hosted Cashier Redirect

    The quickest integration path. Create a session on your server, then redirect or open the TX Fabric hosted cashier. No frontend build required.

    • Minimal frontend code
    • Fully managed UI & updates
    • PCI compliance handled
    • Mobile-optimised out of the box
    html
    <!-- TX Fabric Cashier - Hosted Redirect -->
    <script src="https://cdn.tx-fabric.com/cashier/v1/loader.js"></script>
    <script>
      TXFabric.Cashier.open({
        merchantId: "your-merchant-id",
        sessionToken: sessionToken,   // from server-side session creation
        amount: 5000,                 // in minor units (e.g. cents)
        currency: "EUR",
        locale: "en",
        onComplete: (result) => {
          console.log("Payment result:", result.status);
        },
        onError: (error) => {
          console.error("Cashier error:", error.message);
        }
      });
    </script>

    API Reference

    Server-to-server API

    RESTful endpoints for session management, transaction processing, payouts, and merchant operations.

    POST/v1/sessions

    Creates a new payment session. Returns a session token for frontend initialisation and a redirect URL for hosted cashier flows.

    javascript
    // Server-side - Create a payment session
    const response = await fetch("https://api.tx-fabric.com/v1/sessions", {
      method: "POST",
      headers: {
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        merchant_id: "your-merchant-id",
        amount: 5000,
        currency: "EUR",
        type: "deposit",
        customer: {
          email: "customer@example.com",
          reference: "cust_12345",
        },
        callback_url: "https://yoursite.com/api/webhooks/txfabric",
        redirect_url: "https://yoursite.com/payment/complete",
      }),
    });
    
    const session = await response.json();
    // session.token -> pass to frontend
    // session.redirect_url -> redirect for hosted cashier

    Core Endpoints

    POST/v1/sessions
    GET/v1/sessions/:id
    GET/v1/transactions/:id
    GET/v1/transactions
    POST/v1/refunds
    POST/v1/payouts
    GET/v1/methods
    GET/v1/merchants/:id

    Webhooks & Events

    Real-time event notifications

    TX Fabric sends webhook events for all transaction state changes. Verify signatures, process events, and keep your system in sync.

    Available Events

    transaction.completedPayment successfully processed
    transaction.failedPayment attempt failed
    transaction.pendingAwaiting confirmation
    transaction.refundedRefund processed
    withdrawal.approvedPayout approved and initiated
    withdrawal.completedPayout delivered
    session.expiredPayment session timed out
    javascript
    // Express.js webhook handler
    app.post("/api/webhooks/txfabric", (req, res) => {
      const signature = req.headers["x-txfabric-signature"];
    
      // Verify webhook signature
      if (!verifySignature(req.body, signature, WEBHOOK_SECRET)) {
        return res.status(401).send("Invalid signature");
      }
    
      const event = req.body;
    
      switch (event.type) {
        case "transaction.completed":
          // Credit user account
          creditAccount(event.data.customer_ref, event.data.amount);
          break;
    
        case "transaction.failed":
          // Notify user of failure
          notifyFailure(event.data.customer_ref, event.data.reason);
          break;
    
        case "withdrawal.approved":
          // Process payout
          processPayout(event.data);
          break;
    
        default:
          console.log("Unhandled event:", event.type);
      }
    
      res.status(200).json({ received: true });
    });

    Sandbox & Testing

    Test everything before going live

    Full sandbox environment with test credentials, simulated payment flows, and debugging tools.

    Test Credentials

    Dedicated sandbox API keys with no real money movement.

    Simulated Flows

    Test cards and bank accounts that simulate success, failure, and pending states.

    Webhook Testing

    Replay and inspect webhook deliveries in the sandbox dashboard.

    3DS Simulation

    Test 3D Secure challenge and frictionless flows with test cards.

    API Logs

    Full request/response logging for every API call in sandbox.

    Scenario Testing

    Trigger specific outcomes (timeout, decline, partial) with test parameters.

    Ready to start building?

    Register as a merchant to get your sandbox credentials, or talk to our team about your integration requirements.