Dart SDK - Payments#

M-Pesa (STK push) and Snippe (mobile money, hosted checkout).

Settings#

await db.payments.getSettings();

await db.payments.updateSettings(
  mpesaConsumerKey: '...',
  mpesaConsumerSecret: '...',
  snippeApiKey: '...',
);
DART

M-Pesa STK push#

await db.payments.stkPush(
  phone: '+255712345678',
  amount: 5000,
  description: 'Order #123',
);
DART

The customer authorizes on their phone; RafikiDB receives the callback and records the transaction.

Snippe#

// Direct mobile money payment
await db.payments.snippeInitiate(
  amount: 5000,
  phone: '+255712345678',
  firstName: 'Asha',
  lastName: 'Mwinyi',
  email: 'asha@example.com',
  orderId: 'ORD-123',
);

// Hosted checkout session
await db.payments.snippeSession(
  amount: 25000,
  description: 'Checkout',
  redirectUrl: 'https://myapp.com/thanks',
  customerName: 'Asha Mwinyi',
  customerPhone: '+255712345678',
  expiresIn: 3600,
);
DART

Status and transactions#

await db.payments.snippeStatus(reference);
await db.payments.listTransactions();
await db.payments.getTransaction(transactionId);
DART

Payment callbacks are HMAC-signed like webhooks.

Next: Errors.