Skip to content
CAI
Software that uses CAICheck a score

pay-rails/pay

47.9

Weak · 6 November 2026

5k

lines of production code

Ruby

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add database testing helper and update Rails bin script for test environment

A new bin/test\_databases script has been added to allow developers to easily run tests against SQLite3, PostgreSQL, and MySQL locally by setting the appropriate DATABASE\_URL. Additionally, bin/rails has been updated to default the RAILS\ENV to 'test' and corrected its path resolution logic (using \\dir\\_ instead of \_\FILE\\_) to properly locate the test dummy application and Gemfile, ensuring consistent behavior during local development and testing.

bin · high confidence

Added Pay customer sync job

A new background job, Pay::CustomerSyncJob, has been introduced to handle synchronization of Pay customer records. When executed, it locates the specified Pay::Customer by ID and triggers an update of their API record, logging a message if the customer is not found.

app/jobs · high confidence

Added email views generator

The library now includes a new \EmailViewsGenerator\ that copies user mailer email templates from \app/views/pay/user\_mailer\ into the host application, complementing the existing \ViewsGenerator\ which handles general payment views. This allows users to easily customize the email notifications sent by the Pay gem.

lib/generators · high confidence

Added pay:payment\_methods:sync\_default rake task

A new rake task, \pay:payment\_methods:sync\_default\, has been added to synchronize default payment methods for Pay::Customers. This task iterates through all customers and syncs their default payment method based on their processor (Braintree, Stripe, or Paddle Classic), including retry logic for failed attempts. The previous placeholder task file \lib/tasks/pay\_tasks.rake\ has been removed.

lib/tasks · high confidence

Implement Paddle Classic webhook handling and signature verification

This change introduces the core webhook processing logic for the Paddle Classic payment processor. It adds a signature verifier to validate incoming webhook requests using Paddle's public key and PHP-style serialization, ensuring request integrity. It also implements handlers for subscription lifecycle events: creating subscriptions, recording successful payments with receipt emails, handling refunds with refund notifications, updating subscription details (including trial and pause states), and managing cancellations. Notably, cancellations are treated as active until the end of the paid period, preserving user access despite Paddle's immediate cancellation behavior, and customer payment methods are cleared upon cancellation to prevent reuse.

_lib/pay/paddle\classic · high confidence

Initial project scaffolding and configuration

This change establishes the foundational structure for the Pay gem, introducing configuration files for code quality (.rubocop.yml, .standard.yml), test environment management (Appraisals for Rails 7.0–8.1 and main), and repository hygiene (.gitignore). It also provides the initial documentation (README.md, UPGRADE.md, CHANGELOG.md) and standardizes the build process (Rakefile) to support testing and gem packaging.

(repo-wide) · high confidence

New email templates for payment actions, receipts, refunds, and subscription lifecycle events

Users will now receive formatted HTML and plain-text emails for key billing events: payment action required (Stripe SCA confirmation), payment failure, subscription renewals, trial expiration, and trial ending soon. Receipt and refund emails include transaction details such as amount, charged-to entity, transaction ID, date, and optional extra billing information, with the application name linked to the root URL and business contact details included.

_app/views/pay/user\mailer · high confidence

New view helper for formatting currency amounts

A new \pay\_amount\_to\_currency\ helper has been added to the \Pay\ module, allowing views to easily format monetary amounts by automatically extracting the currency from the provided object and passing it to the underlying \Pay::Currency.format\ method.

app/helpers · high confidence

Pay gem upgraded to version 12.2.0 with new processor integrations and architecture

The Pay gem has been upgraded to version 12.2.0, introducing support for Paddle Billing and Lemon Squeezy payment processors alongside existing Stripe and Braintree integrations. This update includes a new \Pay::Adapter\ module to handle database-specific JSON column types, a \Pay::Currency\ class for improved amount formatting, and a \Pay::Sync\ module to standardize synchronization logic across processors. The release also adds a \Pay::FakeProcessor\ for testing purposes and refactors the webhook handling system to use a delegator pattern, ensuring that webhook subscribers are processed in the correct order.

lib/pay · high confidence

Behavioural changes

Configurable customer sync trigger on email updates

The billable module now includes a new \SyncCustomer\ concern that automatically queues a job to update payment processor records when a customer's email address changes. This behavior is triggered by an \after\_update\_commit\ callback, but users can override the \pay\_should\_sync\_customer?\ method to customize or disable the sync logic entirely.

lib/pay/billable · high confidence

Configurable mailer defaults and dynamic email arguments

The Pay mailer system now supports independent configuration for email sending. The application mailer dynamically resolves the default 'from' address, preferring the configured support email over the previous hardcoded placeholder. Additionally, a new UserMailer class allows for polymorphic argument handling via instance\_exec, enabling flexible customization of mail arguments and supporting specific logic such as attaching receipt files when available.

app/mailers · high confidence

Configures conditional webhook routes for multiple payment providers

The application's routing configuration now explicitly defines POST endpoints for webhooks from Stripe, Braintree, Paddle Billing, Paddle Classic, and Lemon Squeezy. These routes are dynamically registered only if the corresponding payment provider is enabled, ensuring that webhook handling is available for all supported processors without requiring manual route setup.

