AutoCash Dart SDK

autocash is a Dart & Flutter SDK that allows you to create payment links and verify payments automatically using the AutoCash system.

Supported payment methods:

  • Vodafone Cash (VF-Cash)
  • OKX
  • Binance

The SDK is designed to be:

  • ✅ Type-safe
  • ✅ Flutter-friendly (Android / iOS / Web)
  • ✅ Production-ready
  • ✅ Easy to integrate with any backend

Requirements

  • Dart 3.10 or later
  • Flutter (supported)
  • Internet connection

Add dependency in pubspec.yaml:

dependencies:
  autocash: ^1.0.3

Installation

Install via CLI:

dart pub add autocash

Then import it in your project:

import 'package:autocash/autocash.dart';

Initialization

Create an instance of AutoCash using your credentials:

final autoCash = AutoCash(
  userId: 'YOUR_USER_ID',
  panelId: 'YOUR_PANEL_ID',
);
  • panelId is required and identifies your AutoCash panel
  • userId is kept for compatibility with the original PHP API

Get Panel Information

Using async / await:

final info = await autoCash.getPanelInfo();

print(info.number);
print(info.rate);
print(info.currency);
print(info.method);

Using then:

autoCash.getPanelInfo().then((info) {
  print(info);
});

Returned object: PanelInfo


Vodafone Cash

final vfLink = autoCash.vfcashLink(
  extra: 'order_123',
);

OKX

final okxLink = autoCash.okxLink(
  100,
  extra: 'order_123',
);

Binance

final binanceLink = autoCash.binanceLink(
  100,
  extra: 'order_123',
);

Using extra

The extra parameter is sent to the AutoCash server as-is and returned back with the verification result or callback.

Typical uses:

  • User ID
  • Order ID
  • Username
  • Internal reference value

Verify Vodafone Cash Payment

final result = await autoCash.checkVFCash(
  phone: '01012345678',
  amount: 100,
  extra: 'order_123',
);

print(result.status);
print(result.message);
print(result.key);

Verify OKX Payment

final result = await autoCash.checkOKX(
  txid: 'TX_ID',
  amount: 100,
  extra: 'order_123',
);

Verify Binance Payment

final result = await autoCash.checkBinance(
  txid: 'TX_ID',
  amount: 100,
  extra: 'order_123',
);

PaymentResult Object

All verification methods return a PaymentResult:

result.status    // success | fail
result.message   // human-readable message
result.key       // transaction key (nullable)

Example API response:

{
  "status": "success",
  "message": "Payment completed successfully",
  "key": "TRANSACTION_KEY"
}

To hide the real payment URL from users:

final safeLink = autoCash.redirect(vfLink);

You can send safeLink instead of the original payment URL.


Error Handling

All SDK errors throw AutoCashException:

try {
  await autoCash.getPanelInfo();
} catch (e) {
  print('Error: $e');
}

Flutter Example (Vodafone Cash)

A simple Flutter example is provided below:

Features:

  • Enter phone number
  • Enter amount
  • Generate payment link
  • Verify Vodafone Cash payment

File: example/main.dart

(See Flutter example source code in the documentation or repository)


Workflow Overview

  1. Create payment link
  2. Redirect user to payment
  3. User completes payment
  4. Call verification API
  5. Receive result (success / fail)
  6. Use transaction key for reference

Important Notes

  • Always validate payments using the API response
  • Do not rely on client-side time
  • Store the returned key for future reference
  • Consider using integer values for money to avoid floating-point issues

License

MIT

Libraries

autocash