Updates a Checkout Session object.
Related guide: Dynamically update Checkout
Parameters
- line_
itemsarray of objects A list of items the customer is purchasing.
When updating line items, you must retransmit the entire array of line items.
To retain an existing line item, specify its
id.To update an existing line item, specify its
idalong with the new values of the fields to update.To add a new line item, specify one of
priceorprice_anddata quantity.To remove an existing line item, omit the line item’s ID from the retransmitted array.
To reorder a line item, specify it at the desired position in the retransmitted array.
- line_items.
adjustable_ quantityobject When set, provides configuration for this item’s quantity to be adjusted by the customer during Checkout.
- line_items.
adjustable_quantity. enabledbooleanRequired Set to true if the quantity can be adjusted to any positive integer. Setting to false will remove any previously specified constraints on quantity.
- line_items.
adjustable_quantity. maximuminteger The maximum quantity the customer can purchase for the Checkout Session. By default this value is 99. You can specify a value up to 999999.
- line_items.
adjustable_quantity. minimuminteger The minimum quantity the customer must purchase for the Checkout Session. By default this value is 0.
- line_items.
idstring ID of an existing line item.
- line_items.
metadataobject Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata. - line_items.
pricestringRequired conditionally The ID of the Price. One of
priceorprice_is required when creating a new line item.data - line_items.
price_ dataobjectRequired conditionally Data used to generate a new Price object inline. One of
priceorprice_is required when creating a new line item.data - line_items.
price_data. currencyenumRequired Three-letter ISO currency code, in lowercase. Must be a supported currency.
- line_items.
price_data. productstringRequired conditionally - line_items.
price_data. product_ dataobjectRequired conditionally Data used to generate a new Product object inline. One of
productorproduct_is required.data - line_items.
price_data. product_data. namestringRequired The product’s name, meant to be displayable to the customer.
- line_items.
price_data. product_data. descriptionstring The product’s description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
- line_items.
price_data. product_data. imagesarray of strings A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
- line_items.
price_data. product_data. metadataobject Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata. - line_items.
price_data. product_data. tax_ codestringRecommended if calculating taxes A tax code ID.
- line_items.
price_data. product_data. unit_ labelstring A label that represents units of this product. When set, this will be included in customers’ receipts, invoices, Checkout, and the customer portal.
The maximum length is 12 characters.
- line_items.
price_data. recurringobject The recurring components of a price such as
intervalandinterval_.count - line_items.
price_data. recurring. intervalenumRequired Specifies billing frequency. Either
day,week,monthoryear.Possible enum valuesdaymonthweekyear - line_items.
price_data. recurring. interval_ countinteger The number of intervals between subscription billings. For example,
interval=monthandinterval_bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).count=3
- line_items.
price_data. tax_ behaviorenumRecommended if calculating taxes Only required if a default tax behavior was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of
inclusive,exclusive, orunspecified. Once specified as eitherinclusiveorexclusive, it cannot be changed.Possible enum valuesexclusiveinclusiveunspecified - line_items.
price_data. unit_ amountintegerRequired conditionally A non-negative integer in cents representing how much to charge. One of
unit_oramount unit_is required.amount_ decimal - line_items.
price_data. unit_ amount_ decimalstringRequired conditionally Same as
unit_, but accepts a decimal value in cents with at most 12 decimal places. Only one ofamount unit_andamount unit_can be set.amount_ decimal
- line_items.
quantityintegerRequired conditionally The quantity of the line item being purchased. Quantity should not be defined when
recurring..usage_ type=metered - line_items.
tax_ ratesarray of strings The tax rates which apply to this line item.
- metadataobject
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata.
More parameters
- collected_
informationobject Information about the customer collected within the Checkout Session. Can only be set when updating
embeddedorcustomsessions.- collected_information.
shipping_ detailsobject The shipping details to apply to this Session.
- collected_information.
shipping_details. addressobjectRequired The address of the customer
- collected_information.
shipping_details. address. countrystringRequired Two-letter country code (ISO 3166-1 alpha-2).
- collected_information.
shipping_details. address. line1stringRequired Address line 1, such as the street, PO Box, or company name.
- collected_information.
shipping_details. address. citystring City, district, suburb, town, or village.
- collected_information.
shipping_details. address. line2string Address line 2, such as the apartment, suite, unit, or building.
- collected_information.
shipping_details. address. postal_ codestring ZIP or postal code.
- collected_information.
shipping_details. address. statestring State, county, province, or region (ISO 3166-2).
- collected_information.
shipping_details. namestringRequired The name of customer
The maximum length is 255 characters.
- shipping_
optionsarray of objects The shipping rate options to apply to this Session. Up to a maximum of 5.
- shipping_options.
shipping_ ratestringRequired unless shipping_rate_data is provided The ID of the Shipping Rate to use for this shipping option.
- shipping_options.
shipping_ rate_ dataobjectRequired unless shipping_rate is provided Parameters to be passed to Shipping Rate creation for this shipping option.
- shipping_options.
shipping_rate_data. display_ namestringRequired The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
The maximum length is 100 characters.
- shipping_options.
shipping_rate_data. delivery_ estimateobject The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
- shipping_options.
shipping_rate_data. delivery_estimate. maximumobject The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
- shipping_options.
shipping_rate_data. delivery_estimate. maximum. unitenumRequired A unit of time.
Possible enum valuesbusiness_day The delivery estimate is in business days.
dayThe delivery estimate is in days.
hourThe delivery estimate is in hours.
monthThe delivery estimate is in months.
weekThe delivery estimate is in weeks.
- shipping_options.
shipping_rate_data. delivery_estimate. maximum. valueintegerRequired Must be greater than 0.
- shipping_options.
shipping_rate_data. delivery_estimate. minimumobject The lower bound of the estimated range. If empty, represents no lower bound.
- shipping_options.
shipping_rate_data. delivery_estimate. minimum. unitenumRequired A unit of time.
Possible enum valuesbusiness_day The delivery estimate is in business days.
dayThe delivery estimate is in days.
hourThe delivery estimate is in hours.
monthThe delivery estimate is in months.
weekThe delivery estimate is in weeks.
- shipping_options.
shipping_rate_data. delivery_estimate. minimum. valueintegerRequired Must be greater than 0.
- shipping_options.
shipping_rate_data. fixed_ amountobject Describes a fixed amount to charge for shipping. Must be present if type is
fixed_.amount - shipping_options.
shipping_rate_data. fixed_amount. amountintegerRequired A non-negative integer in cents representing how much to charge.
- shipping_options.
shipping_rate_data. fixed_amount. currencyenumRequired Three-letter ISO currency code, in lowercase. Must be a supported currency.
- shipping_options.
shipping_rate_data. fixed_amount. currency_ optionsobject Shipping rates defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency.
- shipping_options.
shipping_rate_data. fixed_amount. currency_options. <currency>. amountintegerRequired A non-negative integer in cents representing how much to charge.
- shipping_options.
shipping_rate_data. fixed_amount. currency_options. <currency>. tax_ behaviorenumRecommended if calculating taxes Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of
inclusive,exclusive, orunspecified.Possible enum valuesexclusiveinclusiveunspecified
- shipping_options.
shipping_rate_data. metadataobject Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata. - shipping_options.
shipping_rate_data. tax_ behaviorenumRecommended if calculating taxes Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of
inclusive,exclusive, orunspecified.Possible enum valuesexclusiveinclusiveunspecified - shipping_options.
shipping_rate_data. tax_ codestringRecommended if calculating taxes A tax code ID. The Shipping tax code is
txcd_.92010001 - shipping_options.
shipping_rate_data. typeenumRequired The type of calculation to use on the shipping rate.
Possible enum valuesfixed_amount The shipping rate is a fixed amount.
Returns
Returns a Checkout Session object.
{ "id": "cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 2198, "amount_total": 2198, "automatic_tax": { "enabled": false, "liability": null, "status": null }, "billing_address_collection": null, "cancel_url": null, "client_reference_id": null, "consent": null, "consent_collection": null, "created": 1679600215, "currency": "usd", "custom_fields": [], "custom_text": { "shipping_address": null, "submit": null }, "customer": null, "customer_creation": "if_required", "customer_details": null, "customer_email": null, "expires_at": 1679686615, "invoice": null, "invoice_creation": { "enabled": false, "invoice_data": { "account_tax_ids": null, "custom_fields": null, "description": null, "footer": null, "issuer": null, "metadata": {}, "rendering_options": null } }, "livemode": false, "locale": null, "metadata": { "order_id": "6735" }, "mode": "payment", "payment_intent": null, "payment_link": null, "payment_method_collection": "always", "payment_method_options": {}, "payment_method_types": [ "card" ], "payment_status": "unpaid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "open", "submit_type": null, "subscription": null, "success_url": "https://example.com/success", "total_details": { "amount_discount": 0, "amount_shipping": 0, "amount_tax": 0 }, "url": "https://checkout.stripe.com/c/pay/cs_test_a11YYufWQzNY63zpQ6QSNRQhkUpVph4WRmzW0zWJO2znZKdVujZ0N0S22u#fidkdWxOYHwnPyd1blpxYHZxWjA0SDdPUW5JbmFMck1wMmx9N2BLZjFEfGRUNWhqTmJ%2FM2F8bUA2SDRySkFdUV81T1BSV0YxcWJcTUJcYW5rSzN3dzBLPUE0TzRKTTxzNFBjPWZEX1NKSkxpNTVjRjN8VHE0YicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"}