Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API version 2022-08-01 removed Checkout Session Create's line_items[amount] but still available in Typescript API? #1575

Closed
davidbielik opened this issue Oct 8, 2022 · 1 comment · Fixed by #1582 · 4 remaining pull requests
Closed

API version 2022-08-01 removed Checkout Session Create's line_items[amount] but still available in Typescript API? #1575

davidbielik opened this issue Oct 8, 2022 · 1 comment · Fixed by #1582 · 4 remaining pull requests
Labels

Comments

@davidbielik
Copy link
Contributor

davidbielik commented Oct 8, 2022

Describe the bug

Hi, I'm upgrading from API 2020-08-27 to 2022-08-01, and have upgraded my stripe-node to the latest version (v10.13.0) specifying apiVersion: '2022-08-01'.

The Upgrade Guide mentions:

The following parameters have been removed from create Checkout Session: line_items[amount],...

Yet in the Stripe Node Library, those types were not removed from Stripe.Checkout.SessionCreateParams:

/**
* [Deprecated] The amount to be collected per unit of the line item. If specified, must also pass `currency` and `name`.
*/
amount?: number;

To Reproduce

Upgrade API to 2022-08-01 and in typescript use:

import Stripe from 'stripe';
const stripe = new Stripe(key, {
  apiVersion: '2022-08-01'
});
const params: Stripe.Checkout.SessionCreateParams = {
    cancel_url: "",
    success_url: "",
    billing_address_collection: 'auto', //'required',
    customer: "",
    locale: 'auto',
    mode: 'payment',
    line_items: [
      {
        amount: 100,
        currency: 'USD',
        name: "",
        quantity: 1,
        description: "",
        images: ""
      },
    ],
}

Expected behavior

If the 2022-08-01 API removed Create Checkout Session's line_items fields, then it should have been removed from the typescript definitions?

Code snippets

The API returns:

You cannot use line_items.amount, line_items.currency, line_items.name, line_items.description, or line_items.images in this API version. Please use line_items.price or line_items.price_data. Please see https://stripe.com/docs/payments/checkout/migrating-prices for more information.

OS

macOS

Node version

Node v16.14.2

Library version

stripe-node v10.13.0

API version

2022-08-01

Additional context

@davidbielik davidbielik added the bug label Oct 8, 2022
@richardm-stripe
Copy link
Contributor

Hello @davidbielik, thanks for reporting this.

I've investigated and this does appear to be an error in the Typescript bindings (and other SDKs too, such as stripe-java), not in the upgrade guide:

if you attempt to actually send these parameters on the latest API version, you get a 400

{
  "error": {
    "message": "You cannot use `line_items.amount`, `line_items.currency`, `line_items.name`, `line_items.description`, or `line_items.images` in this API version. Please use `line_items.price` or `line_items.price_data`. Please see https://stripe.com/docs/payments/checkout/migrating-prices for more information.",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_Izj3zTug4QVnyU?t=1665450540",
    "type": "invalid_request_error"
  }
}

so it seems the types should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment