This repository was archived by the owner on Feb 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -6,4 +6,4 @@ gem 'dotenv', '2.7.2'
6
6
gem 'encrypted_cookie' , '0.0.5'
7
7
gem 'json' , '2.2.0'
8
8
gem 'sinatra' , '2.0.5'
9
- gem 'stripe' , '4.12 .0'
9
+ gem 'stripe' , '4.21 .0'
Original file line number Diff line number Diff line change 8
8
faraday (0.15.4 )
9
9
multipart-post (>= 1.2 , < 3 )
10
10
json (2.2.0 )
11
- multipart-post (2.0.0 )
11
+ multipart-post (2.1.1 )
12
12
mustermann (1.0.3 )
13
- net-http-persistent (3.0.0 )
13
+ net-http-persistent (3.0.1 )
14
14
connection_pool (~> 2.2 )
15
15
rack (2.0.7 )
16
16
rack-protection (2.0.5 )
20
20
rack (~> 2.0 )
21
21
rack-protection (= 2.0.5 )
22
22
tilt (~> 2.0 )
23
- stripe (4.12 .0 )
23
+ stripe (4.21 .0 )
24
24
faraday (~> 0.13 )
25
25
net-http-persistent (~> 3.0 )
26
26
tilt (2.0.9 )
@@ -33,7 +33,7 @@ DEPENDENCIES
33
33
encrypted_cookie (= 0.0.5 )
34
34
json (= 2.2.0 )
35
35
sinatra (= 2.0.5 )
36
- stripe (= 4.12 .0 )
36
+ stripe (= 4.21 .0 )
37
37
38
38
RUBY VERSION
39
39
ruby 2.5.3p105
Original file line number Diff line number Diff line change @@ -120,6 +120,29 @@ def authenticate!
120
120
@customer
121
121
end
122
122
123
+ # This endpoint is used by the mobile example apps to create a SetupIntent.
124
+ # https://stripe.com/docs/api/setup_intents/create
125
+ # Just like the `/capture_payment` endpoint, a real implementation would include controls
126
+ # to prevent misuse
127
+ post '/create_setup_intent' do
128
+ begin
129
+ setup_intent = Stripe ::SetupIntent . create ( {
130
+ payment_method_types : [ 'card' ] ,
131
+ } )
132
+ rescue Stripe ::StripeError => e
133
+ status 402
134
+ return log_info ( "Error creating SetupIntent: #{ e . message } " )
135
+ end
136
+
137
+ log_info ( "SetupIntent successfully created: #{ setup_intent . id } " )
138
+ status 200
139
+ return {
140
+ :intent => setup_intent . id ,
141
+ :secret => setup_intent . client_secret ,
142
+ :status => setup_intent . status
143
+ } . to_json
144
+ end
145
+
123
146
# This endpoint is used by the mobile example apps to create a PaymentIntent.
124
147
# https://stripe.com/docs/api/payment_intents/create
125
148
# Just like the `/capture_payment` endpoint, a real implementation would include controls
You can’t perform that action at this time.
0 commit comments