Intro
To set payment provider other than Stripe, definePAYMENT_PROVIDER
variable in your .env
.
Default and currently only supported payment provider is Stripe.
One-time payments
To use one-time payments setPAYMENT_PRODUCTS_TYPE
to single
in your .env
.Subscriptions
To use one-time payments setPAYMENT_PRODUCTS_TYPE
to recurring
in your .env
.This is the default setup.
Trial
To enable trial periods setPAYMENT_TRIAL_DAYS
to number of days.
Currency
Default currency is set toUSD
.
To update default currency for your plans and application, go to .env
file and update this variable:
Currency must be defined with lowercased ISO 4217 code.
Format
Default currency format isen_US
.
To update default currency format, go to .env
file:
Highlighted plan
If you want to highlight specific plan, for example the best value plan, setPAYMENT_HIGHLIGHTED_PRODUCT_ID
to the ID of the plan.
Cache
Some payment data, like products and coupons, is cached upon update. Cache keys are defined inconfig/payments.php
under settings.cache_keys
. Feel free to update those keys as you wish.
To delete data from cache manually you can call this command in your terminal:
Authenticated payments
When using one-time payments you can allow your users to buy products without registering their account. To enable this setPAYMENT_MUST_BE_AUTHENTICATED
to false
.
Subscriptions require user authentication.
Address
To enforce address calculation at checkout setPAYMENT_COLLECT_ADDRESS
to true
.
Taxes
To enable tax calculation at checkout setPAYMENT_CALCULATE_TAXES
to true
.
Tax IDs
To disable customer tax IDs at checkout setPAYMENT_COLLECT_TAX_IDS
to false
.
Enabled by default.
Discounts
To disable discount and coupons at checkout setPAYMENT_ALLOW_DISCOUNTS
to false
.
Enabled by default.
Coupons
To create a coupon go to Stripe dashboard, click Product catalog in sidebar, and then click Coupons in subnav, and then click Create coupon button. There you can set information about a percent-off or amount-off discount you might want to apply to a product, limitations, expiration, etc. To apply coupons to products, run this command and follow the prompts:Applied coupons reduce the price and cannot be removed during checkout by
user. This is the Stripe feature.
Promotion codes
To create a promotion code go to Stripe dashboard, click Product catalog in sidebar, then click Coupons in subnav, then create or select an existing coupon. On coupon page, look for Promotion Codes section and create new promotion codes for this coupon. Promotion Code represents a customer-redeemable code for a coupon. You can also apply promotion codes to your products using the same artisan command.To apply a promo code, you must use promotion code ID (API ID), not code
(Promotion code).
Customers must apply the code (30), and not ID (promo_1Q5p…).

Free trials
To enable free trials setPAYMENT_TRIAL_DAYS
to the number of days.
Free trials work only with subscriptions.
Without payment method up front
If you would like to offer trial periods without collecting the user’s payment method information up front, you may set thetrial_ends_at
column on the user record to your desired trial ending date.
This is typically done during user registration:
Check if subscribed
To check if user is subscribed you can use middlewaresubscribed
defined here app/Http/Middleware/Subscribed.php
.
This will check if user has any purchased product when using single payments or valid subscription when using recurring payments.
Unsubscribed users will be redirected and shown a corresponding toast
notification.