MSDK UI Flutter plugin
Use
Opening payment form
To open the payment form:
- Create the
EcmpPaymentInfo
object.
This object must contain the following required parameters:
projectId
(int) — a project identifier assigned by FlashpaypaymentId
(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
EcmpPaymentInfo
object.
final paramsForSignature = await ecmpPlugin.getParamsForSignature(paymentInfo);
paymentInfo.signature = "CALCULATED_SIGNATURE_FROM_YOUR_BACKEND";
- Create the
EcmpPaymentOptions
object that contains the required parameteractionType
(enum) with the value specifying the required operation type:
EcmpActionType.sale
EcmpActionType.auth
EcmpActionType.verify
EcmpActionType.tokenize
In addition to the requiredEcmpPaymentInfo
object and theactionType
parameter, the following example contains several additional parameters including theEcmpAdditionalFields
object 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
EcmpPlugin
object.
final ecmpPlugin = EcmpPlugin();
- Open the payment form and handle result.
final response = await ecmpPlugin.sdkRun(paymentOptions);