richnologies / ngx-stripe

Angular 6+ wrapper for StripeJS
MIT License
219 stars 77 forks source link

missing confirmCardPayment #80

Closed Hesesses closed 4 years ago

Hesesses commented 4 years ago

Hello,

I'm trying to follow this tutorial: https://stripe.com/docs/payments/accept-a-payment

on step 4: https://stripe.com/docs/payments/accept-a-payment#web-submit-payment

stripe.confirmCardPayment(clientSecret, {payment_method: {card: card}}

the confirmCardPayment method seems to be missing from this library? or am I doing something wrong?

xtremetom commented 4 years ago

Until this library is updated to the latest stripeJS you need to use handleCardPayment. There is very little documentation accompanying this library :(

yagobski commented 4 years ago

Please merge this commit https://github.com/nomadreservations/ngx-stripe/pull/31/commits/a0ad750381bc531d1456bf69989c21e7d122abec

richnologies commented 4 years ago

All the missing API have been added to the new version of the library. If you have any troubles using them, please let me know.

I will close this now due to inactivity. Sorry for this library to be abandon for such a long time. A new version of the library has been published that should address this issue. Please give it a try. If the problem persists, please fell free to open it again. The new commitment of the team is to answer in less than a week.

cschull commented 3 years ago

All the missing API have been added to the new version of the library. If you have any troubles using them, please let me know.

I will close this now due to inactivity. Sorry for this library to be abandon for such a long time. A new version of the library has been published that should address this issue. Please give it a try. If the problem persists, please fell free to open it again. The new commitment of the team is to answer in less than a week.

I'm still having typescript issues with this and getting the error Property 'confirmCardPayment' does not exist on type 'Stripe'. I have the same error for 'handleCardPayment'. Any suggestions?

richnologies commented 3 years ago

Hi @cschull, happy to help, can you tell me what version of ngx-stripe and @stripe/stripe-js are you using?

cschull commented 3 years ago

Hi @richnologies, I'm using version 8.168.0. I was reading some documentation online that mentioned that confirmCardPayment can only be used on the client side. Is this correct? and if it is, what is the purpose of that? I'm running into the same issue with confirmCardSetup

richnologies commented 3 years ago

Hi @cschull,

It is correct. You need code both in the server and the client. The reason is that in order to be PCI complaint without to much effort, we want to be able to charge credit cards without any card related data ever hitting our server.

As you can see in this example: https://stripe.com/docs/payments/integration-builder for the Stripe docs:

  1. We create a Payment Intent in the server and pass a reference to the cliente
  2. In the cliente we collect all the information related to the card (number, expiry date, cvc, cardholder name, etc)
  3. Then we use StripeJS (a client side specific library form Stripe) to confirm the card. This method is basically sending all the data we collect from the cards to the Stripe servers (which are PCI complaint), they perform some checks and try to charge the card and they notify you the outcome.
  4. If everything goes well you will be able to say the payment in your Stripe Dashboard

Card setup is similar, but if you want to save the card for future usages. Stripe will create a payment method object that you will be able to charge in the future, but again, without any sensitive related card info hitting your server.

Where ngx-stripe fits in all this? This library is just a thing wrapper for StripeJS, the client library from step 3, to be more easy to use with Angular.

Here is another link with some info: https://stripe.com/docs/payments/cards/overview And another one from the docs of ngx-stripe: https://docs.ngx-stripe.dev/examples#collect-payment-intent

Hope this helps you

R