📱Cowpay Flutter plugin

This document is a guide to the example project included in the plugin files. In addition, following the below steps will help you learn how to add and use (Cowpay plugin) in your flutter application.

1. REQUIREMENTS

Minimum Flutter version 2.5.0

2. INSTALLATION

dependencies:
  cowpay:
    git:
      url: https://github.com/CowpayPayment/Cowpay-Flutter.git
      ref: latest release version

You can find the latest version from here:

https://github.com/CowpayPayment/Cowpay-Flutter/releases

3. IMPORT

import 'package:cowpay/cowpay.dart';

4. USAGE

Create a widget and just return Cowpay-plugin widget in the build function as:

return Cowpay(
      localizationCode: LocalizationCode.en,
      amount: amount,
      customerEmail: 'customerEmail',
      customerMobile: 'customerMobile',
      customerLastName: 'customerName',
      customerFirstName: 'customerName',
      isFeesOnCustomer: true,
      logoStringUrl:'logoStringUrl',
      merchantMobile: 'merchantMobile',
      description: 'description',
      customerMerchantProfileId: 'customerMerchantProfileId',
      merchantReferenceId: 'merchantReferenceId',
      activeEnvironment: CowpayEnvironment.staging,
      merchantHashCode: 'merchantHashCode',
      merchantCode: 'merchantCode',
      onSuccess: (val) {
        debugPrint(val.paymentMethodName);
      },
      onError: (val) {
        debugPrint(val.toString());
      },
      onClosedByUser: () {
        debugPrint("closedByUser");
      },
    )

5. VALUES DESCRIPTION

Keys
Values

localizationCode

Select your language code enum value LocalizationCode.en for English, and LocalizationCode.ar if Arabic.

amount

two decimal value like "15.60", sent in case of partial capture

customerEmail

customer valid email

customerMobile

internationally formatted customer mobile (Should Start with country code (ex. +20 for Egypt Number))

customerLastName

customer last name being charged

customerFirstName

customer first name being charged

isFeesOnCustomer

is fees on customer or merchant

logoStringUrl

merchant logo url

merchantMobile

merchant mobile

description

charge request description that reserve the payment name

customerMerchantProfileId

ID of the customer being charged on your system

merchantReferenceId

Unique alphanumeric value required as identifier for the charge request

activeEnvironment

CowpayEnvironment.staging || CowpayEnvironment.production

merchantHashCode

Hash code that is presented in your panel.

merchantCode

Your code that is presented in your panel.

onSuccess

Call back function if transaction succeeds.

onError

Call back function when an error occurres.

onClosedByUser

Call back function if customer goes back before making a transaction.

Last updated