SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   name = Faker::Name.name
  2.   email = UUID.generate.gsub("-", "")[0..10] + "@venntro.com"
  3.   customer = Stripe::Customer.create({
  4.     name: name.to_s,
  5.     email: email.to_s
  6.   })
  7.  
  8.   payment_method = Stripe::PaymentMethod.attach(
  9.     'pm_card_authenticationRequiredOnSetup',
  10.     { customer: customer.id }
  11.   )
  12.  
  13.   customer = Stripe::Customer.retrieve(customer.id)
  14.   subscription = Stripe::Subscription.create({
  15.     customer: customer.id.to_s,
  16.     off_session: true,
  17.     payment_behavior: "allow_incomplete",
  18.     items: [ { plan: PAYMENT_BAND_ITEM_ID.to_s } ],
  19.     expand: ['latest_invoice.payment_intent']
  20.   })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top