Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instance.clearSelectedPaymentMethod() is not clearing the selected option #302

Open
akhilathinkster opened this issue Jun 17, 2021 · 0 comments

Comments

@akhilathinkster
Copy link

Having problem using clearSelectedPaymentMethod :

"braintree-web": "^3.54.2",
 "braintree-web-drop-in": "1.26.0",
 "braintree-web-drop-in-react": "^1.1.0",

And I am trying to clear the selected option over a button like this. In render:

                <DropIn
                    options={{
                      authorization: clientToken,
                      paypal: { flow: "vault" },
                      paypalCredit: { flow: "vault" },
                      googlePay: {
                        transactionInfo: {
                          totalPriceStatus: "FINAL",
                          totalPrice: "0",
                          currencyCode: "USD",
                        },
                      },
                      applePay: {
                        flow: "vault",
                        displayName: "My Store",
                        paymentRequest: {
                          total: {
                            label: "My Store",
                            amount: "0",
                          },
                          // We recommend collecting billing address information, at minimum
                          // billing postal code, and passing that billing postal code with all
                          // Apple Pay transactions as a best practice.
                          requiredBillingContactFields: ["postalAddress"],
                        },
                      },
                      preselectVaultedPaymentMethod: false,
                      paymentOptionPriority: [
                        "applePay",
                        "paypal",
                        "paypalCredit",
                        "googlePay",
                      ],
                    }}
                    onInstance={(instance) => (this.instance = instance)}
                    onNoPaymentMethodRequestable={
                      this.onNoPaymentMethodRequestable
                    }
                    onPaymentMethodRequestable={() =>
                      this.onPaymentMethodRequestable(event)
                    }
                    onPaymentOptionSelected={this.onPaymentOptionSelected}
                    onClearSelectedPaymentMethod={() => this.clearSelectedPaymentMethod()}
                  />
                  
                  <button onClick={this.clearSelectedPaymentMethod}>Clear</button>

clearSelectedPaymentMethod : I defined like this.

clearSelectedPaymentMethod(e) {
      this.instance.clearSelectedPaymentMethod();
   }

so the Options appear like this.

Screen Shot 2021-06-17 at 11 18 04 AM

After I click on any one option:

Screen Shot 2021-06-17 at 11 19 11 AM

Then after I click on the clear button doesn't reset the options back to the first image.

Can you help me, please? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant