richnologies / ngx-stripe

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

Add Payment Intent Options #64

Closed dottodot closed 5 years ago

dottodot commented 5 years ago

What are you adding/fixing?

This PR adds support for the new PaymentIntents as per this issue https://github.com/richnologies/ngx-stripe/issues/62 although doesn't include retrievePaymentIntent as not sure that's something you do client side.

Have you added tests for your changes?

No Will this need documentation changes?

Yes docs will need updating on how to use Does this introduce a breaking change?

No Other information

ashe540 commented 5 years ago

Won't this require support for createPaymentMethod to create the PaymentIntent on the server?

dottodot commented 5 years ago

I was in the beta testing for Payments intents which is when I wrote this and it looks like they have made some changes. My changes will support the following method of integration. https://stripe.com/docs/payments/payment-intents/quickstart#automatic-confirmation-flow

The createPaymentMethod relates to this method of integration https://stripe.com/docs/payments/payment-intents/quickstart#manual-confirmation-flow

nickdnk commented 5 years ago

@dottodot Could you please include the createPaymentMethod method as well? While it's for the manual flow it's closely related to PaymentIntents.

dottodot commented 5 years ago

I've added it but it has not been tested as I'm a bit short on time at the moment.

nickdnk commented 5 years ago

Cool. Thanks!

I noticed something else though: handleCardPayment(clientSecret, data) is missing.

Currently only handleCardPayment(clientSecret, elements, data) is there (as far as I can see?). We also need the one without elements when using automatic confirmations with an existing payment method (a customer with a saved credit card), otherwise you wouldn't be able to complete the flow. Here is the info for it: https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment-no-element

dottodot commented 5 years ago

@nickdnk Ok try now

nickdnk commented 5 years ago

It looks good to me now. Now we just need someone to merge it in :)

richnologies commented 5 years ago

ngx-stripe@7.3.0 include this feature. Please check it work as spected