Payfast
Open-source wrapper library built to make using the Payfast API with Flutter much easier.
N.B. Has only been tested in Payfast Sandbox!
Usage
Add import
import 'package:payfast/payfast.dart';
Setup simple payment
var payfast = Payfast(
merchantId: 'merchant-id',
merchantKey: 'merchant-key',
passphrase: 'passphrase-set-in-sandbox',
paymentType: PaymentType.SimplePayment,
production: true || false,
);
payfast.createSimplePayment(
amount: 100,
itemName: 'Soap',
);
Setup recurring payment
var payfast = Payfast(
merchantId: 'merchant-id',
merchantKey: 'merchant-key',
passphrase: 'passphrase-set-in-sandbox',
paymentType: PaymentType.RecurringBilling,
production: true || false,
);
payfast.createSubsriptionPayment(
amount: 100,
itemName: 'CAS',
subscriptionType: SubscriptionType.subscription,
billingDate: '2022-07-06',
cycles: 2,
cyclePeriod: FrequencyCyclePeriod.Monthly,
recurringAmount: 100,
);
Generate Url
print(payfast.generateURL());
Inspired by https://github.com/GetTruck/payfast-js