Quick Start

Get started with Nory in under 5 minutes. Accept crypto payments with just a few lines of code.

1. Install the SDK

npm install nory-sdk
# or
yarn add nory-sdk
# or
pnpm add nory-sdk

2. Initialize Nory

import { Nory } from 'nory-sdk';

const nory = new Nory({
  merchantWallet: 'YOUR_WALLET_ADDRESS',
  network: 'solana-mainnet', // or 'base-mainnet', 'polygon-mainnet', etc.
});

3. Create a Payment Requirement

// Return 402 Payment Required with payment details
app.get('/api/premium-content', async (req, res) => {
  const hasPayment = req.headers['x-payment'];

  if (!hasPayment) {
    const requirement = nory.createRequirement({
      amount: '1.00',      // $1.00 USDC
      currency: 'USDC',
      resource: '/api/premium-content',
      description: 'Access to premium content',
    });

    return res.status(402).json(requirement);
  }

  // Verify and settle payment
  const result = await nory.verifyAndSettle(hasPayment);

  if (!result.valid) {
    return res.status(402).json({ error: result.invalidReason });
  }

  // Payment successful - return content
  return res.json({ content: 'Premium content here!' });
});

4. Test with Echo Mode

Use our Echo endpoint to test payments for free. All payments are automatically refunded!

curl -X POST https://nory.io/api/echo \
  -H "Content-Type: application/json" \
  -d '{
    "amount": "1000000",
    "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
  }'

🎉 That's it!

You're now ready to accept crypto payments. Check out the API Reference for more advanced usage, or explore our SDK for framework-specific integrations.