Skip to content

Backend Integration

@cryptumpay/node-sdk

npm version

Learn how to integrate CryptumPay with your backend server for secure order creation, withdrawals, and payment verification.

Overview

For production applications with fixed prices, you should create orders on your backend. This ensures:

  • Security — Prices can't be manipulated by users
  • Validation — Inventory and business logic checks
  • Tracking — Proper order management in your database

Integration Steps

Frontend Side

Implement the onCreateOrder callback that calls your backend endpoint and returns the order ID.

Backend Side

Create an endpoint that:

  1. Applies your business logic (validate cart, check inventory, etc.)
  2. Creates an order via CryptumPay API using the Node.js SDK
  3. Returns the order ID to frontend

TIP

The backend endpoint may receive parameters from frontend if needed for business logic, or use existing session data (user ID, cart contents, etc.)

Project API

The Project API is the server-to-server interface for managing orders and withdrawals. All requests are authenticated with a key/secret pair and HMAC request signatures.

bash
npm install @cryptumpay/node-sdk
typescript
import { CryptumPayClient, CryptumPaySigner } from '@cryptumpay/node-sdk';

const client = new CryptumPayClient(
  new CryptumPaySigner(
    process.env.CRYPTUMPAY_API_KEY,
    process.env.CRYPTUMPAY_API_SECRET
  )
);

const response = await client.createOrder({
  title: 'Order #12345',
  description: 'Shopping cart checkout',
  fiatAmount: '49.99',
  fiatCurrency: 'usd',
});

API Reference

PageDescription
AuthenticationHow to obtain API keys, sign requests, configure IP whitelist, and handle auth errors
EndpointsAll available endpoints: create order, get order, withdraw, get withdrawal status
Webhooks & RedirectsReceiving payment event notifications and handling post-payment redirects

See Also

Released under the MIT License.