- Charge requires PHP 7.1+
- Stripe API >= 2019-10-17
- Copy Charge folder to
site/addons
- Run
php please update:addons
- If you're going to use subscriptions, register the webhook with Stripe here. Set it to
https://yoursite.com/!/Charge/webhook
.
-
Go to
cp/addons/charge/settings
and fill in the required fields.Collections
is for if you are using Workshop. -
in
charge.yaml
charge_collections
- which collection(s) you'll be using for the Workshop submissioncurrency
- default currency for paymentsplan
&role
- when a customer subscribles to a plan, which role(s) should they have. You could use this to have different membership tiers for example.from_email
- when the payment failed emails go out, what email account do they come fromone_time_payment_email_template
&one_time_payment_email_subject
- successful one time paymentcanceled_email_template
&canceled_email_subject
- when the subscription endspayment_failed_email_template
&payment_failed_email_subject
- when payment failsupcoming_payment_email_template
&upcoming_payment_email_subject
- when payment is upcomingsubscription_updated_email_template
&subscription_updated_email_template
- when subscription is changed
-
in your
.env
file, which MUST NOT be checked in with Git:- please note the proper format for the key/value pair
STRIPE_SECRET_KEY
- Stripe secret key, found here: https://dashboard.stripe.com/account/apikeysSTRIPE_PUBLIC_KEY
- Stripe public key, found here: https://dashboard.stripe.com/account/apikeysSTRIPE_WEBHOOK_SECRET
- Webhook signing secret, found here: https://dashboard.stripe.com/webhooks (click on the Charge webhook then "Click to reveal")
charge_collections:
- things
currency: usd
plans_and_roles:
-
plan: associate
role:
- dd062758-f56c-4ca5-a381-fe88f9c54517
from_email: [email protected]
one_time_payment_email_template: emails/one_time_payment
canceled_email_template: emails/cancel_subscription
payment_failed_email_template: emails/payment_failed
upcoming_payment_email_template: emails/payment_upcoming
payment_succeeded_email_template: emails/payment_successful
In the One Time Payment template, you have access to:
amount
- amount of chargecurrency
- currency the charge was indescription
- description of chargereceipt_url
- link to receipt on Stripe
In the upcoming payment template, you have access to:
amount
currency
due_date
first_name
last_name
plan
In the payment succeeded template, you have access to:
amount
currency
due_date
first_name
last_name
plan
In the payment failed template, you have access to:
amount
attempt_count
- how many times they've attempted paymentcurrency
due_date
first_name
last_name
next_payment_attempt
- when the next payment will be attemptedplan
In the updated & deleted subscription template, you have access to:
first_name
last_name
plan
subscription_end
- when the subscription ends or will be renewedsubscription_status
- when the next payment will be attempted
Please note that much of the payment processing now occurs on the front end, so please see the Stripe docs to understand the payment flow.
You have two options, One Time payments or subscriptions