If I include:
HTML('
<h1> this is a test </h1>
<form action="" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_qdunoptxl9KNXR5qk7WdtkVg"
data-amount="2000"
data-name="Demo Site"
data-description="2 widgets ($20.00)"
data-image="/128x128.png">
</script>
</form>
')
inside ui.r
directly, it works - but placing it inside a conditional panel will not allow the Stripe JS to load.
Instead, I used an html data-display-if
condition:
<div align="center" data-display-if="output.Unpaid==True">
...
</div>
and everything worked!
This is also nice because it allows you to bind the condition to a Shiny output
object vs input
object which can be easier at times to work with.
Update after further testing
It turns out my edits don't quite work; after the Stripe Checkout JS has loaded, it blocks my Shiny App from interacting with other JS elements on the page.
It seems like there is some conflict with the Stripe JS and the internal Shiny JS....
New Update
The newest version of Shiny (0.9.1) has fixed this problem. It seems to have been something with js heads and singletons, which have been updated in the most recent release.
This is no longer an issue, and you can now use Stripe directly in shiny.