Module: Pay

Defined in:
lib/pay/braintree/webhooks/subscription_expired.rb,
lib/pay.rb,
lib/pay/env.rb,
lib/pay/engine.rb,
lib/pay/errors.rb,
lib/pay/paddle.rb,
lib/pay/stripe.rb,
lib/pay/adapter.rb,
lib/pay/nano_id.rb,
lib/pay/payment.rb,
lib/pay/version.rb,
lib/pay/currency.rb,
lib/pay/receipts.rb,
lib/pay/webhooks.rb,
lib/pay/braintree.rb,
lib/pay/attributes.rb,
lib/pay/paddle/error.rb,
lib/pay/stripe/error.rb,
app/models/pay/charge.rb,
lib/pay/paddle/charge.rb,
lib/pay/stripe/charge.rb,
app/models/pay/webhook.rb,
lib/pay/fake_processor.rb,
app/models/pay/customer.rb,
app/models/pay/merchant.rb,
lib/pay/braintree/error.rb,
lib/pay/paddle/billable.rb,
lib/pay/stripe/billable.rb,
lib/pay/stripe/merchant.rb,
lib/pay/braintree/charge.rb,
lib/pay/braintree/billable.rb,
lib/pay/webhooks/delegator.rb,
app/mailers/pay/user_mailer.rb,
app/models/pay/subscription.rb,
lib/pay/paddle/subscription.rb,
lib/pay/stripe/subscription.rb,
app/jobs/pay/application_job.rb,
lib/pay/fake_processor/error.rb,
lib/pay/webhooks/process_job.rb,
app/models/pay/payment_method.rb,
lib/pay/fake_processor/charge.rb,
lib/pay/paddle/payment_method.rb,
lib/pay/stripe/payment_method.rb,
app/jobs/pay/customer_sync_job.rb,
lib/pay/billable/sync_customer.rb,
lib/pay/braintree/subscription.rb,
lib/pay/fake_processor/billable.rb,
lib/pay/braintree/payment_method.rb,
app/models/pay/application_record.rb,
app/helpers/pay/application_helper.rb,
app/mailers/pay/application_mailer.rb,
lib/generators/pay/views_generator.rb,
lib/pay/fake_processor/subscription.rb,
lib/pay/braintree/authorization_error.rb,
lib/pay/fake_processor/payment_method.rb,
app/controllers/pay/payments_controller.rb,
lib/pay/stripe/webhooks/account_updated.rb,
lib/pay/stripe/webhooks/charge_refunded.rb,
lib/generators/pay/email_views_generator.rb,
lib/pay/stripe/webhooks/charge_succeeded.rb,
lib/pay/stripe/webhooks/customer_deleted.rb,
lib/pay/stripe/webhooks/customer_updated.rb,
app/controllers/pay/application_controller.rb,
lib/pay/paddle/webhooks/signature_verifier.rb,
lib/pay/paddle/webhooks/subscription_created.rb,
lib/pay/paddle/webhooks/subscription_updated.rb,
lib/pay/stripe/webhooks/subscription_created.rb,
lib/pay/stripe/webhooks/subscription_deleted.rb,
lib/pay/stripe/webhooks/subscription_updated.rb,
lib/pay/stripe/webhooks/subscription_renewing.rb,
app/controllers/pay/webhooks/paddle_controller.rb,
app/controllers/pay/webhooks/stripe_controller.rb,
lib/pay/paddle/webhooks/subscription_cancelled.rb,
lib/pay/stripe/webhooks/payment_method_updated.rb,
lib/pay/stripe/webhooks/payment_action_required.rb,
lib/pay/stripe/webhooks/payment_method_attached.rb,
lib/pay/stripe/webhooks/payment_method_detached.rb,
lib/pay/braintree/webhooks/subscription_canceled.rb,
lib/pay/stripe/webhooks/payment_intent_succeeded.rb,
app/controllers/pay/webhooks/braintree_controller.rb,
lib/pay/stripe/webhooks/checkout_session_completed.rb,
lib/pay/braintree/webhooks/subscription_trial_ended.rb,
lib/pay/braintree/webhooks/subscription_went_active.rb,
lib/pay/braintree/webhooks/subscription_went_past_due.rb,
lib/pay/paddle/webhooks/subscription_payment_refunded.rb,
lib/pay/paddle/webhooks/subscription_payment_succeeded.rb,
lib/pay/braintree/webhooks/subscription_charged_successfully.rb,
lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb,
lib/pay/stripe/webhooks/checkout_session_async_payment_succeeded.rb

Overview

A subscription successfully moves to the next billing cycle. This will also occur when either a new transaction is created mid-cycle due to proration on an upgrade or a billing cycle is skipped due to the presence of a negative balance that covers the cost of the subscription.

Defined Under Namespace

Modules: Adapter, ApplicationHelper, Attributes, Billable, Braintree, Env, FakeProcessor, Generators, NanoId, Paddle, Receipts, Stripe, Webhooks Classes: ActionRequired, ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Charge, Currency, Customer, CustomerSyncJob, Engine, Error, InvalidPaymentMethod, Merchant, Payment, PaymentError, PaymentMethod, PaymentsController, Subscription, UserMailer, Webhook

Constant Summary collapse

VERSION =
"4.0.0"
@@model_parent_class =
"ApplicationRecord"
@@automount_routes =
true
@@default_product_name =
"default"
@@default_plan_name =
"default"
@@routes_path =
"/pay"
@@enabled_processors =
[:stripe, :braintree, :paddle]
@@emails =
ActiveSupport::OrderedOptions.new

Class Method Summary collapse

Class Method Details

.send_email?(email_option, *remaining_args) ⇒ Boolean

Returns:

  • (Boolean)

67
68
69
70
71
72
73
74
75
# File 'lib/pay.rb', line 67

def self.send_email?(email_option, *remaining_args)
  config_option = emails.send(email_option)

  if config_option.respond_to?(:call)
    config_option.call(*remaining_args)
  else
    config_option
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Pay)

    the object that the method was called on


63
64
65
# File 'lib/pay.rb', line 63

def self.setup
  yield self
end