fourpaypayments 0.1.4 fourpaypayments: ^0.1.4 copied to clipboard
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);
}