config · high confidence

Database schema updated for Pay gem v3.0 with STI and new fields

The database schema has been updated to align with the Pay gem v3.0 release. This introduces Single Table Inheritance (STI) by adding \type\ columns to \pay\_customers\, \pay\_charges\, \pay\_subscriptions\, and \pay\_merchants\, while renaming the existing \type\ column in \pay\_payment\_methods\ to \payment\_method\_type\. New columns include \stripe\_account\ across customer, payment method, subscription, and charge tables, as well as \current\_period\_start\ and \current\_period\_end\ on subscriptions. Additionally, an \object\ JSON column has been added to charges, customers, and subscriptions to store raw processor data, and the migration respects the application's configured primary key type.

db · high confidence

Introduce STI-based payment processor models for Braintree, Lemon Squeezy, and Paddle Billing

The payment models have been refactored to use Single Table Inheritance (STI), introducing dedicated processor-specific subclasses for Braintree, Lemon Squeezy, Paddle Billing, and a FakeProcessor. This change adds new model files (e.g., \Pay::Braintree::Charge\, \Pay::LemonSqueezy::Subscription\) that implement processor-specific logic for syncing, refunds, and subscription management, while the base \Pay::Charge\, \Pay::Customer\, and \Pay::Subscription\ models now include scopes and helpers to identify and interact with these specific processors.

pay · high confidence

Major library restructuring and configuration overhaul

The core library has been significantly refactored to support a modular architecture and enhanced configurability. The main entry point now explicitly requires dependencies and uses autoloading for all components, including new payment processors like Paddle Billing, Lemon Squeezy, and a FakeProcessor. A comprehensive configuration API has been introduced, allowing users to customize business details (name, address, logo), control email sending behavior (including granular per-event toggles and dynamic recipients), and manage enabled processors. The library also introduces a generic \Pay.sync\ method to handle synchronization across different payment providers via a unified handler map, replacing previous provider-specific sync logic.

lib · high confidence

Pay models now inherit from a configurable parent class with a dedicated table prefix

The Pay gem's models now inherit from a configurable parent class (defined by \Pay.model\_parent\class\) instead of directly inheriting from \ActiveRecord::Base\, allowing for greater flexibility in model hierarchy. Additionally, a \pay\\ table name prefix is now automatically applied to all Pay models, ensuring database table isolation. A new \Pay::Routing\ concern has also been added to provide URL helper methods for mailers within the Pay context.

app/models · high confidence

Payment confirmation page adopts Tailwind CSS and Stripe SCA support

The payment confirmation layout has been updated to use Tailwind CSS (v2.2) for styling, replacing the previous stylesheet, and now includes the Stripe.js v3 library to support Strong Customer Authentication (SCA). The page title has also been updated to explicitly display 'Payment Confirmation' along with the business name, and the layout now includes standard meta tags for charset and viewport configuration.

app/views/layouts · high confidence

Redesigned payment page with Stripe Payment Element and Stimulus

The payment confirmation view has been completely rewritten to use the Stripe Payment Element for handling card inputs, replacing the previous card-element approach. The page now leverages the @hotwired/stimulus framework (loaded via unpkg CDN) to manage client-side state, including handling setup intents versus payment intents, displaying success/error messages, and controlling the processing state of the pay button. Styling has been updated to use TailwindCSS classes, and the layout now supports both standard payments and Stripe Connect scenarios via dynamic data attributes.

app/views/pay/payments · high confidence

Refactor Braintree subscription webhook handlers into dedicated classes

The Braintree payment processor's subscription webhook handling has been restructured from a monolithic approach into distinct, single-responsibility classes (e.g., \SubscriptionChargedSuccessfully\, \SubscriptionCanceled\). This change ensures that specific events, such as successful charges, now explicitly trigger email receipts via \Pay.mailer\ when configured, while other lifecycle events like cancellations or expirations are handled by inheriting from a base \Subscription\ handler that syncs the subscription state. This improves modularity and ensures that receipt emails are sent only for relevant successful transactions rather than all subscription updates.

lib/pay/braintree · high confidence

Refactored Stripe webhook handling into dedicated classes

The Stripe webhook processing logic has been restructured from a monolithic handler into individual, dedicated classes (e.g., \ChargeSucceeded\, \SubscriptionUpdated\, \PaymentFailed\) located in \lib/pay/stripe/webhooks/\. This change ensures that specific Stripe events, such as charge refunds, subscription trials, and customer deletions, are handled with precise, isolated logic, improving maintainability and reducing the risk of side effects when processing webhooks.

lib/pay/stripe · high confidence

Stripe error handling and redirect fallback in payments controller

The payments controller now rescues from Pay::Error to display a user-friendly alert and redirect to the root path when issues occur, such as an invalid payment intent ID. It also supports a configurable 'back' link via the ?back= query parameter, ensuring it only follows same-host URLs or paths to prevent open redirects.

app/controllers/pay · high confidence

Unified webhook processing with processor-specific controllers

Webhook handling for Stripe, Braintree, Paddle Classic, Paddle Billing, and Lemon Squeezy is now managed by a shared base controller that verifies signatures, queues events for background processing via Pay::Webhooks::ProcessJob, and records them in the Pay::Webhook model. Each processor has its own controller implementing signature verification and event type extraction, with Stripe specifically supporting multiple signing secrets for rotation and allowing configuration to include or exclude test-mode events.

app/controllers/pay/webhooks · high confidence

Test coverage

Add dummy app views for Braintree and Stripe payment examples; Add test dummy app views for payment examples; Added JavaScript implementation for Braintree and Stripe payment processors in the dummy app; Added Paddle Classic demo controllers and views; Added Paddle Classic demo views for charges and subscriptions; Added Paddle Classic webhook and verification test fixtures; Added Stripe payment integration examples to the dummy application; Added dummy app controllers and helpers for testing payment flows; Added dummy application models for testing Pay integration; Added dummy controllers for LemonSqueezy charges and subscriptions; Added dummy view templates for Lemon Squeezy charges and subscriptions; Added integration tests for payment webhook controllers; Added mailer previews for payment notifications; Added model tests for Pay gem components; Added test coverage for Braintree payment integration; Added test coverage for ChargeSucceeded webhook handler; Added test coverage for Lemon Squeezy payment processor; Added test coverage for Paddle Billing integration; Added test coverage for Pay adapter, attributes, currency, and payment logic; Added test coverage for Stripe webhook handlers; Added test coverage for the fake payment processor; Added test dummy migration for users, teams, and accounts; Added test view for payment method display; Added tests for Braintree subscription webhook handlers; Added tests for Paddle Billing webhooks controller; Added tests for Paddle Classic webhook handlers; Added tests for Pay::UserMailer email generation and configuration; Added tests for customer sync behavior; Added tests for customer sync job; Added tests for the Pay payments controller; Added tests for the Pay webhook delegator; Expanded test coverage for Stripe payment processor; Expanded test suite for configuration, mailers, and payment processors; New test support infrastructure for payment processors and integration testing; Test suite updates: new Pay initializer, Rails 5.0 defaults removal, and asset/session config tweaks; Update test/dummy app to use Turbo & importmaps; Updated dummy app layout with modern navigation and payment provider scripts; Updated test dummy app to use Turbo, importmaps, and modern Rails defaults; Updated test dummy database schema for Pay 3.0.

Dependencies

Added Appraisal configurations for Rails 7.0 through 8.1 and main

The gemfiles directory now includes new Appraisal configurations for Rails 7.0, 7.1, 7.2, 8.0, 8.1, and the Rails main branch. These files allow the library to be tested against these specific Rails versions, ensuring compatibility across the supported range.

gemfiles · high confidence

Upgrade to Rails 8.1 and Stripe v19 with new payment providers

The gem now requires Rails 7.0 or higher and has been updated to resolve against Rails 8.1.4 in the lockfile, reflecting a major framework upgrade. The Stripe dependency has been bumped to v19, and new payment providers Lemon Squeezy and Paddle are now supported via their respective gems. Development dependencies have been expanded to include Turbo, Stimulus, Importmap, and Sprockets for the dummy app, while the gemspec metadata has been completed with author details and a homepage.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 43 → 48 (+4.7)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 58 → 58 (+0.0)
  • Architecture 88 → 88 (+0.0)
  • Maturity 33 → 59 (+26.2)
  • Readiness 71 → 71 (-0.2)
  • Security 39 → 37 (-2.2)
  • Domain Modelling 67 → 67 (+0.0)
  • Accessibility 65 → 52 (-13.1)

Resolved (7)

  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no project overview (README.md)
  • Duplicate intent with inconsistent spelling. Both methods check if a subscription is canceled, but use American ('canceled') and British ('cancelled') spellings. This forces users to guess which spelling is supported or call both.
  • Duplicate intent. 'set_payment_processor' and 'add_payment_processor' appear to do the same thing (assigning a processor to a customer). The distinction between 'set' (overwrite?) and 'add' (append?) is not clear from the signature, and having both suggests redundancy.
  • Inconsistent naming for resume operations. Some processors (Stripe, PaddleBilling, PaddleClassic, FakeProcessor) use 'resume()', while Stripe also exposes 'unpause()'. 'Pause' and 'Unpause' are a pair, but 'Pause' and 'Resume' are a pair. Mixing these verbs across the same domain (subscription state management) is confusing.
  • Off-boarding risk: anonymized user #1

New (5)

  • Medium CVE: [GHSA redacted] (Gemfile.lock)
  • Off-boarding risk: anonymized user #1
  • Outdated: rails
  • Outdated: stripe
  • Outdated: vcr

Changes since last survey

  • 4 commits — 4 feature/other, 0 fixes

By area

  • (root) — 4 commits

Notable commits

  • change: Attach the invoice PDF to the receipt email (#1289)
  • change: Changelog for 12.4.0
  • change: Run a load hook on Pay::UserMailer and document subclassing it (#1290)
  • change: Version bump

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

pay-rails/pay was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit a9fb09f7f98d2d284c6ef6f5cb6f1978f1c4713e — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.