Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit c465ad2

Browse files
Rename /charge to /capture_payment (#49)
Remove redundant `/create_charge` endpoint
1 parent cf52ab4 commit c465ad2

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

web.rb

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def log_info(message)
3737
key.to_json
3838
end
3939

40-
post '/charge' do
40+
post '/capture_payment' do
4141
authenticate!
4242
# Get the credit card details submitted
4343
payload = params
@@ -91,31 +91,9 @@ def authenticate!
9191
@customer
9292
end
9393

94-
# This endpoint is used by the Obj-C and Android example apps to create a charge.
95-
post '/create_charge' do
96-
# Create and capture the PaymentIntent via Stripe's API - this will charge the user's card
97-
begin
98-
payment_intent = create_and_capture_payment_intent(
99-
params[:amount],
100-
params[:source],
101-
params[:payment_method],
102-
nil,
103-
params[:metadata],
104-
'usd',
105-
nil
106-
)
107-
rescue Stripe::StripeError => e
108-
status 402
109-
return log_info("Error: #{e.message}")
110-
end
111-
112-
status 200
113-
return payment_intent.to_json
114-
end
115-
11694
# This endpoint is used by the mobile example apps to create a PaymentIntent.
11795
# https://stripe.com/docs/api/payment_intents/create
118-
# Just like the `/create_charge` endpoint, a real implementation would include controls
96+
# Just like the `/capture_payment` endpoint, a real implementation would include controls
11997
# to prevent misuse
12098
post '/create_intent' do
12199
begin

0 commit comments

Comments
 (0)