braintree / braintree-web-drop-in

Braintree Drop-in for the web
MIT License
200 stars 126 forks source link

Initial configuration fails with [data-braintree-id="paypal-button"] does not exist #707

Closed Stradivario closed 1 year ago

Stradivario commented 3 years ago

General information

Issue description

Steps to reproduce

npm i braintree-web-drop-in
npm i @types/braintree-web-drop-in -D
import { create } from 'braintree-web-drop-in';

const container = document.body.querySelector('#dropin-container') as HTMLElement;
const button = document.body.querySelector('#paypal-button') as HTMLElement;

async function main() {
 const dropin = await create({
  authorization: 'my-authorization-from-backend-goes-here',
  container,
  paypal: {
   flow: 'vault',
  },
 });

 button.addEventListener('click', () => {
  /* dropin.requestPaymentMethod(); */
 });
}

main();
<div id="dropin-container"></div>
<button id="paypal-button">Purchase</button>

<script type="text/javascript" src="./main.ts"></script>

I am having the following error

Error: Document is ready and element #braintree--dropin__f17298d9-3646-4ede-8a49-c911e83ee72e [data-braintree-id="paypal-button"] does not exist

crookedneighbor commented 3 years ago

Do you have a staging site we can inspect?

crookedneighbor commented 3 years ago

Just pinging again about getting a staging site.

armandodlvr commented 1 year ago

closing for inactivity. If you continue to encounter errors, please contact Support