Skip to main content

Email Stripe Receipts

Rails • Asked by Steve Polito

Firstly, thanks for the great Stripe tutorials! I just finished implimenting basic subscriptions on my rails app. However, I do have a few questions regarding emails.

Will Stripe automatically email a receipt to the customer upon each charge.succeeded event? Or, do I need to impliment this on my end via Webhooks?

If I need to do this via Webhooks, would I do something like the following?

class RecordCharges
    def call(event)
        ...
        SubscriptionMailer.charge_succeeded.deliver_now
        ...
    end
end

StripeEvent.configure do |events|
  events.subscribe 'charge.succeeded', RecordCharges.new
end

Hey Steve!

Stripe has their own receipts that you can enable but they're very basic. You'll probably want to turn those off and send your own emails here.

Your code for this is exactly right. You'll want to pass in the charge / user information into the Mailer so that it has access to that to print it all out, but that's the only other thing you should really need to setup. I also added the PDF as an attachment to the email receipts for GoRails as well which has been nice. Might also consider doing that if you've got PDF receipts.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.