Integration

Client libraries

Official SDKs for popular languages. All handle authentication, request signing, retries, and webhook verification for you.

JS
Node.js
@blockcade/node · v0.1.0
Stable
Zero-dependency, TypeScript types included. Node ≥ 16.
npm install @blockcade/node
Py
Python
blockcade
Coming soon
Requests-based. Python ≥ 3.9.
PH
PHP
blockcade/php
Coming soon
PHP ≥ 8.0. cURL-based.
Ru
Ruby
blockcade
Coming soon
Ruby ≥ 3.0.
Go
Go
github.com/blockcade/blockcade-go
Coming soon
Go ≥ 1.21.
Ja
Java
app.blockcade:sdk
Coming soon
JDK ≥ 17.

Common usage — Node.js

const Blockcade = require('@blockcade/node');
const bc = new Blockcade({ apiKey: process.env.BLOCKCADE_KEY });

// Create
const session = await bc.sessions.create({
  amount: 25, currency: 'USD',
  accepted_currencies: ['USDC', 'USDT'],
});

// Retrieve
const s = await bc.sessions.retrieve('ref_a8Kj29Xz10');

// List
const { data } = await bc.sessions.list();

// Cancel
await bc.sessions.cancel('ref_a8Kj29Xz10');

// Verify webhook
const ok = Blockcade.webhooks.verify({
  payload: rawBody, signature: sigHeader, secret: process.env.WHSEC,
});

Error handling

try {
  await bc.sessions.retrieve('ref_nope');
} catch (err) {
  if (err instanceof Blockcade.BlockcadeError) {
    console.log(err.status, err.type, err.message);
  }
}

Raw HTTP

Prefer no SDK? See Payments API for cURL examples.