StripeApi constructor

StripeApi(
  1. String publishableKey, {
  2. String apiVersion = defaultApiVersion,
  3. String? stripeAccount,
})

Create a new instance, which can be used with e.g. dependency injection. Throws a Exception if an invalid publishableKey has been submitted.

publishableKey is your publishable key, beginning with "pk_". Your can copy your key from https://dashboard.stripe.com/account/apikeys

stripeAccount is the id of a stripe customer and stats with "cus_". This is a optional parameter.

Implementation

StripeApi(this.publishableKey, {this.apiVersion = defaultApiVersion, String? stripeAccount})
    : _apiHandler = StripeApiHandler(stripeAccount: stripeAccount) {
  _validateKey(publishableKey);
  _apiHandler.apiVersion = apiVersion;
}