CrypaxDocs

Overview

Crypax is a cryptocurrency payment gateway. Integrate crypto payments into your service using our SDK and REST API.


What is Crypax?

Crypax follows the same PaymentIntent pattern as Stripe — you create a payment on your server with a secret key, then confirm it on the client with a publishable key. The client secret acts as a short-lived token that lets the frontend complete the payment without exposing your secret key.

Core Concepts

API Keys

Each account has two types of keys. The Secret Key (sk_live_) is used only on the server. The Publishable Key (pk_live_) is safe to expose in client-side code.

Key TypePrefixUsage
Secret Keysk_live_Server only — create/retrieve payments, verify webhooks
Publishable Keypk_live_Client-side — confirm payments via SDK

Payment Lifecycle

A payment moves through these states: createdprocessing (txHash submitted) → confirmed (on-chain verified). If not confirmed before expiresAt, it becomes expired. A verification failure results in failed.

Client Secret Pattern

When you create a payment on the server, the response includes a clientSecret (prefixed cs_live_). Pass this to your frontend — it's safe to expose because it only allows confirming that specific payment. The SDK uses it to open the payment modal and submit the transaction.

Webhook Events

Crypax sends signed POST requests to your webhook URL when payment status changes. Events: payment.created, payment.confirmed, payment.expired, payment.failed. Verify the x-crypax-signature header with your webhook secret using HMAC-SHA256.


SDK Packages

Crypax provides four packages. Pick the one that matches your environment.

@crypax/jsBrowser

Core browser SDK. ShadowDOM payment modal, no framework dependency.

@crypax/reactReact

React hooks and components. CrypaxProvider, useConfirmPayment, useWallet, CheckoutButton.

@crypax/vueVue

Vue composables and components. CrypaxPlugin, useConfirmPayment, useWallet, CheckoutButton.

@crypax/nodeNode.js

Server-side SDK. Create and manage payments, verify webhooks.

Install

$ npm install @crypax/react

Code Example

A complete payment flow: create on the server, confirm on the client.

Server (Node.js)

server.ts
import { Crypax, PLUMISE_MAINNET } from '@crypax/node';

const crypax = new Crypax('sk_live_your_secret_key', {
  apiUrl: 'https:0
});

const payment = await crypax.payments.create({
  amount: '1.0',
  recipientAddress: '0xYourWalletAddress',
  chainId: PLUMISE_MAINNET.chainId,  1
  currency: 'native',
  orderId: 'order_123',
  description: 'Premium Plan',
  expiresInMinutes: 30,
});

// payment.clientSecret → send to frontend

Client

Checkout.tsx
import { CrypaxProvider, useConfirmPayment } from '@crypax/react';

function App() {
  return (
    <CrypaxProvider publishableKey="pk_live_your_key">
      <Checkout clientSecret="cs_live_..." />
    </CrypaxProvider>
  );
}

function Checkout({ clientSecret }: { clientSecret: string }) {
  const { confirmPayment, status } = useConfirmPayment();

  return (
    <button
      onClick={() => confirmPayment(clientSecret)}
      disabled={status !== 'idle'}
    >
      {status === 'idle' ? 'Pay Now' : status}
    </button>
  );
}

Documentation | Crypax