CollectBankAccountResult.fromJson constructor

CollectBankAccountResult.fromJson(
  1. Map<String, dynamic> json
)

Parses a native method-channel response into the matching variant, or throws StripeException when neither key is present.

Implementation

factory CollectBankAccountResult.fromJson(Map<String, dynamic> json) {
  final payment = json['paymentIntent'];
  if (payment is Map<String, dynamic>) {
    return CollectBankAccountResult.paymentIntent(
      PaymentIntent.fromJson(payment),
    );
  }
  final setup = json['setupIntent'];
  if (setup is Map<String, dynamic>) {
    return CollectBankAccountResult.setupIntent(SetupIntent.fromJson(setup));
  }
  throw StripeException.fromJson(json);
}