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: '...',
);
DARTM-Pesa STK push#
await db.payments.stkPush(
phone: '+255712345678',
amount: 5000,
description: 'Order #123',
);
DARTThe 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,
);
DARTStatus and transactions#
await db.payments.snippeStatus(reference);
await db.payments.listTransactions();
await db.payments.getTransaction(transactionId);
DARTPayment callbacks are HMAC-signed like webhooks.
Next: Errors.