building a payments site with stripe using ruby on rails

1
Building a Payments Site with Stripe using Ruby on Rails Global digital currencies such as Bitcoin are disrup4ng online commerce and the landscape of digital payments is going to undergo a lot of change in the next decade. This reflects a popular use of the internet: to pass bits back and forth that represent transac4ons in exchange for goods and services. Buying things on the internet and ge?ng billed for subscrip4ons is ubiquitous in our day to day lives. Yet, building a site that accepts tradi4onal payment methods can be a daun4ng task. Dealing with redirects, logins, and checkouts with PayPal API can be a huge pain– but fear not! I will walk through the basic structure of an ecommerce site and then implement an applica4on with Stripe subscrip4on billing and an applica4on with the Hello World of payments: Stripe Checkout for Rails. Why Ruby on Rails and Stripe: Stripe API is easy to use, well documented, has clear cut pricing, integrates easily into Rails applica4ons, and is arguably the most straighOorward way to learn how to handle online payments. Ruby on Rails is a database agnos4c, robust, opinionated web development framework with a large community behind it and many resources in which to learn and contribute. How ecommerce sites work Membership sites that restrict access to content (media, SoRware as as Service, etc.) Revenue model is the same: subscrip4on based services, usually paid monthly Basic func4onality: Content/web func4onality to deliver Landing pages to convert visitors to paying customers User management to register/remove users Access control to limit site wide access Authoriza4on management to restrict access to content or services based on role or other characteris4cs Account management to maintain records/subscrip4on status Recurring billing system for periodic payment transac4ons Addi;onal considera;ons: Tiered pricing for mul4ple subscrip4on plans Op4onal "free trial" subscrip4on Subscribers can upgrade/downgrade plans Subscribers can cancel subscrip4on plans Configure the subscrip4on renewal period (Stripe defaults to one month) Administrator can change subscrip4on plan or delete user Basecamp style subdomains (each user gets their own subdomain) Mul4tenancy database segmenta4on (ex. using Apartment gem) B A C K G R O U N D D E S I G N I M P L E M E N T A T I O N Future of electronic payments Mobile: 1.5 billion global smartphone users predicted by 2017 Underserved merchants want alterna4ve way to pay: SaaS based companies and industries in developing markets Decentralized cryptocurrencies gaining trac4on Learning more: Ruby on Rails Tutorial by Michael Hartl Mastering Modern Payments: Using Stripe with Rails by Pete Keen Daniel Kehoe’s RailsApps Project So>ware as a Disservice by Giles Bowkec Credit and thanks: Senior Poster Advisor: Randy Shull Major Advisor: Jean Herbst Key challenges/requirements: PCI compliance: key requirement for any ecommerce site. This will minimize risk of customer credit card exposure. Your website will meet PCI compliance if you accept payment informa4on through the Stripe JS library and serve your payment page through SSL. It’s wise to host any app that requires login through an SSL connec4on. Merchant account: a line of credit that allows a business to accept credit card payments from its customers. Stripe provides this service. Recurring billing and account management must be in sync. Stripe provides webhooks to make sure this happens. Stripe will ini4ate an HTTP request to the app and that will no4fy the app to change a subscrip4on status. Simple Payments with Stripe Checkout Embedded payment form that works for desktop, mobile, tablet En4re purchase experience handled by Stripe Subscrip;on Billing with Stripe API Use meta tag to set the Stripe Public API Key Access external Javascript libraries to submit data to Stripe and obtain a Stripe token that indirectly references a credit card. Subscrip;on Billing Simple Payment Form Polina Soshnin | Spring 2014

Upload: trinhdiep

Post on 06-Jan-2017

223 views

Category:

Documents


2 download

TRANSCRIPT

Building a Payments Site with Stripe using Ruby on Rails

Global  digital  currencies  such  as  Bitcoin  are  disrup4ng  online  commerce  and  the  landscape  of  digital  payments  is  going  to  undergo  a  lot  of  change  in  the  next  decade.  This  reflects  a  popular  use  of  the  internet:  to  pass  bits  back  and  forth  that  represent  transac4ons  in  exchange  for  goods  and  services.    Buying  things  on  the  internet  and  ge?ng  billed  for  subscrip4ons  is  ubiquitous  in  our  day  to  day  lives.  Yet,  building  a  site  that  accepts  tradi4onal  payment  methods  can  be  a  daun4ng  task.  Dealing  with  redirects,  logins,  and  checkouts  with  PayPal  API  can  be  a  huge  pain–  but  fear  not!  I  will  walk  through  the  basic  structure  of  an  ecommerce  site  and  then  implement  an  applica4on  with  Stripe  subscrip4on  billing  and  an  applica4on  with  the  Hello  World  of  payments:  Stripe  Checkout  for  Rails.    

