Comprehensive API documentation with code examples, use cases, and step-by-step guides for building and managing your commerce solutions.
Initialize the SDK with your API key from the Merchant.js dashboard.
const merchant = new Merchant({
apiKey: 'YOUR_MERCHANT_API_KEY',
environment: 'production' // or 'staging'
});
Enable 1-click payments and support for 180+ markets and 25+ gateways.
merchant.checkout
.create({
items: [
{ product_id: 'SKU-12345', quantity: 1 },
{ gift_card: 'CUSTOM', amount: 2500 }
],
successUrl: 'https://yourapp.com/success',
cancelUrl: 'https://yourapp.com/cancel'
})
.then(url => {
// Show payment confirmation
showPaymentModal(url);
});
Create subscription plans with grace periods, proration, and trial management.
merchant.subscriptions
.create({
customer: {
name: 'Jane Smith',
email: 'jane@example.com'
},
plan: {
id: 'premium_monthly',
amount: 29900,
interval: 'month',
trialDays: 14
}
})
.then(subscription => {
// Send confirmation email
merchant.notifications.email({
template: 'subscription_confirmation',
to: subscription.customer.email
});
});
Explore all Merchant.js capabilities in our interactive API reference.