You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds some emails you can opt-in to sending to your customers.
Opt into them like this:
```ruby
Payola.configure do |config|
config.send_email_for :receipt, :admin_receipt
end
```
Possible emails include:
* `:receipt`
* `:refund`
* `:admin_receipt`
* `:admin_dispute`
* `:admin_refund`
* `:admin_failure`
`:receipt` and `:refund` both send to the email address on the
`Payola::Sale` instance from the `support_email` address. All of
the `:admin` messages are sent from and to the `support_email`
address.
Copy file name to clipboardExpand all lines: README.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ Payola is a drop-in Rails engine that lets you sell one or more products by just
12
12
* Asynchronous payments, usable with any background processing system
13
13
* Full webhook integration
14
14
* Easy extension hooks for adding your own functionality
15
+
* Customizable emails
15
16
16
17
To see Payola in action, check out the site for [Mastering Modern Payments: Using Stripe with Rails](https://www.masteringmodernpayments.com). Read the book to find out the whys behind Payola's design.
17
18
@@ -116,6 +117,12 @@ Payola wraps the StripeEvent gem for event processing and adds a few special sal
116
117
117
118
(In these examples, `<product_class>` is the underscore'd version of the product's class name.)
118
119
120
+
You can also subscribe to generic events that do not have the `product_class` included in them. Those are:
121
+
122
+
*`payola.sale.finished`, when a sale completes successfully
123
+
*`payola.sale.failed`, when a charge fails
124
+
*`payola.sale.refunded`, when a charge is refunded
125
+
119
126
### Pre-charge Filter
120
127
121
128
You can set a callback that Payola will call immediately before attempting to make a charge. You can use this to, for example, check to see if the email address has been used already. To stop Payola from making a charge, throw a `RuntimeError`. The sale will be set to `errored` state and the message attached to the runtime error will be propogated back to the user.
@@ -196,6 +203,34 @@ Payola.background_worker = lambda do |klass, *args|
196
203
end
197
204
```
198
205
206
+
### Emails
207
+
208
+
Payola includes basic emails that you can optionally send to your customers and yourself. Opt into them like this:
209
+
210
+
```ruby
211
+
Payola.configure do |config|
212
+
config.send_email_for :receipt, :admin_receipt
213
+
end
214
+
```
215
+
216
+
Possible emails include:
217
+
218
+
*`:receipt`
219
+
*`:refund`
220
+
*`:admin_receipt`
221
+
*`:admin_dispute`
222
+
*`:admin_refund`
223
+
*`:admin_failure`
224
+
225
+
`:receipt` and `:refund` both send to the email address on the
226
+
`Payola::Sale` instance from the `support_email` address. All of
227
+
the `:admin` messages are sent from and to the `support_email`
228
+
address.
229
+
230
+
To customize the content of the emails, copy the appropriate views ([receipt](app/views/payola/receipt_mailer), [admin](app/views/payola/admin_mailer)) into your app at the same path (`app/views/payola/<whatever>`) and modify them as you like. You have access to `@sale` and `@product`, which is just a shortcut to `@sale.product`.
231
+
232
+
You can include a PDF with your receipt by setting the `include_pdf_receipt` option to `true`. This will send the `receipt_pdf.html` template to [Docverter](http://www.docverter.com) for conversion to PDF. See the [Docverter README](https://github.com/docverter/docverter) for installation instructions if you would like to run your own instance.
233
+
199
234
## Custom Forms
200
235
201
236
Payola's custom form support is basic but functional. Setting up a custom form has two steps. First, include the `stripe_header` partial in your layout's `<head>` tag:
0 commit comments