diff --git a/package/src/components/StripePaymentCheckoutAction/v1/StripePaymentCheckoutAction.js b/package/src/components/StripePaymentCheckoutAction/v1/StripePaymentCheckoutAction.js index 517145e38..46edcb0e6 100644 --- a/package/src/components/StripePaymentCheckoutAction/v1/StripePaymentCheckoutAction.js +++ b/package/src/components/StripePaymentCheckoutAction/v1/StripePaymentCheckoutAction.js @@ -105,6 +105,7 @@ class StripePaymentCheckoutAction extends Component { activeCountry: "US", status: "active", billingAddress: "same_as_shipping", + isStripeFormComplete: false, countries: [ { value: "US", label: "United States" }, { value: "DE", label: "Germany" }, @@ -163,16 +164,26 @@ class StripePaymentCheckoutAction extends Component { } handleUseNewBillingAddress = (billingAddress) => { - // Only react to value changes - if (typeof billingAddress === "string") { + const { isStripeFormComplete } = this.state; + if (billingAddress === "use_different_billing_address") { this.setState({ billingAddress }); + } else if (billingAddress === "same_as_shipping") { + // If a user decides to use the same address + this.setState({ billingAddress }); + // Confirm if Stripe Form is filled out + if (isStripeFormComplete) { + // Trigger onReadyForSaveChange() + this.handleStripeFormIsComplete(true); + } } } handleStripeFormIsComplete = (isComplete) => { const { onReadyForSaveChange } = this.props; - onReadyForSaveChange(isComplete); + this.setState({ + isStripeFormComplete: true + }); } renderBillingAddressForm = () => {