Skip to content

Wrapper library built around the Payfast payment intergration that allows for different types of payments to be setup and made from Flutter apps.

Notifications You must be signed in to change notification settings

JoshMunstermann/payfast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!

Use ngrok and nodejs getting started guide to recieve and respond to webhook.

Usage

Import the package with

import 'package:payfast/payfast.dart';

Default Setup

var payfast = Payfast(
    passphrase: 'JoshuaMunstermann',
    paymentType: PaymentType.SimplePayment,
    production: false,
    merchantDetails: MerchantDetails(
      merchant_id: '10026561',
      merchant_key: 'cwon220sjr9ga',
      notify_url: 'https://b5f5-196-30-8-166.eu.ngrok.io',
      return_url: 'https://google.com',
    ),
  );

Simple payment

payfast.createSimplePayment(amount: '100', itemName: 'TV');
print(payfast.generateURL());

Recurring Billing

Subscription

payfast.setRecurringBillingType(RecurringPaymentType.subscription);
payfast.setupRecurringBillingSubscription(
    amount: 100,
    itemName: 'TV',
    billingDate: '2022-07-25',
    cycles: 2,
    cyclePeriod: FrequencyCyclePeriod.Monthly,
    recurringAmount: 300,
  );
print(payfast.generateURL());

Tokenization (Documentation incomplete)

payfast.setRecurringBillingType(RecurringPaymentType.tokenization);
payfast.setupRecurringBillingTokenization();
print(payfast.generateURL());

Inspired by https://github.com/GetTruck/payfast-js

About

Wrapper library built around the Payfast payment intergration that allows for different types of payments to be setup and made from Flutter apps.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages