Skip to content

Instantly share code, notes, and snippets.

@fedeagripa
Created May 28, 2020 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedeagripa/d49a024299d2b8e315ff0861d32e9534 to your computer and use it in GitHub Desktop.
Save fedeagripa/d49a024299d2b8e315ff0861d32e9534 to your computer and use it in GitHub Desktop.
create subscription
# app/services/stripe_service.rb
def create_subscription
Stripe::Subscription.create(
customer: customer.id,
plan: subs_plan_id, # this is the id of your plan (eg: monthly, annual, etc)
coupon: discount_code # if you have any (check COUPONS section below to understand them in more detail)
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment