@solinkify/pay
v0.2.1
Published
Solinkify Pay server-side SDK — hosted checkout sessions and ready-to-sign Solana payment transactions (USDC/USDT, on-chain fee split).
Maintainers
Readme
@solinkify/pay
Server-side SDK for Solinkify Pay — accept stablecoin payments (USDC / USDT on Solana) from any backend with a hosted checkout. Funds settle merchant-side with the fee split enforced on-chain (99% merchant); Solinkify never holds your money.
Already using WooCommerce, OpenCart, or PrestaShop? Use the ready-made plugins instead. Just need a button on a static site? Use the embeddable widget. This SDK is for custom backends.
Install
npm install @solinkify/payNode ≥ 20.19 (built-in fetch).
Quick start — hosted checkout
import { SolinkifyPay } from '@solinkify/pay';
const pay = new SolinkifyPay();
// 1. Create a session when the buyer checks out
const session = await pay.createCheckoutSession({
merchantWallet: 'YOUR_SOLANA_WALLET',
amount: 19.99, // in `currency` below
currency: 'USD', // non-USD (EUR, IDR, ...) is FX-converted
orderId: 'INV-1042',
tokenMint: 'USDC', // USDC | USDT (or a mint address)
returnUrl: 'https://store.com/thanks',
cancelUrl: 'https://store.com/cart',
});
// 2. Redirect the buyer
res.redirect(session.checkoutUrl); // hosted page: connect wallet → pay
// 3. Confirm server-side (webhook-free polling or on the return redirect)
const record = await pay.getSession(session.sessionId);
if (record.status === 'paid') {
// fulfil the order
}The buyer pays on solinkify.com/checkout/<session> — wallet connect, amount and
token pinned to the session, on-chain verification. Sessions expire automatically
if unpaid.
API
| Method | Purpose |
|---|---|
| createCheckoutSession(params) | Create a hosted checkout session → { sessionId, checkoutUrl, expiresAt } |
| getSession(id) | Read a session (status: pending / paid / expired) |
| verifySession(id, { buyerWallet, signature }) | Submit a payment proof for verification (used by custom checkout UIs) |
| listSessions(merchantWallet, limit?) | Merchant's sessions, newest first |
| createPaymentTransaction(params) | Advanced: ready-to-sign Solana transaction for embedded wallet UX |
Advanced: embedded wallet UX
Skip the hosted page and build the payment into your own UI — the returned transaction already carries the on-chain fee split (99% merchant) and routes through the Solinkify DePIN relay network when available:
const tx = await pay.createPaymentTransaction({
merchantWallet: 'MERCHANT_WALLET',
buyerWallet: 'BUYER_WALLET',
amount: 1.5, // token units (1.5 USDC)
orderId: 'INV-1042',
tokenMint: 'USDC',
});
// hand `tx` to the buyer's wallet to sign & send,
// then verifySession / your own confirmation flowConfiguration
new SolinkifyPay({ apiUrl: 'https://api.solinkify.com' }); // defaultLicense
MIT © Solinkify
