Sie können Posten für Zahlungen für komplexe Zahlungen verwenden, z.B. für Zahlungen mit Mehrfacherfassung und Übererfassung.
Multicapture Sie können Zahlungsposten bei Mehrfacherfassungen verwenden.
Hinweis Mehrfacherfassung wird für Klarna oder PayPal nicht unterstützt.
Einen nicht erfassten PaymentIntent erstellen und bestätigen Hinweis The API response doesn’t include line items by default. To return line items, expand amount_ details. line_ items.
Geben Sie bei der Erstellung des PaymentIntent die capture_ method als manual an und verwenden Sie den Parameter if_ available, um Mehrfacherfassung für diese Zahlung anzufordern. Der erstellte PaymentIntent ermöglicht mehrere Erfassungen, sofern die Zahlungsmethode dies unterstützt.
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 der Antwort enthält das Feld amount_ details die in PaymentIntent angegebenen Einzelposten.
{
"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"
}
}
}
]
}
...
}
PaymentIntent erfassen Sie können amount_ details beim ersten Erfassen hinzufügen, auch wenn sie bei der Erstellung nicht angegeben wurden. Wenn Sie bei der Erstellung amount_ details angegeben haben, müssen Sie entweder amount_ details übergeben oder sie bei der ersten Erfassung deaktivieren. Dieselben Regeln gelten für amount_ details[line_ items]. Sie können sie beim ersten Erfassen hinzufügen, wenn Sie sie nicht bei der Erstellung angegeben haben, müssen sie jedoch einbeziehen oder explizit entfernen, falls sie bei der Erstellung vorhanden waren.
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 der Antwort enthält das Feld amount_ details die bei der ersten Erfassung angegebenen Einzelposten.
{
"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" : {
"object" : "list" ,
"url" : "/v1/payment_intents/pi_xxxxxxxx/amount_details_line_items" ,
"has_more" : false ,
"data" : [
{
"_id" : "li_123" ,
"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"
...
}
Der PaymentIntent verbleibt im Status requires_ capture. An dieser Stelle können Sie entweder:
Erfassen Sie den PaymentIntent weiterhin mehrfach bis zum vollen Betrag des PaymentIntent. Versetzen Sie PaymentIntent in den Status succeeded, indem Sie final_ capture auf true setzen oder eine Erfassung ohne den final_ capture-Parameter durchführen (weil final_ capture standardmäßig auf true gesetzt ist). Erfassen Sie den PaymentIntent erneut
Erfassen Sie den PaymentIntent teilweise
Wenn frühere Erfassungen amount_ details oder amount_ details[line_ items] enthielten, müssen Sie sie weiterhin in nachfolgende Erfassungen einbeziehen. Wenn frühere Erfassungen diese Felder nicht enthielten, können Sie sie in späteren Erfassungen nicht hinzufügen. 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 der Antwort enthält das Feld amount_ details die Einzelposten der ersten beiden Erfassungen gemäß den folgenden Regeln:
discount_ amount, tax. total_ tax_ amount und shipping. amount werden über alle Erfassungen hinweg summiert.shipping. from_ postal_ code und shipping. to_ postal_ code könnten in den Erfassungen weggelassen werden, aber wenn sie bereitgestellt werden, dürfen Sie sie nicht zwischen den Erfassungen ändern.line_ items wird über alle Erfassungen hinweg aggregiert.{
"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" : {
"object" : "list" ,
"url" : "/v1/payment_intents/pi_xxxxxxxx/amount_details_line_items" ,
"has_more" : false ,
"data" : [
{
"_id" : "li_123" ,
"product_code" : "SKU001" ,
"product_name" : "Product 001" ,
"unit_cost" : 2000 ,
"quantity" : 1 ,
"unit_of_measure" : "feet" ,
"payment_method_options" : {
"card" : {
"commodity_code" : "123123"
}
}
} ,
{
"_id" : "li_234" ,
"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"
...
}
Übererfassung Sie können Zahlungsposten während Übererfassungen verwenden.
Einen nicht erfassten PaymentIntent erstellen und bestätigen Hinweis The API response doesn’t include line items by default. To return line items, expand amount_ details. line_ items.
Geben Sie bei der Erstellung des PaymentIntent die capture_ method als manual an und verwenden Sie den Parameter if_ available, um die Übererfassung für diese Zahlung anzufragen. Der erstellte PaymentIntent erlaubt die Übererfassung, wenn die Zahlungsmethode dies unterstützt.
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 der Antwort enthält das Feld amount_ details die in PaymentIntent angegebenen Einzelposten.
{
"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" : {
"object" : "list" ,
"url" : "/v1/payment_intents/pi_xxxxxxxx/amount_details_line_items" ,
"has_more" : false ,
"data" : [
{
"_id" : "li_345" ,
"product_code" : "SKU001" ,
"product_name" : "Product 001" ,
"unit_cost" : 2000 ,
"quantity" : 1 ,
"unit_of_measure" : "feet" ,
"payment_method_options" : {
"card" : {
"commodity_code" : "123123"
}
}
} ,
{
"_id" : "li_456" ,
"product_code" : "SKU002" ,
"product_name" : "Product 002" ,
"unit_cost" : 2000 ,
"quantity" : 1 ,
"unit_of_measure" : "gallons" ,
"payment_method_options" : {
"card" : {
"commodity_code" : "123123"
}
}
}
]
}
}
...
}
PaymentIntent erfassen Um mehr als den aktuell autorisierten Betrag für einen PaymentIntent zu erfassen, verwenden Sie Endpunkt erfassen und geben einen amount_to_capture bis zum maximum_amount_capturable an.
Übergeben Sie bei der Erfassung einen aktualisierten amount_ details Hash, der mit dem erfassten Betrag übereinstimmt.
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 der Antwort enthält das Feld amount_ details die Posten, die beim Erfassen angegeben wurden.
{
"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" : {
"object" : "list" ,
"url" : "/v1/payment_intents/pi_xxxxxxxx/amount_details_line_items" ,
"has_more" : false ,
"data" : [
{
"_id" : "li_567" ,
"product_code" : "SKU001" ,
"product_name" : "Product 001" ,
"unit_cost" : 2000 ,
"quantity" : 1 ,
"unit_of_measure" : "feet" ,
"payment_method_options" : {
"card" : {
"commodity_code" : "123123"
}
}
} ,
{
"_id" : "li_678" ,
"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"
...
}
Inkrementelle Autorisierung Sie können Zahlungsposten während der inkrementellen Autorisierung verwenden, um zusätzliche Beträge auf einem PaymentIntent nach der ursprünglichen Autorisierung zu autorisieren.
Einen nicht erfassten PaymentIntent erstellen und bestätigen Hinweis The API response doesn’t include line items by default. To return line items, expand amount_ details. line_ items.
Geben Sie bei der Erstellung des PaymentIntent die capture_ method als manual an und verwenden Sie den Parameter if_ available, um eine inkrementelle Autorisierung für diese Zahlung anzufordern. Das erstellte PaymentIntent ermöglicht eine inkrementelle Autorisierung, wenn die Zahlungsmethode dies unterstützt.
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_incremental_authorization]" = 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 der Antwort enthält das Feld amount_ details die in PaymentIntent angegebenen Einzelposten.
{
"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" : {
"object" : "list" ,
"url" : "/v1/payment_intents/pi_xxxxxxxx/amount_details_line_items" ,
"has_more" : false ,
"data" : [
{
"_id" : "li_789" ,
"product_code" : "SKU001" ,
"product_name" : "Product 001" ,
"unit_cost" : 2000 ,
"quantity" : 1 ,
"unit_of_measure" : "feet" ,
"payment_method_options" : {
"card" : {
"commodity_code" : "123123"
}
}
} ,
{
"_id" : "li_890" ,
"product_code" : "SKU002" ,
"product_name" : "Product 002" ,
"unit_cost" : 2000 ,
"quantity" : 1 ,
"unit_of_measure" : "gallons" ,
"payment_method_options" : {
"card" : {
"commodity_code" : "123123"
}
}
}
]
}
}
...
}
Autorisierung erhöhen Um zusätzliche Beträge für ein PaymentIntent über den ursprünglich autorisierten Betrag hinaus zu autorisieren, verwenden Sie den increment_authorization -Endpoint und geben Sie einen Betrag bis zur maximal zulässigen inkrementellen Autorisierung der Zahlungsmethode an.
Übergeben Sie einen aktualisierten amount_ details-Hash, der dem gesamten autorisierten Betrag nach der Erhöhung entspricht.
curl https://api.stripe.com/v1/payment_intents/pi_xxxxxxxx/increment_authorization \
-u "sk_test_BQokikJOvBiI2HlWgH4olfQ2
:" \
-d amount = 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 der Antwort enthält das Feld amount_ details die Posten, die während der inkrementellen Autorisierung angegeben wurden und der autorisierte Gesamtbetrag des PaymentIntent wird aktualisiert.
{
"amount" : 5000 ,
"amount_capturable" : 5000 ,
"amount_received" : 0 ,
"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" : {
"object" : "list" ,
"url" : "/v1/payment_intents/pi_xxxxxxxx/amount_details_line_items" ,
"has_more" : false ,
"data" : [
{
"_id" : "li_901" ,
"product_code" : "SKU001" ,
"product_name" : "Product 001" ,
"unit_cost" : 2000 ,
"quantity" : 1 ,
"unit_of_measure" : "feet" ,
"payment_method_options" : {
"card" : {
"commodity_code" : "123123"
}
}
} ,
{
"_id" : "li_012" ,
"product_code" : "SKU002" ,
"product_name" : "Product 002" ,
"unit_cost" : 2000 ,
"quantity" : 1 ,
"unit_of_measure" : "gallons" ,
"payment_method_options" : {
"card" : {
"commodity_code" : "123123"
}
}
}
]
}
} ,
"status" : "requires_capture"
...
}