This repository was archived by the owner on Feb 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed 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