# Getting a Stripe Checkout button (\<script\>, \<form\> tags) rendering in a post (via plugin).. help required

**URL:** https://meta.discourse.org/t/getting-a-stripe-checkout-button-script-form-tags-rendering-in-a-post-via-plugin-help-required/71967
**Category:** Development
**Created:** [10월 12, 2017, 11:03오후 UTC](https://meta.discourse.org/t/getting-a-stripe-checkout-button-script-form-tags-rendering-in-a-post-via-plugin-help-required/71967 "2017-10-12T23:03:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [10월 12, 2017, 11:03오후 UTC](https://meta.discourse.org/t/getting-a-stripe-checkout-button-script-form-tags-rendering-in-a-post-via-plugin-help-required/71967/1 "2017-10-12T23:03:19Z")

</div>

I’m currently working on the [Discourse Stripe Donations plugin](https://github.com/chrisbeach/discourse-donations), forked from @rimian’s original work.

I’m close to getting a [Stripe Checkout button](https://stripe.com/checkout) displayed within a forum post, but something is preventing the Stripe HTML snippet (an inline script tag) from running.

[Example here](https://se6.life/t/testing-payment-link/43)

 ![BBB94301-033E-4FB4-A4CA-34CCFBD20D2F](https://global.discourse-cdn.com/meta/original/3X/8/5/85b998ee8d40a91b1bf8add10760a0b060ba24da.jpeg)

As you can see, the button doesn’t render in the post. Yet the DOM contains HTML elements which should cause the button to be rendered :

 ![28](https://global.discourse-cdn.com/meta/original/3X/3/6/360103b3c845f65d86ccfe7ed989d76436594919.png)

When I enabled a customised header with the same Stripe HTML, it worked perfectly. So, that rules out problems with the Stripe HTML or the interaction with Stripe’s server.

Below I’ve listed some things I have tried. Any more suggestions would be much appreciated 👍

### Enabling CORS in app.yml:

```plaintext
env:
       DISCOURSE_ENABLE_CORS: true

```

### Liberal CORS origins:

 ![21](https://global.discourse-cdn.com/meta/original/3X/1/d/1dce4343db0e3df52010a530ec1113f84c845814.png)

(I also tried a few different stripe https://… domains and sub domains in here without success)

### Loads of different allowed iframes:

 ![07](https://global.discourse-cdn.com/meta/original/3X/a/8/a8ed1801bbdae6f80d98e3934ac7bfc48ab1ef4e.png)

### HTTPS and Disabling Same Site Cookies:

 ![43](https://global.discourse-cdn.com/meta/original/3X/6/0/609eb0e6b7889ee49b47a6617a3e10d192746a76.png)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [10월 13, 2017, 10:46오전 UTC](https://meta.discourse.org/t/getting-a-stripe-checkout-button-script-form-tags-rendering-in-a-post-via-plugin-help-required/71967/2 "2017-10-13T10:46:44Z")

</div>

Do you have a CORS error in your browser’s console?

---

<div class="post-metadata">

### Author: ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)
#### Post date: [10월 13, 2017, 10:56오전 UTC](https://meta.discourse.org/t/getting-a-stripe-checkout-button-script-form-tags-rendering-in-a-post-via-plugin-help-required/71967/3 "2017-10-13T10:56:34Z")

</div>

> [@zogstrip](#):
>
> Do you have a CORS error in your browser’s console?

No, not as far as I can see, but I may be looking in the wrong console?

The post is here if you wouldn’t mind taking a look: [https://se6.life/t/testing-payment-link/43](https://se6.life/t/testing-payment-link/43)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [11월 27, 2017, 2:38오전 UTC](https://meta.discourse.org/t/getting-a-stripe-checkout-button-script-form-tags-rendering-in-a-post-via-plugin-help-required/71967/4 "2017-11-27T02:38:30Z")

</div>

The problem is that the script is inserted directly into the dom. Scripts inserted directly into dom are not executed.

One solution is to decorate the cooked post with the script using jQuery `append`.

[https://github.com/chrisbeach/discourse-donations/pull/6](https://github.com/chrisbeach/discourse-donations/pull/6)

See further: [Stripe Donations Plugin - #30 by angus](https://meta.discourse.org/t/stripe-donations-plugin/59036/30)
