1
0
mirror of synced 2026-08-06 07:06:54 +00:00

FEATURE: Allow one-time purchases on products (#18)

Building off the foundation of using the Prices API, this PR adds the ability to create a one-time purchase plan for any product, which then can add a user to the specified plan group.

Some things to be aware of:

    One-time purchases cannot have trials.
    One-time purchases use the Invoice API instead of Subscriptions. Invoices are created then charged immediately.
    Users should receive emails for these invoices directly from Stripe just like subscriptions.
This commit is contained in:
Justin DiRose
2020-07-22 11:06:34 -05:00
committed by GitHub
parent fcc90e4fcc
commit 587661fafb
31 changed files with 272 additions and 533 deletions
+2 -13
View File
@@ -6,7 +6,6 @@ en:
discourse_subscriptions_secret_key: Stripe Secret Key
discourse_subscriptions_webhook_secret: Stripe Webhook Secret
discourse_subscriptions_currency: Default Currency Code. This can be overridden when creating a subscription plan.
discourse_subscriptions_allow_payments: Allow single payments
errors:
discourse_patrons_amount_must_be_currency: "Currency amounts must be currencies without dollar symbol (eg 1.50)"
js:
@@ -21,6 +20,7 @@ en:
subscribe: Subscribe
user_activity:
payments: Payments
one_time_payment: One-Time Payment
plans:
purchase: Purchase a subscription
select: Select subscription plan
@@ -36,18 +36,6 @@ en:
validate:
payment_options:
required: Please select a subscription plan.
payment:
purchase: Make just one payment
select: Select a payment option
interval:
One payment
payment_button:
Pay Once
success: Thank you!
incomplete: Payment is incomplete.
validate:
payment_options:
required: Please select a payment option.
user:
payments:
id: Payment ID
@@ -140,6 +128,7 @@ en:
group_help: This is the discourse user group the customer gets added to when the subscription is created.
active: Active
created_at: Created
recurring: Recurring Plan?
subscriptions:
title: Subscriptions
subscription:
-2
View File
@@ -20,8 +20,6 @@ DiscourseSubscriptions::Engine.routes.draw do
resources :customers, only: [:create]
resources :hooks, only: [:create]
resources :invoices, only: [:index]
resources :payments, only: [:create]
resources :plans, only: [:index], constraints: SubscriptionsUserConstraint.new
resources :products, only: [:index, :show]
resources :subscriptions, only: [:create]
-3
View File
@@ -13,9 +13,6 @@ plugins:
discourse_subscriptions_webhook_secret:
default: ''
client: false
discourse_subscriptions_allow_payments:
default: false
client: true
discourse_subscriptions_currency:
client: true
default: "USD"