fourpaypayments 0.1.4

Flutter Android iOS

4pay.online allows you to accept payments - comfortably and safely.

4PayPayments #

4PayPayments.

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

Example #

PaymentResult result;
if (Platform.isIOS) {
    result = await FourPayPayments.makeApplePayment(
        // Link ID
        <authToken>,
        // Apple Pay merchant ID
        <merchant_identifier>,
        // A short, localized description of the item.
        label: 'Label',
        // Payment Description
        description: 'Description',
        // The summary item’s amount.
        amount: <amount>,
        // Unique identificator
        txid: Uuid().v1(),
    );
} else if (Platform.isAndroid){
    result = await FourPayPayments.makeGooglePayment(
        // Link ID
        <authToken>,
        // Your shop ID
        <merchantId>,
        // The summary item’s amount.
        amount: <amount>,
        // Payment Description
        description: 'Description',
        // default 'themap'
        gateway: <gateway>,
        environment: <'test' or 'production'>,
        // Merchant name encoded as UTF-8. Merchant name is rendered in the payment sheet. In TEST environment, or if a merchant isn't recognized, a “Pay Unverified Merchant” message is displayed in the payment sheet.
        merchantInfo: <merchantName>,
        // Unique identificator
        txid: Uuid().v1(),
    );
} else {
    throw UnsupportedError("Unsupported platform");
}
if (result.hasError) {
    print(result.errorText);
} else {
    print(result.response);
}
3
likes
80
pub points
28%
popularity

Publisher

4pay.online

4pay.online allows you to accept payments - comfortably and safely.

Homepage

Documentation

API reference

License

Apache 2.0 (LICENSE)

Dependencies

dio, flutter

More

Packages that depend on fourpaypayments