O'Reilly logo

Take My Money by Noel Rappin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Subscription Plans

From Stripe’s perspective, a subscription is a relationship between a plan and a customer, both of which are data objects defined by the Stripe API. We need information about both plans and customers in our own database, so we’ll need analogs of both data objects.

As far as Stripe is concerned, a plan has the following parts:

  • An amount, which is what the user is charged per subscription term. In U.S. currency, the amount is in cents.

  • An id, which we’ll store in our database as remote_id to distinguish it from our local ActiveRecord database ID. This ID is generated by us; Stripe doesn’t care what it is, as long as it’s unique within our list of plans.

  • An interval and interval_count, which specify the length of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required