Updates a Checkout Session object.
Related guide: Dynamically update Checkout
Parameters
- 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
embedded
orcustom
sessions.- 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 (e.g., 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 (e.g., 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.
- collected_information.
shipping_details. namestringRequired The name of customer
- 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.
- 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.
day
The delivery estimate is in days.
hour
The delivery estimate is in hours.
month
The delivery estimate is in months.
week
The 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.
day
The delivery estimate is in days.
hour
The delivery estimate is in hours.
month
The delivery estimate is in months.
week
The 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 valuesexclusive
inclusive
unspecified
- 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 valuesexclusive
inclusive
unspecified
- 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"}