Selling Guide
Learn how to accept payments with MoneyMQ
MoneyMQ is a developer-first payment infrastructure for accepting stablecoin payments.
Quick Start
Get started in under 5 minutes with our SDK.
Installation
npm install @moneymq/sdkpnpm add @moneymq/sdkyarn add @moneymq/sdkbun add @moneymq/sdkInitialize the Client
import { MoneyMQ } from '@moneymq/sdk';
const moneymq = new MoneyMQ({
url: 'http://localhost:8488',
});Catalog
Manage your products and pricing through the catalog namespace.
Listing Products
const products = await moneymq.catalog.products.list();console.log(products);Listing Prices
const prices = await moneymq.catalog.prices.list();console.log(prices);User Payment
Accept one-time payments using the MoneyMQ browser extension.
Browser Extension Wallets
Many crypto-native users manage their funds through browser extension wallets like Phantom or Backpack. MoneyMQ integrates seamlessly with these wallets, allowing customers to approve payments with a single click.
import { MoneyMQ } from '@moneymq/sdk'import { MoneyMQProvider, PayButton } from '@moneymq/react'const client = new MoneyMQ({ url: 'http://localhost:8488',})// Fetch products, get the first one, then fetch its priceconst products = await client.catalog.products.list()const product = products[0]const prices = await client.catalog.prices.list({ product: product.id})const price = prices[0]function App() { return ( <MoneyMQProvider client={client}> <PayButton product={product} price={price} onSuccess={(payment) => { console.log('Paid:', payment.id) }} > Pay </PayButton> </MoneyMQProvider> )}Agentic Payment
Accept payments from AI agents using the x402 protocol.
x402 Protocol Integration
Monetize API endpoints with automatic micropayments. AI agents pay per-request using the HTTP 402 standard.
import { x402 } from '@moneymq/x402';
app.get('/api/premium',
x402({ amount: 0.01, currency: 'USDC' }),
(req, res) => {
res.json({ data: 'Premium content' });
}
);When an AI agent hits this endpoint, payment is negotiated and settled automatically within a single HTTP request cycle.
Webhooks
Receive real-time notifications for payment events.
Webhook Events
| Event | Description |
|---|---|
payment.completed | Payment successfully processed |
payment.failed | Payment attempt failed |
checkout.session.completed | Checkout session finished |
subscription.created | New subscription started |
subscription.canceled | Subscription was canceled |
payout.sent | Funds sent to your wallet |
Handling Webhooks
import { Webhook } from '@moneymq/sdk';
const webhook = new Webhook(process.env.MONEYMQ_WEBHOOK_SECRET);
app.post('/webhooks/moneymq', express.raw({ type: 'application/json' }), (req, res) => {
const event = webhook.verify(req.body, req.headers['x-moneymq-signature']);
switch (event.type) {
case 'payment.completed':
const payment = event.data;
// Fulfill the order
await fulfillOrder(payment.metadata.orderId);
break;
case 'subscription.created':
const subscription = event.data;
// Provision access
await grantAccess(subscription.customerId, subscription.planId);
break;
}
res.json({ received: true });
});Customers
Manage customer data through the payment.customers namespace.
Creating Customers
const customer = await moneymq.payment.customers.create({
email: 'customer@example.com',
name: 'Jane Doe',
metadata: {
userId: 'usr_123',
},
});Retrieving Customer Data
const customer = await moneymq.payment.customers.retrieve('cus_xxxxx', {
expand: ['subscriptions', 'payments'],
});
console.log(customer.subscriptions); // Active subscriptions
console.log(customer.payments); // Payment historyUpdating Customers
await moneymq.payment.customers.update('cus_xxxxx', {
name: 'Jane Smith',
metadata: { tier: 'premium' },
});Payouts
Configure automatic payouts through the payment.payouts namespace.
Payout Settings
await moneymq.payment.payouts.settings.update({
// Payout to Solana wallet
destination: {
type: 'wallet',
address: 'YourSolanaWalletAddress...',
currency: 'USDC',
},
schedule: 'daily', // 'instant', 'daily', 'weekly', 'monthly'
minimumAmount: 10000, // $100 minimum payout
});Manual Payout
const payout = await moneymq.payment.payouts.create({
amount: 50000, // $500.00
currency: 'USDC',
destination: 'YourSolanaWalletAddress...',
});Listing Payouts
const payouts = await moneymq.payment.payouts.list({
status: 'completed',
limit: 10,
});Testing
Use test mode to simulate payments without real funds.
Test Credentials
# Use test URL and secret for sandbox environment
MONEYMQ_URL=https://sandbox.moneymq.com
MONEYMQ_SECRET=mmq_sk_test_xxxxxxxxxxTest Wallets
MoneyMQ provides pre-funded test wallets in your dashboard. Use these to simulate customer payments in your development environment.
Simulating Events
// Trigger test webhook events
await moneymq.payment.webhooks.trigger('payment.completed', {
paymentId: 'pay_test_xxxxx',
});Framework Guides
Next.js
// app/api/checkout/route.ts
import { MoneyMQ } from '@moneymq/sdk';
import { NextResponse } from 'next/server';
const moneymq = new MoneyMQ({
url: process.env.MONEYMQ_URL ?? 'http://localhost:8488',
});
export async function POST(request: Request) {
const { priceId } = await request.json();
const session = await moneymq.payment.checkout.create({
lineItems: [{ price: priceId, quantity: 1 }],
successUrl: `${process.env.NEXT_PUBLIC_URL}/success`,
cancelUrl: `${process.env.NEXT_PUBLIC_URL}/pricing`,
});
return NextResponse.json({ url: session.url });
}Express
import express from 'express';
import { MoneyMQ } from '@moneymq/sdk';
const app = express();
const moneymq = new MoneyMQ({
url: process.env.MONEYMQ_URL ?? 'http://localhost:8488',
});
app.post('/create-checkout', async (req, res) => {
const session = await moneymq.payment.checkout.create({
lineItems: [{ price: req.body.priceId, quantity: 1 }],
successUrl: 'https://yoursite.com/success',
cancelUrl: 'https://yoursite.com/cancel',
});
res.json({ url: session.url });
});Best Practices
- Always verify webhooks — Use signature verification to ensure events are from MoneyMQ
- Use idempotency keys — Prevent duplicate charges with unique request identifiers
- Handle failures gracefully — Implement retry logic for network issues
- Store payment references — Keep track of payment IDs for reconciliation
- Test thoroughly — Use test mode before going live
Need Help?
- Documentation: docs.moneymq.com
- Discord: discord.gg/moneymq
- Email: support@moneymq.com