Stripe has a newer API called Prices where you can create a price for any product and it can either be recurring or one-time. The easy part is existing Plans work with the Prices API by passing a Plan ID, but objects are returned in the slightly-different Prices API object format. This commit is a refactor to the new API to handle the data in its new form, and lays the foundation for a one time payment plan to be added to any subscriptions product.
55 lines
1.4 KiB
Handlebars
55 lines
1.4 KiB
Handlebars
|
|
{{#if paymentsAllowed}}
|
|
<div class="subscribe-buttons">
|
|
{{#ds-button
|
|
id="discourse-subscriptions-payment-type-plan"
|
|
selected=planButtonSelected
|
|
action="selectPlans"
|
|
class="btn-discourse-subscriptions-payment-type"
|
|
}}
|
|
{{i18n "discourse_subscriptions.plans.purchase"}}
|
|
{{/ds-button}}
|
|
|
|
{{#ds-button
|
|
id="discourse-subscriptions-payment-type-payment"
|
|
selected=paymentButtonSelected
|
|
action="selectPayments"
|
|
class="btn-discourse-subscriptions-payment-type"
|
|
}}
|
|
{{i18n "discourse_subscriptions.payment.purchase"}}
|
|
{{/ds-button}}
|
|
</div>
|
|
{{/if}}
|
|
|
|
<hr>
|
|
|
|
<p>
|
|
{{#if planTypeIsSelected}}
|
|
{{i18n "discourse_subscriptions.plans.select"}}
|
|
{{else}}
|
|
{{i18n "discourse_subscriptions.payment.select"}}
|
|
{{/if}}
|
|
</p>
|
|
|
|
<div class="subscribe-buttons">
|
|
{{#each plans as |plan|}}
|
|
{{#ds-button
|
|
action="clickPlan"
|
|
actionParam=plan
|
|
selected=plan.selected
|
|
class="btn-discourse-subscriptions-subscribe"
|
|
}}
|
|
<div class="interval">
|
|
{{#if planTypeIsSelected}}
|
|
{{i18n (concat "discourse_subscriptions.plans.interval.adverb." plan.recurring.interval)}}
|
|
{{else}}
|
|
{{i18n "discourse_subscriptions.payment.interval"}}
|
|
{{/if}}
|
|
</div>
|
|
<span class="amount">
|
|
{{format-currency plan.currency plan.amountDollars}}
|
|
</span>
|
|
{{/ds-button}}
|
|
{{/each}}
|
|
</div>
|