Method: Stripe::ChargeService#capture

Defined in:
lib/stripe/services/charge_service.rb

#capture(charge, params = {}, opts = {}) ⇒ Object

Capture the payment of an existing, uncaptured charge that was created with the capture option set to false.

Uncaptured payments expire a set number of days after they are created ([7 by default](docs.stripe.com/docs/charges/placing-a-hold)), after which they are marked as refunded and capture attempts will fail.

Don’t use this method to capture a PaymentIntent-initiated charge. Use [Capture a PaymentIntent](docs.stripe.com/docs/api/payment_intents/capture).



11
12
13
14
15
16
17
18
19
# File 'lib/stripe/services/charge_service.rb', line 11

def capture(charge, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/charges/%<charge>s/capture", { charge: CGI.escape(charge) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end