initialize method

Future<bool> initialize({
  1. required String apiKey,
  2. required int integrationID,
  3. required int iFrameID,
  4. required int jazzcashIntegrationId,
  5. required int easypaisaIntegrationID,
  6. int userTokenExpiration = 3600,
})

Initializing PaymobPayment instance.

Implementation

Future<bool> initialize({
  /// It is a unique identifier for the merchant which used to authenticate your requests calling any of Accept's API.
  /// from dashboard Select Settings -> Account Info -> API Key
  required String apiKey,

  /// from dashboard Select Developers -> Payment Integrations -> Online Card ID
  required int integrationID,

  /// from paymob Select Developers -> iframes
  required int iFrameID,
  required int jazzcashIntegrationId,
  required int easypaisaIntegrationID,

  /// The expiration time of this payment token in seconds. (The maximum is 3600 seconds which is an hour)
  int userTokenExpiration = 3600,
}) async {
  if (_isInitialized) {
    return true;
  }
  _dio.options.baseUrl = _baseURL;
  _dio.options.validateStatus = (status) => true;
  _apiKey = apiKey;
  _jazzcashIntegrationID = jazzcashIntegrationId;
  _easypaisaIntegrationID = easypaisaIntegrationID;
  _cardIntegrationID = integrationID;
  _mobileAccountiFrame = "https://pakistan.paymob.com/iframe/";
  _iFrameID = iFrameID;
  _iFrameURL = 'https://pakistan.paymob.com/api/acceptance/iframes//$_iFrameID?payment_token=';

  _isInitialized = true;
  _userTokenExpiration = userTokenExpiration;
  return _isInitialized;
}