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

Incorrect typings custom_fields when #794

Closed
leeuwd opened this issue Feb 5, 2020 · 3 comments · Fixed by #802
Closed

Incorrect typings custom_fields when #794

leeuwd opened this issue Feb 5, 2020 · 3 comments · Fixed by #802
Assignees

Comments

@leeuwd
Copy link

leeuwd commented Feb 5, 2020

When specifying custom_fields in the creation of a customer, the InvoiceSettings (line 282 in types/2019-12-03/Customers.d.ts) typings are incorrect.

When creating a customer adhering to these incorrect typings, the Stripe dashboard logs show:

image

The code used to POST (and adhering to current typings) was:

const customer: Stripe.Customer = await this.client.customers.create({
      /* eslint-disable @typescript-eslint/camelcase */
      name: data.name,
      email: data.email,
      address: data.address,
      tax_id_data: [
        {
          type: 'eu_vat',
          value: data.vatId,
        },
      ],
      invoice_settings: {
        custom_fields: {
          name: 'KVK-nummer',
          value: data.cocNumber,
        },
      },
      /* eslint-enable @typescript-eslint/camelcase */
    })

It seems custom_fields should be InvoiceSettings.CustomFields[] | null, not InvoiceSettings.CustomFields | null.

Library version: [email protected].

@leeuwd
Copy link
Author

leeuwd commented Feb 5, 2020

Just confirmed it's working when sending as InvoiceSettings.CustomFields[] and suppressing Typescript warnings with // @ts-ignore.

@remi-stripe
Copy link
Contributor

@leeuwd Thanks for the report! There's a PR opened to fix this here: #766
We can't merge it just yet as the types are automatically generated internally and we first need to fix our tooling to surface the right types but we're working on it

@richardm-stripe
Copy link
Contributor

This is fixed as of #802. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants