Commit Graph

17 Commits

Author SHA1 Message Date
Blake Erickson f0a08dbf24 DEV: Add some more verbose logging for debugging groups
Sometimes users aren't added to groups so adding some more logging
statements to aid in debugging.
2024-10-18 12:35:53 -06:00
Blake Erickson fa5e95860b
DEV: Fetch related guest payments (#234) 2024-08-28 21:51:34 -06:00
Blake Erickson 700c5e7727
FIX: Payments not showing up for users (#233)
Pricing table payments for one off purchases need to be attached to the
customer or they don't show up on the user's billing payments page.
2024-08-28 15:03:22 -06:00
Blake Erickson a2c70deeff
FIX: Create customer for one off pricing table purchases (#232)
When using the Stripe Pricing Table for one-off purchases
(non-subscription) stripe doesn't automatically create a customer
record. This was causing the pricing table webhook
endpoint to end prematurely and not add users to their appropriate
group after purchase. Now if we detect that there is no customer record
we will make an api call to Stripe to create one.
2024-08-28 11:27:55 -06:00
Blake Erickson 71643a023d
DEV: Use warn instead of info for Rails logger (#231)
Follow up to: e92dd39928
2024-08-28 09:17:08 -06:00
Blake Erickson e92dd39928
DEV: Add verbose logging site setting (#230)
To aid in debugging I'm adding a verbose logging site setting. I'm
adding this because I'm currently getting some errors in production that
I'm unable to replicate locally.

See: https://meta.discourse.org/t/323450/4
2024-08-27 18:40:12 -06:00
Blake Erickson f0b4984cee
FIX: Pricing table for one-off purchases (#228)
When using the Stripe Pricing table for one-off purchases
(non-subscriptions) the webhook was encountering an error because it was
expecting subscription information which does not exist for one-off
purchases. This fix addresses that issue ensuring that no errors occur,
that users are added to the appropriate group, and that uses can see
their purchase on the billing page.
2024-08-20 13:32:32 -06:00
Blake Erickson e132913db4
FIX: Login required for Stripe Checkout (#209)
If an anonymous user tries to subscribe we need to show them a log in
message first. We currently don't have support for anonymous
subscriptions.
2024-05-03 17:01:51 -06:00
Blake Erickson 66e8857c20
DEV: Stop deleting customers on cancel (#207)
Instead of deleting customers on cancel we will now update the
subscription status to canceled. This way we can have some visibility on
which users have canceled.
2024-05-02 13:38:30 -06:00
Blake Erickson 6f54494a3b
FIX: Allow active status for updated webhook (#203)
Likely there was an API change at some point now that we are using the
latest version of the stripe API. When the
`customer.subscription.updated` webhook is called we should also accept
the status of "active".
2024-04-29 15:50:05 -06:00
Blake Erickson 45754baa00
FEATURE: Add new stripe based pricing table (#202)
This commit adds an optional new stripe based pricing table.
If the user is logged in, the email field will be prepopulated with the users email.

The pricing table can be configured in the stripe dashboard.

Once the discourse_subscriptions_pricing_table setting is filled with the pricing table embed code from the stripe dashboard,
the pricing table will be displayed on /s/subscriptions

For more details see https://stripe.com/docs/payments/checkout/pricing-table
---------

Co-authored-by: spirobel <spirobel@protonmail.com>
2024-04-29 12:47:58 -06:00
Loïc Guitaut 87659e237b DEV: Fix new Rubocop offenses 2024-03-06 15:23:55 +01:00
David Taylor 4e1a17c40c
DEV: Introduce syntax_tree for ruby formatting (#144) 2022-12-29 13:35:06 +01:00
Bianca Nenciu a58743e376
FIX: Simplify Stripe webhook handler (#135)
The 'customer.subscription.created' webhooks were not handled at all and
the logic was overcomplicated.
2022-10-03 13:33:50 +03:00
Justin DiRose a868e6b838
FEATURE: Cancel payments at end of subscription vs immediately
Previously, when a user canceled a subscription, the access would revoke
immediately on Discourse vs. at the end of the billing period. This
commit changes the behavior to remove membership at the end of the
billing period using Stripe's `cancel_at_period_end` attribute on the
Subscription object.

This commit now requires the setup of webhooks for subscription
processing to occur correctly.
2020-08-19 14:37:47 -05:00
Justin DiRose 587661fafb
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.
2020-07-22 11:06:34 -05:00
Justin DiRose fb4f50478d
REFACTOR: Use engine to load files, add constraint (#14) 2020-07-06 11:11:04 -05:00