4PayPayments

4PayPayments.

class PaymentResult {
  String errorText;
  bool get hasError => (errorText ?? "").isNotEmpty;
  String response;
}

Example

PaymentResult result;
if (Platform.isIOS) {
    result = await FourPayPayments.makeApplePayment(
        <authToken>,
        <merchant_identifier>,
        label: 'Label',
        description: 'Description',
        amount: 1,
        txid: Uuid().v1(),
    );
} else if (Platform.isAndroid){
    result = await FourPayPayments.makeGooglePayment(
        <authToken>,
        <merchantId>,
        amount: 1,
        description: 'Description',
        gateway: <gateway>,
        environment: <'test' or 'production'>,
        merchantInfo: <merchantName>,
        txid: Uuid().v1(),
    );
} else {
    throw UnsupportedError("Unsupported platform");
}
if (result.hasError) {
    print(result.errorText);
} else {
    print(result.response);
}

Libraries

fourpaypayments