Skip to content

Commit cd8ebc5

Browse files
committed
Use API controller for webhooks
1 parent 144e662 commit cd8ebc5

File tree

6 files changed

+6
-13
lines changed

6 files changed

+6
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### 11.4.2
66

7+
* Use `ActionController::API` as base for webhooks. This removes the need to skip forgery protection and improves performance.
78
* Use `inheritance_column` instead of hardcoded `type` column in case users modify migrations
89
* Use `attr_reader :support_email` since we define a customer setter
910
* Use `skip_forgery_protection` to be more compatible with Rails 8.2+

app/controllers/pay/webhooks/braintree_controller.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module Pay
22
module Webhooks
3-
class BraintreeController < Pay::ApplicationController
4-
skip_forgery_protection if Rails.application.config.action_controller.default_protect_from_forgery
5-
3+
class BraintreeController < ActionController::API
64
def create
75
queue_event(verified_event)
86
head :ok

app/controllers/pay/webhooks/lemon_squeezy_controller.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module Pay
22
module Webhooks
3-
class LemonSqueezyController < Pay::ApplicationController
4-
skip_forgery_protection if Rails.application.config.action_controller.default_protect_from_forgery
5-
3+
class LemonSqueezyController < ActionController::API
64
def create
75
if valid_signature?(request.headers["X-Signature"])
86
queue_event(verify_params.as_json)

app/controllers/pay/webhooks/paddle_billing_controller.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module Pay
22
module Webhooks
3-
class PaddleBillingController < Pay::ApplicationController
4-
skip_forgery_protection if Rails.application.config.action_controller.default_protect_from_forgery
5-
3+
class PaddleBillingController < ActionController::API
64
def create
75
if valid_signature?(request.headers["Paddle-Signature"])
86
queue_event(verify_params.as_json)

app/controllers/pay/webhooks/paddle_classic_controller.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module Pay
22
module Webhooks
3-
class PaddleClassicController < Pay::ApplicationController
4-
skip_forgery_protection if Rails.application.config.action_controller.default_protect_from_forgery
5-
3+
class PaddleClassicController < ActionController::API
64
def create
75
queue_event(verified_event)
86
head :ok

app/controllers/pay/webhooks/stripe_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Pay
22
module Webhooks
3-
class StripeController < Pay::ApplicationController
3+
class StripeController < ActionController::API
44
skip_forgery_protection if Rails.application.config.action_controller.default_protect_from_forgery
55

66
def create

0 commit comments

Comments
 (0)