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

GrabPay component mounting throws an exception #673

Closed
geekyme opened this issue Jan 15, 2021 · 4 comments
Closed

GrabPay component mounting throws an exception #673

geekyme opened this issue Jan 15, 2021 · 4 comments
Assignees

Comments

@geekyme
Copy link

geekyme commented Jan 15, 2021

Describe the bug

GrabPay component is not mounting

To Reproduce
Follow the directions here to create a grab pay component - https://docs.adyen.com/payment-methods/grabpay/web-component

checkout.create('grabpay_SG', {
  onSubmit: handleOnSubmit // Optional, only if you want to override the onSubmit defined in your AdyenCheckout instance
}).mount('#grabpay-container');

Exception:

Error: The passed payment method is not a valid Checkout Component

Expected behavior
No errors should result as expected from the docs.

Desktop (please complete the following information):

  • OS: Mac
  • Browser: Chrome
  • Version: 87.0.4280.88

Additional context

adyen-web version:

"@adyen/adyen-web": "^3.20.0",
@marcperez
Copy link
Member

Hi @geekyme,

Thanks for reaching. Could you double check the paymentMethodsResponse is correctly passed in the main instance (AdyenCheckout constructor)? Also, please check if grabpay_SG is present in the paymentMethods part of the /paymentMethods response.

This is the relevant part of the docs page:

  1. Pass the full response from the /paymentMethods call as the paymentMethodsResponse object when creating an instance of the AdyenCheckout.

https://docs.adyen.com/payment-methods/grabpay/web-component#show-grabpay-in-your-payment-form

Hope it helps!

@geekyme
Copy link
Author

geekyme commented Jan 15, 2021

This is the configuration I am passing to new AdyenCheckout(configuration)

{
clientKey: 'xxx'
environment: "test"
locale: "en_SG"
onAdditionalDetails: ƒ handleOnAdditionalDetails()
onChange: ƒ handleOnChange()
paymentMethodsResponse: {
  name: "GrabPay"
  supportsRecurring: true
  type: "grabpay_SG"
}
}

Am I missing something @marcperez ?

@marcperez
Copy link
Member

Hi @geekyme,

The value of paymentMethodsResponse seems to be incorrect, the property expects the full response of /paymentMethods. Something like the following:

// ...
paymentMethodsResponse: {
  paymentMethods: [
    {
      name: "GrabPay",
      type: "grabpay_SG"
    }
  ]
}
// ...

@marcperez marcperez self-assigned this Jan 15, 2021
@geekyme
Copy link
Author

geekyme commented Jan 15, 2021

thanks it works now!

@geekyme geekyme closed this as completed Jan 15, 2021
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

2 participants