ecommpay_flutter_plugin 1.2.0
ecommpay_flutter_plugin: ^1.2.0 copied to clipboard
Flutter plugin of Mobile SDK UI is a software development kit that can be used to integrate Android applications with the Ecommpay payment platform.
MSDK UI Flutter plugin #
Use #
Opening payment form #
To open the payment form:
- Create the
EcmpPaymentInfoobject.
This object must contain the following required parameters:
projectId(int) — a project identifier assigned by EcommpaypaymentId(String) — a payment identifier unique within the projectpaymentCurrency(String) — the payment currency code in the ISO 4217 alpha-3 formatpaymentAmount(int) — the payment amount in the smallest currency unitscustomerId(String) — a customer's identifier within the projectsignature(String) — a request signature generated after all required parameters have been specified
final paymentInfo = EcmpPaymentInfo(
projectId: 12312,
paymentId: "paymentId",
paymentAmount: 100,
paymentCurrency: "USD",
);
- Sign the parameters contained in the
EcmpPaymentInfoobject.
final paramsForSignature = await ecmpPlugin.getParamsForSignature(paymentInfo);
paymentInfo.signature = "CALCULATED_SIGNATURE_FROM_YOUR_BACKEND";
- Create the
EcmpPaymentOptionsobject that contains the required parameteractionType(enum) with the value specifying the required operation type:
EcmpActionType.saleEcmpActionType.authEcmpActionType.verifyEcmpActionType.tokenizeIn addition to the requiredEcmpPaymentInfoobject and theactionTypeparameter, the following example contains several additional parameters including theEcmpAdditionalFieldsobject with data specified in the fields that are used for collecting customer information.
final paymentOptions = EcmpPaymentOptions(
actionType: EcmpActionType.Sale,
paymentInfo: paymentInfo,
isDarkTheme: false,
//if need use real service- set EcmpMockModeType.disabled
mockModeType: EcmpMockModeType.success,
//set display mode if need
screenDisplayModes: [
EcmpScreenDisplayMode.hideDeclineFinalScreen
],
//set additional fields if need
additionalFields: [
EcmpAdditionalField(type: "email", value: "mail@mail.com"),
EcmpAdditionalField(type: "first_name", value: "firstName"),
],
//set recipient info if need
recipientInfo: EcmpRecipientInfo(),
//set recurrent info if need
recurrentData: EcmpRecurrentData(),
);
- Create the
EcmpPluginobject.
final ecmpPlugin = EcmpPlugin();
- Open the payment form and handle result.
final response = await ecmpPlugin.sdkRun(paymentOptions);