Replies: 3 comments
-
Based on: https://github.com/pay-rails/pay/blob/main/docs/stripe/4_sca.md, I need to catch the exception and send an email to the user to authenticate the payment, right? |
Beta Was this translation helpful? Give feedback.
-
So, I added a new webhook to send an email when the app receives # app/mailers/extended_pay_mailer.rb
class ExtendedPayMailer < Pay.mailer
def payment_intent_action_required
mail mail_arguments
end
end # app/views/extended_pay_mailer/payment_intent_action_required.html.erb
<h3>Extra confirmation is needed to process your payment</h3>
<p>Your <%= Pay.application_name %> subscription requires confirmation to process your payment to continue access.</p>
<p><%= link_to "Confirm your payment", pay.payment_url(params[:payment_intent_id]) %></p>
<p>If you have any questions, please hit reply and let us know.</p>
<p>— The <%= Pay.application_name %> Team</p> # app/webhooks/payment_intent_action_required.rb
class PaymentIntentActionRequired
def call(event)
pay_customer = Pay::Customer.find_by(processor: :stripe, processor_id: event.data.object.customer)
return if pay_customer.nil?
ExtendedPayMailer.with(
pay_customer:,
payment_intent_id: event.data.object.id
).payment_intent_action_required.deliver_later
end
end # config/initializers/pay.rb
ActiveSupport.on_load(:pay) do
Pay::Webhooks.delegator.subscribe 'stripe.payment_intent.requires_action', PaymentIntentActionRequired.new
end
Pay.setup do |config|
config.application_name = 'application_name'
config.business_name = 'business_name'
config.business_address = 'business_address'
config.support_email = 'support_email'
config.send_emails = true
end The email view is similar to @excid3 What do you think? |
Beta Was this translation helpful? Give feedback.
-
I think this email type should be added to Pay, what do you think? |
Beta Was this translation helpful? Give feedback.
-
I want to charge users at the end of each month manually, as I calculate their usage and charge it 1 time per month.
This works fine with non-3D secure cards, but when I tested it with 3D secure cards, Pay raises this exception:
How to fix this? Maybe sending a link to the user to authenticate and complete the payment?
Beta Was this translation helpful? Give feedback.
All reactions