init static method

Future init({
  1. required String publicKey,
  2. bool debugEnabled = false,
  3. Locale? locale,
  4. PayjpThreeDSecureRedirect? threeDSecureRedirect,
})

Initialize PAYJP with publicKey and other configurations.

Payjp.init(publicKey: 'pk_test_xxxx');

If you'd like to enable debugging, set debugEnabled to true (Android Only). You can also set locale manually, which is following the device setting by default. threeDSecureRedirect is required only if you support 3D Secure. You can register key and url in PAY.JP dashboard if activated.

Implementation

static Future init(
    {required String publicKey,
    bool debugEnabled = false,
    Locale? locale,
    PayjpThreeDSecureRedirect? threeDSecureRedirect}) async {
  final params = <String, dynamic>{
    'publicKey': publicKey,
    'debugEnabled': debugEnabled,
    'locale': locale?.toLanguageTag(),
    'threeDSecureRedirectUrl': threeDSecureRedirect?.url,
    'threeDSecureRedirectKey': threeDSecureRedirect?.key
  };
  await channel.invokeMethod('initialize', params);
}