Quickstart

Get your first payment in 5 minutes.

1. Create an account

Sign up at app.ynopay.com and grab your test API key from the dashboard.

2. Install the SDK

npm install @ynopay/node

3. Create a payment

import { YnoPay } from '@ynopay/node';

const ynopay = new YnoPay('sk_test_...');

// Create a payment intent
const pi = await ynopay.paymentIntents.create({
  amount: 5000,        // 5,000 FCFA
  currency: 'XOF',
  rail: 'orange_money',
  metadata: { order_id: 'ORD-001' },
});

console.log(pi.id);     // pi_abc123
console.log(pi.status); // requires_payment_method

4. Create a checkout session

const session = await ynopay.checkoutSessions.create({
  paymentIntentId: pi.id,
});

// Redirect the customer to the hosted checkout page
console.log(session.url); // https://pay.ynopay.com/cs_xxx

5. Handle the webhook

// Express example
app.post('/webhooks/ynopay', (req, res) => {
  const event = req.body;

  if (event.type === 'payment_intent.succeeded') {
    console.log('Payment succeeded:', event.data.id);
    // Fulfill the order
  }

  res.sendStatus(200);
});

Next steps