ensureStripeShape = (stripe: mixed): StripeShape => {
  if (
    stripe &&
    stripe.elements &&
    stripe.createSource &&
    stripe.createToken &&
    stripe.createPaymentMethod &&
    stripe.handleCardPayment
  ) {
    return ((stripe: any): StripeShape);
  } else {
    throw new Error(
      "Please pass a valid Stripe object to StripeProvider. You can obtain a Stripe object by calling 'Stripe(...)' with your publishable key."
    );
  }
}
Note that this is not meant to be a generic memoization solution.
This is specifically a solution for `StripeProvider`s being initialized
and destroyed regularly (with the same set of props) when users only
use `StripeProvider` for the subtree that contains their checkout form.