Skip to content

Require paddle 3 and fix Paddle error handling - #1285

Merged
excid3 merged 1 commit into
mainfrom
paddle-3
Oct 6, 2026
Merged

excid3 merged 1 commit into
mainfrom
paddle-3

Conversation

@excid3

@excid3 excid3 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Upgrades the paddle gem to 3.0 and fixes Pay's Paddle error handling, which has never caught the gem's API errors.

Paddle 3

  • Paddle Billing and Paddle Classic now require paddle ~> 3. Paddle 3 requires Ruby 3.3+, the same Rubies CI tests; 3.2 and older are end of life.
  • Pay doesn't depend on the other paddle 3.0 breaking changes: its only list call sends a single value, and its config calls work unchanged. Apps that call the paddle gem directly should check paddle's 3.0 changelog.
  • Paddle 3 no longer installs ostruct. braintree requires it without depending on it, so the dev Gemfile now includes ostruct. The CHANGELOG tells apps to do the same if they rely on it.

Error handling fix

Pay rescued ::Paddle::Error, which the gem never raises for API failures:

  • Billing: API errors are Paddle::Errors::*, which inherit from Paddle::ErrorGenerator
  • Classic: the client raises Paddle::Classic::Error

So apps got the raw gem errors instead of the documented Pay::PaddleBilling::Error / Pay::PaddleClassic::Error. All 16 rescues now catch the right classes. Paddle 3 raises on every non-2xx response, so this would have shown up more often. There's a new test for each integration (both fail without the fix), and one existing test that asserted the raw error now expects the wrapped one.

Re-recorded cassettes

The 3 Paddle Billing cassettes (from 2023) are re-recorded with paddle 3 against a new sandbox account. The fixture subscription and the swap test's price now point at objects in that account. The charge test now asserts any wrapped Paddle API error rather than a specific 403, since the status code depends on the account.

Testing

Full suite passes on the main bundle and every appraisal (Rails 7.0, 7.1, 7.2, 8.0, 8.1, main): 594 runs, 0 failures. standardrb is clean.

* Require the paddle gem ~> 3 for Paddle Billing and Paddle Classic.
  Paddle 3 requires Ruby 3.3+, matching the Rubies CI tests
* Add ostruct to the dev Gemfile. braintree requires it without
  depending on it, and paddle 3 no longer installs it
* Rescue Paddle::ErrorGenerator (Billing) and Paddle::Classic::Error
  (Classic). Pay rescued Paddle::Error, which the gem doesn't raise for
  API failures, so raw gem errors escaped instead of Pay's error classes
* Re-record the Paddle Billing cassettes against a new sandbox account
@excid3
excid3 merged commit b3fe342 into main Oct 6, 2026
37 checks passed
@excid3
excid3 deleted the paddle-3 branch October 6, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant