# Integrating with new Stripe Checkout or Stripe Payment Intents version?

**URL:** https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818
**Category:** Development
**Created:** [7월 12, 2019, 5:48오후 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818 "2019-07-12T17:48:54Z")
**Posts on this page:** 8
**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: [7월 12, 2019, 5:48오후 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818/1 "2019-07-12T17:48:54Z")

</div>

I monetise my forums using a [Discourse plugin](https://github.com/chrisbeach/discourse-paid-pinning) I wrote to accept payments via Stripe Checkout (version 1).

This was straightforward as Stripe handled the whole payment workflow on the (JavaScript) client-side, with a single callback when the payment succeeded / failed.

With [new EU regulations looming](https://stripe.com/docs/strong-customer-authentication), Stripe now mandates their Checkout version 2 implementation, or “Payment Intents”, with a transition deadline of Sept 2019.

This is problematic because (as far as I can see), both of these APIs use a more complex workflow, requiring the consumer to poll their API to wait on payment completion, or use web-hooks.

I’m very nervous about changing my plugin because:

- I’m not a very experienced Ruby / Ember developer (I ripped most of the code from an [existing plugin](https://github.com/choiceaustralia/discourse-donations) to create mine)
- I don’t know whether the Discourse plugin API provides a suitable mechanism for implementing this kind of polling (where the final result is very important)

Does anyone have experience of a) Stripe V2 Checkout or Payment Intents integration with Discourse, or b) handling server polling via a Discourse plugin?

Thanks in advance 👍

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [7월 12, 2019, 6:12오후 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818/2 "2019-07-12T18:12:34Z")

</div>

Sounds like you’ll need to ask for donations to get your donations plugin updated. 🙂

I’ve been working on a Stripe plugin myself . And I see it’s `v1`.

EDIT: Oh!, but maybe I’m on v3: (in `plugin.rb`):

```plaintext
register_html_builder('server:before-head-close') do
  "<script src='https://js.stripe.com/v3/'></script>"
end

```

> [@ChrisBeach](#):
>
> This is problematic because (as far as I can see), both of these APIs use a more complex workflow, requiring the consumer to poll their API to wait on payment completion, or use web-hooks.

I’m pretty sure that for someone like @angus or @joebuhlig polling and webhooks are not that big a deal, but I’m afraid that I’m about where you are. ☹

I’ve been trying to update the Stripe Gem to the latest version like this:

```plaintext
gem 'net-http-persistent', '3.0.1'
gem 'stripe', '4.21.2'

```

and it is failing like this:

```plaintext
Traceback (most recent call last):
/home/pfaffman/src/discourse/bin/unicorn: Bootsnap::LoadPathCache::FallbackScan
        34: from /home/pfaffman/src/discourse/bin/unicorn:49:in `<main>'
        33: from /home/pfaffman/src/discourse/bin/unicorn:49:in `load'
        32: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/unicorn-5.5.1/bin/unicorn:128:in `<top (required)>'
        31: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/unicorn-5.5.1/lib/unicorn/http_server.rb:141:in `start'
        30: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/unicorn-5.5.1/lib/unicorn/http_server.rb:794:in `build_app!'
        29: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/unicorn-5.5.1/lib/unicorn.rb:54:in
`block in builder'
        28: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/unicorn-5.5.1/lib/unicorn.rb:54:in
`eval'
        27: from config.ru:1:in `<main>'
        26: from config.ru:1:in `new'
        25: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize'
        24: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval'
        23: from config.ru:7:in `block in <main>'
        22: from config.ru:7:in `require'
        21: from /home/pfaffman/src/discourse/config/environment.rb:4:in `<top (required)>'
        20: from /home/pfaffman/src/discourse/config/environment.rb:4:in `require'
        19: from /home/pfaffman/src/discourse/config/application.rb:57:in `<top (required)>'
        18: from /home/pfaffman/src/discourse/config/application.rb:58:in `<module:Discourse>'
        17: from /home/pfaffman/src/discourse/config/application.rb:261:in `<class:Application>'
        16: from lib/discourse.rb:168:in `activate_plugins!'
        15: from lib/discourse.rb:168:in `each'
        14: from lib/discourse.rb:171:in `block in activate_plugins!'
        13: from /home/pfaffman/src/discourse/lib/plugin/instance.rb:490:in `activate!'
        12: from /home/pfaffman/src/discourse/lib/plugin/instance.rb:490:in `instance_eval'
        11: from /home/pfaffman/src/discourse/plugins/lc-billing/plugin.rb:8:in `activate!'
        10: from /home/pfaffman/src/discourse/lib/plugin/instance.rb:564:in `gem'
         9: from /home/pfaffman/src/discourse/lib/plugin_gem.rb:22:in `load'
         8: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
         7: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
         6: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
         5: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:26:in `require'
         4: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:40:in `rescue in require'
         3: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
         2: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
         1: from /home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/home/pfaffman/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require': cannot load such file -- net-http-persistent (LoadError)

```

[procourse memberships](https://github.com/procourse/procourse-memberships) uses `3.28.0`, but that’s still making calls to the v1 api.

EDIT: I don’t see a `v2` API. [API upgrades | Stripe Documentation](https://stripe.com/docs/upgrades#2019-05-16) seems to still show `v1`. I’ve upgraded to latest according to [Stripe Login | Sign in to the Stripe Dashboard](https://dashboard.stripe.com/test/developers)

---

<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: [7월 13, 2019, 10:31오전 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818/3 "2019-07-13T10:31:15Z")

</div>

@ChrisBeach happy to help. If you could create a branch on the plugin and get us started with what you can figure out, I’ll work in / give you some specific pointers to make sure we get over the line before the deadline.

---

<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: [7월 13, 2019, 9:28오후 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818/4 "2019-07-13T21:28:38Z")

</div>

@Angus that is a kind offer that I really appreciate. I’ll let you know when I begin work on the integration.

---

<div class="post-metadata">

### Author: ![haroldus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/haroldus/32/150859_2.png) [@haroldus](https://meta.discourse.org/u/haroldus)
#### Post date: [7월 25, 2019, 12:55오전 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818/5 "2019-07-25T00:55:43Z")

</div>

I have updated the stripe gem successfully on local as follows:

```plaintext
gem 'net-http-persistent', '3.0.1', {require: false}
gem 'stripe', '4.21.3'

```

And then `/discourse$ bundle exec rake db:migrate`

---

<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: [8월 17, 2019, 5:56오후 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818/6 "2019-08-17T17:56:44Z")

</div>

Good news, the pressure to upgrade Stripe payment integration is off (in the UK at least):

> [@](#):
>
> We wanted to send you a quick update on the upcoming [Strong Customer Authentication](https://58.email.stripe.com/CL0/https:%2F%2Fstripe.com%2Fpayments%2Fstrong-customer-authentication/1/0100016c98eab830-c6793d00-dbfe-4fe5-a1d2-00123c34252a-000000/DKN9MVyDyROa-zau-p9Gl3cLR9PVw8N63hjlVYT8gKM=102) (SCA) requirements being introduced in Europe next month.
> 
> Earlier this week, the UK regulator [granted an 18 month](https://58.email.stripe.com/CL0/https:%2F%2Fwww.fca.org.uk%2Fnews%2Fpress-releases%2Ffca-agrees-plan-phased-implementation-strong-customer-authentication/1/0100016c98eab830-c6793d00-dbfe-4fe5-a1d2-00123c34252a-000000/ZfoapF4bEfOtXi2XDZm2csTesLTCyOpsePRvIZZrHiY=102) phase-in period to give banks and businesses more time to prepare for these new requirements. As a result, we don’t expect banks to fully require SCA for payments from UK cards until March 2021.
> 
> Our information shows that 100% of your yearly payments volume is from UK cardholders. We still recommend updating your payments flow as early as possible to help avoid an increase in declines from other European cards, or in case of an early enforcement by select banks.
> 
> Our [new payments APIs and other SCA-ready solutions](https://58.email.stripe.com/CL0/https:%2F%2Fstripe.com%2Fdocs%2Fstrong-customer-authentication%23preparing/1/0100016c98eab830-c6793d00-dbfe-4fe5-a1d2-00123c34252a-000000/Ry4tyDPrHueovHrU8JHlSZtlg4gW-JEifQz2Y80nJCg=102) are designed to take this uncertainty into account. If you update your integration to the new solutions ahead of 14 September 2019, our APIs won’t trigger authentication unless required by the cardholder’s bank. Similarly, after 14 September 2019, we’ll take into account each country’s enforcement timeline and only apply authentication and exemptions when SCA is required.

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [2월 29, 2020, 1:12오후 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818/7 "2020-02-29T13:12:01Z")

</div>

이 플러그인을 사용해 보고 싶습니다. 최신 Discourse 2.4와 호환되나요? 감사합니다!

---

<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: [2월 29, 2020, 2:53오후 UTC](https://meta.discourse.org/t/integrating-with-new-stripe-checkout-or-stripe-payment-intents-version/122818/8 "2020-02-29T14:53:37Z")

</div>

> [@Overgrow](#):
>
> 최신 Discourse 2.4에서 작동하나요?

네, 현재 제 포럼 [https://se23.life에서](https://se23.xn--life-ej5r32t) 사용하고 있습니다.
