API Reference
Transactions
Create and manage FedaPay transactions.
TransactionsRepository
Access via FedaFlutter.instance.transactions.
Methods
getTransactions()
Returns a paginated list of transactions.
final res = await repo.getTransactions();
// res.data → List<Transaction>
// res.meta → pagination info
getTransaction(int id)
Returns a single transaction by ID.
final res = await repo.getTransaction(42);
print(res.data?.status); // 'approved'
createTransaction(dynamic data)
Creates a new transaction. Accepts a TransactionCreate DTO or a raw Map.
final res = await repo.createTransaction(TransactionCreate(
description: 'Order #42',
amount: 5000,
currency: CurrencyIso(iso: 'XOF'),
callbackUrl: 'https://yourapp.com/callback',
customer: CustomerCreate(
firstname: 'John',
lastname: 'Doe',
email: 'john@example.com',
phoneNumber: PhoneNumber(number: '97000000', country: 'BJ'),
),
));
updateTransaction(int id, dynamic data)
Updates an existing transaction.
await repo.updateTransaction(42, TransactionCreate(
description: 'Updated order',
amount: 6000,
currency: CurrencyIso(iso: 'XOF'),
));
directPayment(dynamic data, {String mode})
Initiates a direct mobile money payment using an existing transaction token.
final res = await repo.directPayment(
TransactionDirectPayment(
currency: CurrencyIso(iso: 'XOF'),
description: 'Direct payment',
amount: 5000,
token: 'existing_tx_token',
phoneNumber: PhoneNumber(number: '97000000', country: 'BJ'),
),
mode: 'moov',
);
DTOs
TransactionCreate
| Field | Type | Required |
|---|---|---|
description | String | ✅ |
amount | num | ✅ |
currency | CurrencyIso | ✅ |
callbackUrl | String? | ❌ |
customMetadata | Map? | ❌ |
customer | CustomerCreate? | ❌ |
TransactionDirectPayment
| Field | Type | Required |
|---|---|---|
currency | CurrencyIso | ✅ |
description | String | ✅ |
amount | num | ✅ |
token | String | ✅ |
phoneNumber | PhoneNumber | ✅ |