HTML Embed Not Working

Hi folks! I’m having an issue when trying to use the HTML embed. I’m trying to embed a Paypal smart button. The button flashes for a second and then stops showing on the canvas. Here’s the code I’m using in the embed. Any idea why this isn’t working?

<div id="paypal-button-container-PLAN-ID"></div>
<script src="<https://www.paypal.com/sdk/js?client-id=ID_v&vault=true&intent=subscription>" data-sdk-integration-source="button-factory"></script>
<script>
  paypal.Buttons({
      style: {
          shape: 'rect',
          color: 'gold',
          layout: 'vertical',
          label: 'subscribe'
      },
      createSubscription: function(data, actions) {
        return actions.subscription.create({
          /* Creates the subscription */
          plan_id: 'PLAN-ID'
        });
      },
      onApprove: function(data, actions) {
        alert(data.subscriptionID); // You can add optional success message for the subscriber here
      }
  }).render('#paypal-button-container-PLAN-ID'); // Renders the PayPal button
</script>

Hi @heady_cod, when I paste that code into a blank HTML doc it doesn’t work either, I’m guessing you need some IDs in there (maybe you have these already and that’s how you were able to get it to partially work, but I can’t try it myself)

But some things for you to debug further:

• Does this happen in a blank project?
• Is the element still in the DOM?
• The Embed component is here, you can try to repro it even just outside of Plasmic using this component directly in a codesandbox React project: https://github.com/plasmicapp/plasmic/blob/master/plasmicpkgs/plasmic-basic-components/src/Embed.tsx

Hey @yang thanks for your answer! I haven’t been able to fix the error yet. The elements are in the dom but arent visible.

Here’s a test site i built
https://testsite12389918812.plasmic.run/

Here’s the plasmic project https://studio.plasmic.app/projects/hDNCfDQdQLUwbgDJA2Sfsg/branch/main@latest/page/Homepage

And here’s the complete code for the embed in a codepen https://codepen.io/usiriczman/pen/VwEPwrO

Would really appreciate some help. Thanks!

Thanks for this! This actually led us to finding an issue within the Embed component. Working on a fix…

Thanks! I appreciate the hard work :saluting_face: