Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
Overview
About Stripe payments
Upgrade your integration
Payments analytics
Online payments
OverviewFind your use caseManaged Payments
Use Payment Links
Build a checkout page
Build an advanced integration
Build an in-app integration
Payment methods
Add payment methods
Manage payment methods
Faster checkout with Link
Payment interfaces
Payment Links
Checkout
Web Elements
In-app Elements
Payment scenarios
Handle multiple currencies
Custom payment flows
    Overview
    Payments for existing customers
    Authorize and capture a payment separately
    Build a two-step checkout flow
    Collect payment details before creating an Intent
    Finalize payments on the server
    Take mail orders and telephone orders (MOTO)
    US and Canadian cards
    Forward card details to third-party API endpoints
    Payments line items
      Flexible payment scenarios
Flexible acquiring
Orchestration
In-person payments
Terminal
Beyond payments
Incorporate your company
Crypto
Financial Connections
Climate
Understand fraud
Radar fraud protection
Manage disputes
Verify identities
HomePaymentsCustom payment flowsPayments line items

Use payment line items in flexible payment scenarios.Public preview

Use payment line items with complex payments such as multicaptures and overcaptures.

You can use payment line items during complex payments such as multicaptures and overcaptures.

Multicapture

You can use payment line items during multicaptures.

Note

Multicapture isn’t supported for Klarna or PayPal.

Create and confirm an uncaptured PaymentIntent

Note

The API response doesn’t include line items by default. To return line items, expand amount_details.line_items.

Specify the capture_method as manual when creating the PaymentIntent and use the if_available parameter to request multicapture for this payment. The created PaymentIntent allows multiple captures if the payment method supports it.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount=4600 \ -d currency=usd \ -d "payment_method_types[0]"=card \ -d payment_method=pm_card_visa \ -d "payment_method_options[card][request_multicapture]"=if_available \ -d "payment_details[customer_reference]"=customer_reference \ -d "payment_details[order_reference]"=order_reference \ -d "amount_details[discount_amount]"=200 \ -d "amount_details[tax][total_tax_amount]"=400 \ -d "amount_details[shipping][from_postal_code]"=94110 \ -d "amount_details[shipping][to_postal_code]"=94117 \ -d "amount_details[shipping][amount]"=400 \ -d "amount_details[line_items][0][product_code]"=SKU001 \ -d "amount_details[line_items][0][product_name]"="Product 001" \ -d "amount_details[line_items][0][unit_cost]"=2000 \ -d "amount_details[line_items][0][quantity]"=1 \ -d "amount_details[line_items][0][unit_of_measure]"=feet \ -d "amount_details[line_items][0][payment_method_options][card][commodity_code]"=123123 \ -d "amount_details[line_items][1][product_code]"=SKU002 \ -d "amount_details[line_items][1][product_name]"="Product 002" \ -d "amount_details[line_items][1][unit_cost]"=2000 \ -d "amount_details[line_items][1][quantity]"=1 \ -d "amount_details[line_items][1][unit_of_measure]"=gallons \ -d "amount_details[line_items][1][payment_method_options][card][commodity_code]"=123123 \ -d confirm=true \ -d capture_method=manual \ -d "expand[0]"="amount_details.line_items"

In the response, the amount_details field contains the line items specified on the PaymentIntent.

{ "amount": 4600, "amount_capturable": 4600, "amount_received": 0, "payment_details": { "customer_reference": "customer_reference", "order_reference": "order_reference" }, "amount_details": { "discount_amount": 200, "tax": { "total_tax_amount": 400 }, "shipping": { "from_postal_code": "94110", "to_postal_code": "94117", "amount": 400 }, "line_items": [ { "product_code": "SKU001", "product_name": "Product 001", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "feet", "payment_method_options": { "card": { "commodity_code": "123123" } } }, { "product_code": "SKU002", "product_name": "Product 002", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "gallons", "payment_method_options": { "card": { "commodity_code": "123123" } } } ] } ... }

Capture the PaymentIntent

  • You can add amount_details on the first capture even if they weren’t specified at creation.
  • If you provided amount_details at creation, you must either pass in amount_details or unset them on the first capture.

The same rules apply to amount_details[line_items]—you can add them on the first capture if not specified at creation, but must include or explicitly unset them if they were present at creation.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents/pi_xxxxxxxx/capture \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount_to_capture=2300 \ -d "payment_details[customer_reference]"=customer_reference \ -d "payment_details[order_reference]"=order_reference \ -d "amount_details[discount_amount]"=100 \ -d "amount_details[tax][total_tax_amount]"=200 \ -d "amount_details[shipping][from_postal_code]"=94110 \ -d "amount_details[shipping][to_postal_code]"=94117 \ -d "amount_details[shipping][amount]"=200 \ -d "amount_details[line_items][0][product_code]"=SKU001 \ -d "amount_details[line_items][0][product_name]"="Product 001" \ -d "amount_details[line_items][0][unit_cost]"=2000 \ -d "amount_details[line_items][0][quantity]"=1 \ -d "amount_details[line_items][0][unit_of_measure]"=feet \ -d "amount_details[line_items][0][payment_method_options][card][commodity_code]"=123123 \ -d final_capture=false \ -d "expand[0]"="amount_details.line_items"

In the response, the amount_details field contains the line items specified on the first capture.

{ "amount": 4600, "amount_capturable": 2300, "amount_received": 2300, "payment_details": { "customer_reference": "customer_reference", "order_reference": "order_reference" }, "amount_details": { "discount_amount": 100, "tax": { "total_tax_amount": 200 }, "shipping": { "from_postal_code": "94110", "to_postal_code": "94117", "amount": 200 }, "line_items": [ { "product_code": "SKU001", "product_name": "Product 001", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "feet", "payment_method_options": { "card": { "commodity_code": "123123" } } } ] }, "status": "requires_capture" ... }

The PaymentIntent remains in a requires_capture state. At this point, you can either:

  • Continue to capture the PaymentIntent multiple times up to the full amount of the PaymentIntent.
  • Transition the PaymentIntent to a succeeded state by setting final_capture to true, or making a capture without the final_capture parameter (because final_capture defaults to true).
  • If previous captures included amount_details or amount_details[line_items], you must continue to include them in subsequent captures.
  • If previous captures didn’t include these fields, you can’t add them in later captures.
Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents/pi_xxxxxxxx/capture \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount_to_capture=2300 \ -d "payment_details[customer_reference]"=customer_reference \ -d "payment_details[order_reference]"=order_reference \ -d "amount_details[discount_amount]"=100 \ -d "amount_details[tax][total_tax_amount]"=200 \ -d "amount_details[shipping][from_postal_code]"=94110 \ -d "amount_details[shipping][to_postal_code]"=94117 \ -d "amount_details[shipping][amount]"=200 \ -d "amount_details[line_items][0][product_code]"=SKU002 \ -d "amount_details[line_items][0][product_name]"="Product 002" \ -d "amount_details[line_items][0][unit_cost]"=2000 \ -d "amount_details[line_items][0][quantity]"=1 \ -d "amount_details[line_items][0][unit_of_measure]"=gallons \ -d "amount_details[line_items][0][payment_method_options][card][commodity_code]"=123123 \ -d final_capture=false \ -d "expand[0]"="amount_details.line_items"

In the response, the amount_details field contains the line items from the first two captures, according to the following rules:

  • discount_amount, tax.total_tax_amount and shipping.amount are summed across captures.
  • shipping.from_postal_code and shipping.to_postal_code might be omitted in the captures, but if it’s provided, you must not change it across captures.
  • line_items will be aggregated across captures.
{ "amount": 4600, "amount_capturable": 0, "amount_received": 4600, "payment_details": { "customer_reference": "customer_reference", "order_reference": "order_reference" }, "amount_details": { "discount_amount": 200, "tax": { "total_tax_amount": 400 }, "shipping": { "from_postal_code": "94110", "to_postal_code": "94117", "amount": 400 }, "line_items": [ { "product_code": "SKU001", "product_name": "Product 001", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "feet", "payment_method_options": { "card": { "commodity_code": "123123" } } }, { "product_code": "SKU002", "product_name": "Product 002", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "gallons", "payment_method_options": { "card": { "commodity_code": "123123" } } } ] }, "status": "succeeded" ... }

Overcapture

You can use payment line items during overcaptures.

Create and confirm an uncaptured PaymentIntent

Note

The API response doesn’t include line items by default. To return line items, expand amount_details.line_items.

Specify the capture_method as manual when creating the PaymentIntent and use the if_available parameter to request overcapture for this payment. The created PaymentIntent allows overcapture if the payment method supports it.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount=4600 \ -d currency=usd \ -d "payment_method_types[0]"=card \ -d payment_method=pm_card_visa \ -d "payment_method_options[card][request_overcapture]"=if_available \ -d "payment_details[customer_reference]"=customer_reference \ -d "payment_details[order_reference]"=order_reference \ -d "amount_details[discount_amount]"=200 \ -d "amount_details[tax][total_tax_amount]"=400 \ -d "amount_details[shipping][from_postal_code]"=94110 \ -d "amount_details[shipping][to_postal_code]"=94117 \ -d "amount_details[shipping][amount]"=400 \ -d "amount_details[line_items][0][product_code]"=SKU001 \ -d "amount_details[line_items][0][product_name]"="Product 001" \ -d "amount_details[line_items][0][unit_cost]"=2000 \ -d "amount_details[line_items][0][quantity]"=1 \ -d "amount_details[line_items][0][unit_of_measure]"=feet \ -d "amount_details[line_items][0][payment_method_options][card][commodity_code]"=123123 \ -d "amount_details[line_items][1][product_code]"=SKU002 \ -d "amount_details[line_items][1][product_name]"="Product 002" \ -d "amount_details[line_items][1][unit_cost]"=2000 \ -d "amount_details[line_items][1][quantity]"=1 \ -d "amount_details[line_items][1][unit_of_measure]"=gallons \ -d "amount_details[line_items][1][payment_method_options][card][commodity_code]"=123123 \ -d confirm=true \ -d capture_method=manual \ -d "expand[0]"="amount_details.line_items"

In the response, the amount_details field contains the line items specified on the PaymentIntent.

{ "amount": 4600, "amount_capturable": 4600, "amount_received": 0, "payment_details": { "customer_reference": "customer_reference", "order_reference": "order_reference" }, "amount_details": { "discount_amount": 200, "tax": { "total_tax_amount": 400 }, "shipping": { "from_postal_code": "94110", "to_postal_code": "94117", "amount": 400 }, "line_items": [ { "product_code": "SKU001", "product_name": "Product 001", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "feet", "payment_method_options": { "card": { "commodity_code": "123123" } } }, { "product_code": "SKU002", "product_name": "Product 002", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "gallons", "payment_method_options": { "card": { "commodity_code": "123123" } } } ] } ... }

Capture the PaymentIntent

To capture more than the currently authorized amount on a PaymentIntent, use the capture endpoint and provide an amount_to_capture up to the maximum_amount_capturable.

Pass in an updated amount_details hash that is consistent with the capture amount during Capture.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node
Go
.NET
No results
curl https://api.stripe.com/v1/payment_intents/pi_xxxxxxxx/capture \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d amount_to_capture=5000 \ -d "payment_details[customer_reference]"=customer_reference \ -d "payment_details[order_reference]"=order_reference \ -d "amount_details[discount_amount]"=200 \ -d "amount_details[tax][total_tax_amount]"=600 \ -d "amount_details[shipping][from_postal_code]"=94110 \ -d "amount_details[shipping][to_postal_code]"=94117 \ -d "amount_details[shipping][amount]"=600 \ -d "amount_details[line_items][0][product_code]"=SKU001 \ -d "amount_details[line_items][0][product_name]"="Product 001" \ -d "amount_details[line_items][0][unit_cost]"=2000 \ -d "amount_details[line_items][0][quantity]"=1 \ -d "amount_details[line_items][0][unit_of_measure]"=feet \ -d "amount_details[line_items][0][payment_method_options][card][commodity_code]"=123123 \ -d "amount_details[line_items][1][product_code]"=SKU002 \ -d "amount_details[line_items][1][product_name]"="Product 002" \ -d "amount_details[line_items][1][unit_cost]"=2000 \ -d "amount_details[line_items][1][quantity]"=1 \ -d "amount_details[line_items][1][unit_of_measure]"=gallons \ -d "amount_details[line_items][1][payment_method_options][card][commodity_code]"=123123 \ -d "expand[0]"="amount_details.line_items"

In the response, the amount_details field contains the line items specified during capture.

{ "amount": 5000, "amount_capturable": 0, "amount_received": 5000, "payment_details": { "customer_reference": "customer_reference", "order_reference": "order_reference" }, "amount_details": { "discount_amount": 200, "tax": { "total_tax_amount": 600 }, "shipping": { "from_postal_code": "94110", "to_postal_code": "94117", "amount": 600 }, "line_items": [ { "product_code": "SKU001", "product_name": "Product 001", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "feet", "payment_method_options": { "card": { "commodity_code": "123123" } } }, { "product_code": "SKU002", "product_name": "Product 002", "unit_cost": 2000, "quantity": 1, "unit_of_measure": "gallons", "payment_method_options": { "card": { "commodity_code": "123123" } } } ] }, "status": "succeeded" ... }
Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Join our early access program.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc