Easily create PCI-compliant inputs to accept payments online with the Square Payments API. It supports the following payment methods: credit and debit cards, ACH bank transfers, Apple Pay, Google Pay, Gift Cards and Afterpay/Clearpay.
[x] Make sure you are requesting to pull a topic/feature/bugfix branch (right side). Don't request your master!
[x] Make sure you are making a pull request against the main branch (left side). Also you should start your branch off our main.
[x] Check the commit's or even all commits' message styles matches our requested structure.
[x] Check your code additions will fail neither code linting checks nor unit test.
Description
On our checkout page, we have a back button that will unmount the CashAppPay component. When we try to pay again, we get this error:
Initializing Cash App Pay failed CashAppPayError: already rendered. must destroy before rendering again
This PR is calling cashApp?.destroy(); on useEffect cleanup function so that it's properly destroyed on unmount and works as expected when re-mounting.
Your checklist for this pull request
🚨Please review the guidelines for contributing to this repository.
Description
On our checkout page, we have a back button that will unmount the
CashAppPay
component. When we try to pay again, we get this error:This PR is calling
cashApp?.destroy();
onuseEffect
cleanup function so that it's properly destroyed on unmount and works as expected when re-mounting.