Skip to main content

Flutter / Dart SDK

Official package:

pub.dev

Installation

flutter pub add payisland

Alternative pubspec.yaml entry:

dependencies:
payisland: ^0.1.0

Initialize a Transaction

import 'package:payisland/payisland.dart';

final payIsland = PayIslandClient(secretKey: 'PAYISLAND_SECRET_KEY');

final response = await payIsland.transactions.initialize({
'callback_url': 'https://example.com/webhooks/payislands',
'payment_item_id': '6',
'transaction_reference': 'order_${DateTime.now().millisecondsSinceEpoch}',
'channel': 'card',
'amount': '1000',
'customer_info': {
'email': 'ada@example.com',
'phone_number': '08011112222',
'first_name': 'Ada',
'last_name': 'Lovelace',
},
});

print(response['data']['authorization_url']);

For public mobile apps, do not put PAYISLAND_SECRET_KEY in the app bundle. Initialize the transaction from your backend, then pass the returned authorization_url to the app.

Verify a Transaction

final verification = await payIsland.transactions.verify('order_12345');
final status = verification['data']['payment_status'];

if (['paid', 'successful', 'success'].contains(status)) {
// Fulfill the order.
} else if (['pending', 'unpaid'].contains(status)) {
// Wait for completion and verify again later.
} else {
// Treat as failed or not completed.
}

The SDK calls:

GET /api/v1/transactions/in/check-transaction-status/{reference}

Webhook Signature Verification

final isValid = payIsland.webhooks.verifySignature(
payload: rawPayload,
signature: signature,
secret: webhookSecret,
);

if (!isValid) {
throw Exception('Invalid PayIsland webhook signature');
}

final verification = await payIsland.transactions.verify(reference);

Verify the transaction reference before fulfilling, even after a valid webhook signature.

Notes

  • Use PAYISLAND_SECRET_KEY only in trusted server-side Dart environments.
  • PayIsland chooses sandbox or live mode from the API key.
  • The default API base URL is https://ags.payislands.com.
  • Amounts are strings in the major currency unit. "1000" means NGN 1,000.