sagepay 0.0.7+21 copy "sagepay: ^0.0.7+21" to clipboard
sagepay: ^0.0.7+21 copied to clipboard

Flutter plugin for SagePay services. It supports the android and iOS platforms and it is easy to use. It's used for making payment as a Sagecloud merchant.

Flutter plugin for sagepay SDK

Getting started #

To use this plugin, add sagepay as a dependency in your pubspec.yaml file.

How to Use #

This plugin uses two APIs

  1. Create a SagePay instance by calling the constructor SagePay. The constructor accepts a required instance of the following: context, business, reference, callbackUrl, amount, token It returns an instance of SagePay which we then call the async method .chargeTransaction() on.
import 'package:sagepay/sagepay.dart';

final sagePay = SagePay(
   context: context,
   amount: 100,
   reference: "{{randomly generated string}}",
   callbackUrl: "{{call back url}}",
   token: "{{Secret Key}}",
   business: Business(name: "{{business name}}", email: "{{business email}}"),
   paymentMethod: 'card,transfer',
   metadata: {
      "name":"Ladenifer Jada",
      "email":"ladjada@ymail.com"
   }
);

PaymentResponse? response = await sagePay.chargeTransaction();
  1. Handle the response Calling the .chargeTransaction() method returns a Future of PaymentResponse which we await for the actual response as seen above.
PaymentResponse? response = await sagePay.chargeTransaction();

if (response != null) {
  if(response.success!) {
    //handle success response 
  } else {
    //Handle not successful 
  }
} else {
  //User cancelled checkout
}

Additional information #

2
likes
120
points
4
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for SagePay services. It supports the android and iOS platforms and it is easy to use. It's used for making payment as a Sagecloud merchant.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

dio, flutter, flutter_inappwebview, google_fonts

More

Packages that depend on sagepay