lib/pay/paddle/subscription.rb in pay-3.0.17 vs lib/pay/paddle/subscription.rb in pay-3.0.18
- old
+ new
@@ -76,16 +76,22 @@
def cancel
ends_at = on_trial? ? trial_ends_at : processor_subscription.next_payment[:date]
PaddlePay::Subscription::User.cancel(processor_id)
pay_subscription.update(status: :canceled, ends_at: ends_at)
+
+ # Remove payment methods since customer cannot be reused after cancelling
+ Pay::PaymentMethod.where(customer_id: pay_subscription.customer_id).destroy_all
rescue ::PaddlePay::PaddlePayError => e
raise Pay::Paddle::Error, e
end
def cancel_now!
PaddlePay::Subscription::User.cancel(processor_id)
pay_subscription.update(status: :canceled, ends_at: Time.current)
+
+ # Remove payment methods since customer cannot be reused after cancelling
+ Pay::PaymentMethod.where(customer_id: pay_subscription.customer_id).destroy_all
rescue ::PaddlePay::PaddlePayError => e
raise Pay::Paddle::Error, e
end
def on_grace_period?