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

Typing issue in CustomerSourceCreateParams.source #974

Closed
svallory opened this issue Aug 6, 2020 · 5 comments
Closed

Typing issue in CustomerSourceCreateParams.source #974

svallory opened this issue Aug 6, 2020 · 5 comments
Assignees

Comments

@svallory
Copy link

svallory commented Aug 6, 2020

Stripe Node library version: 8.83.0

The source property of CustomerSourcesCreateParams, used in Stripe.customers.createSource() has type string and does not support an object, as specified in the API here

@remi-stripe remi-stripe self-assigned this Aug 6, 2020
@remi-stripe
Copy link
Contributor

@svallory Thanks for reaching out! This one is by design. Passing raw card details is something that is actively discouraged since it puts you under a higher scope for PCI compliance. Our types actively hide this feature to ensure developers don't mistakenly use this and put their business at risk. Our API also blocks this by default and requires a custom setting to get access.

I hope this helps clarify the decision!

@svallory
Copy link
Author

svallory commented Aug 7, 2020

Thanks @remi-stripe. I disagree with the approach, but it does clarify the issue. We use VGS proxy to remain PCI compliant. May I suggest adding a comment to the code explaining this? It would save a lot of time.

Also, the documentation implies sending the card data in the source property, but the test code in the package has the card properties in the object root.

@remi-stripe
Copy link
Contributor

@svallory Thanks for catching the failing tests, I'll get them fixed!

@rubiin
Copy link

rubiin commented Jul 26, 2022

@remi-stripe any update on this. Using the code mentioned on the customer.spec also gives type issues

  const params = {
          source: {
            object: 'card',
            number: '123456',
            exp_month: '12',
            exp_year: '30',
          },
        };
        stripe.customers.createSource('cus_123', params);

@remi-stripe
Copy link
Contributor

Type issues are expected, we strongly discourage sending raw card details server-side as it drastically increases your PCI compliance burden. It works, it's just not in types.

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

No branches or pull requests

3 participants