Use payment line items in flexible payment scenarios. Public preview
Use payment line items with complex payments such as multicaptures and overcaptures. Copy for LLM View as Markdown 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.
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.
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
). Capture the PaymentIntent again
Partially capture the PaymentIntent
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. 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.
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.
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"
...
}