toFormFields method

Map<String, String> toFormFields({
  1. required String publicKey,
  2. required String callbackUrl,
  3. required String checkoutUrl,
})

Converts to a map of form fields for direct POST to the checkout page.

Implementation

Map<String, String> toFormFields({
  required String publicKey,
  required String callbackUrl,
  required String checkoutUrl,
}) => {
  'public_key': publicKey,
  'quote_amount': quoteAmount,
  'quote_currency': quoteCurrency,
  'target_currency': targetCurrency,
  'source_currency': sourceCurrency,
  'callback_url': callbackUrl,
  'displayMode': 'INLINE',
  'parentOrigin': Uri.parse(checkoutUrl).origin,
  'reference': ?reference,
  'meta[name]': ?metaName,
  'meta[email]': ?metaEmail,
  'meta[phone_number]': ?metaPhone,
};