Why  Ruby  on  Rails  and  Stripe:  Stripe  API  is  easy  to  use,  well  documented,  has  clear  cut  pricing,  integrates  easily  into  Rails  applica4ons,  and  is  arguably  the  most  straighOorward  way  to  learn  how  to  handle  online  payments.  Ruby  on  Rails  is  a  database  agnos4c,  robust,  opinionated  web  development  framework  with  a  large  community  behind  it  and  many    resources  in  which  to  learn  and  contribute.        

How  ecommerce  sites  work    Membership  sites  that  restrict  access  to  content  (media,  SoRware  as  as  Service,  etc.)  Revenue  model  is  the  same:  subscrip4on  based  services,  usually  paid  monthly  Basic  func4onality:  •  Content/web  func4onality  to  deliver  •  Landing  pages  to  convert  visitors  to  paying  customers  •  User  management  to  register/remove  users  •  Access  control  to  limit  site  wide  access  •  Authoriza4on  management  to  restrict  access  to  content  or  

services  based  on  role  or  other  characteris4cs  •  Account  management  to  maintain  records/subscrip4on  status  •  Recurring  billing  system  for  periodic  payment  transac4ons    

Addi;onal  considera;ons:  •  Tiered  pricing  for  mul4ple  subscrip4on  

plans  •  Op4onal  "free  trial"  subscrip4on  •  Subscribers  can  upgrade/downgrade  plans  •  Subscribers  can  cancel  subscrip4on  plans  •  Configure  the  subscrip4on  renewal  period  

(Stripe  defaults  to  one  month)  •  Administrator  can  change  subscrip4on  

plan  or  delete  user  •  Basecamp  style  subdomains  (each  user  

gets  their  own  subdomain)  •  Mul4tenancy  database  segmenta4on  (ex.  

using  Apartment  gem)        

B  A  C  K  G  R  O  U  N  D  

D  E  S  I  G  N  

I  M  P  L  E  M  E  N  T  A  T  I  O  N  

Future  of  electronic  payments        

•  Mobile:  1.5  billion  global  smartphone  users  predicted  by  2017  •  Underserved  merchants  want  alterna4ve  way  to  pay:  SaaS  

based  companies  and  industries  in  developing  markets  •  Decentralized  cryptocurrencies  gaining  trac4on  

Learning  more:    Ruby  on  Rails  Tutorial  by  Michael  Hartl  

Mastering  Modern  Payments:  Using  Stripe  with  Rails  by  Pete  Keen  Daniel  Kehoe’s  RailsApps  Project  

So>ware  as  a  Disservice  by  Giles  Bowkec  Credit  and    thanks:  

Senior  Poster  Advisor:  Randy  Shull  Major  Advisor:  Jean  Herbst  

                                       

Key  challenges/requirements:  •  PCI  compliance:  key  requirement  for  any  

ecommerce  site.  This  will  minimize  risk  of  customer  credit  card  exposure.  Your  website  will  meet  PCI  compliance  if  you  accept  payment  informa4on  through  the  Stripe  JS  library  and  serve  your  payment  page  through  SSL.  It’s  wise  to  host  any  app  that  requires  login  through  an  SSL  connec4on.    

•  Merchant  account:  a  line  of  credit  that  allows  a  business  to  accept  credit  card  payments  from  its  customers.  Stripe  provides  this  service.  

•  Recurring  billing  and  account  management  must  be  in  sync.  Stripe  provides  webhooks  to  make  sure  this  happens.  Stripe  will  ini4ate  an  HTTP  request  to  the  app  and  that  will  no4fy  the  app  to  change  a  subscrip4on  status.  

   

                                           

                                           

Simple  Payments  with  Stripe  Checkout  •  Embedded  payment  form  that  works  for  desktop,  mobile,  

tablet  •  En4re  purchase  experience  handled  by  Stripe  

Subscrip;on  Billing  with  Stripe  API  •  Use  meta  tag  to  set  the  Stripe  Public  API  Key    •  Access  external  Javascript  libraries  to  submit  data  to  Stripe  and  

obtain  a  Stripe  token  that  indirectly  references  a  credit  card.  

Subscrip;on  Billing   Simple  Payment  Form  

Polina  Soshnin  |  Spring  2014