Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.42 KB | None | 0 0
  1. begin
  2.   intent = Stripe::PaymentIntent.create({
  3.       amount: 1099,
  4.       currency: 'usd',
  5.       payment_method_types: ['card'],
  6.       payment_method: 'pm_card_threeDSecureRequired',
  7.       off_session: 'one_off',
  8.       confirm: true,
  9.   })
  10. rescue Stripe::CardError => e
  11.   puts "Card error uhoh!"
  12.   body = e.json_body
  13.   err  = body[:error]
  14.   intent = err[:payment_intent]
  15.   puts "PI status is: #{intent[:status]}"
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement