1
0
mirror of synced 2026-08-05 14:47:03 +00:00

stripe service can create subscriptions

This commit is contained in:
Rimian Perkins
2017-05-23 12:27:34 +10:00
parent f99aed364b
commit 9d2cd86f54
2 changed files with 50 additions and 18 deletions
@@ -23,6 +23,18 @@ module DiscourseDonations
@charge
end
def subscribe(email, opts)
customer = ::Stripe::Customer.create(
email: email,
source: opts[:stripeToken]
)
@subscription = ::Stripe::Subscription.create(
customer: customer.id,
plan: opts[:plan]
)
@subscription
end
def successful?
@charge[:paid]
end