check subscription response
This commit is contained in:
@@ -35,7 +35,7 @@ module DiscourseDonations
|
||||
charge = payment.subscribe(email, params)
|
||||
end
|
||||
|
||||
if charge['paid'] == true
|
||||
if (params['amount'].present? && charge['paid'] == true) || charge['status'] == 'active'
|
||||
output['messages'] << I18n.t('donations.payment.success')
|
||||
|
||||
output['rewards'] << { type: :group, name: group_name } if group_name
|
||||
|
||||
@@ -24,14 +24,8 @@ module DiscourseDonations
|
||||
end
|
||||
|
||||
def subscribe(email, opts)
|
||||
customer = ::Stripe::Customer.create(
|
||||
email: email,
|
||||
source: opts[:stripeToken]
|
||||
)
|
||||
@subscription = ::Stripe::Subscription.create(
|
||||
customer: customer.id,
|
||||
plan: opts[:plan]
|
||||
)
|
||||
customer = ::Stripe::Customer.create(email: email, source: opts[:stripeToken])
|
||||
@subscription = ::Stripe::Subscription.create(customer: customer.id, plan: opts[:plan])
|
||||
@subscription
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user