Cashier-stripe: Incorrect JavaScript property for setupIntent.paymentMethod

Created on 7 Aug 2019  路  12Comments  路  Source: laravel/cashier-stripe

  • Cashier Version: 10.0.0-beta-2
  • Laravel Version: 5.8.31
  • PHP Version: 7.3.6
  • Database Driver & Version: MySQL 8.0.16

Description:

The JavaScript example in the docs makes reference to setupIntent.paymentMethod.
This is incorrect, the correct property is payment_method

needs more info

Most helpful comment

Hey all. Just pushed a commit which should fix the typos. Please note that there's indeed a difference between stripe.createPaymentMethod & stripe.handleCardSetup. Thanks for testing!

All 12 comments

Heya, thanks for testing. Which example is that exactly? Can you point to the line in the docs?

Apologies.

Line 199 in billing.md (within laravel/docs repo)

setupIntent.paymentMethod as per billing.md is the correct way for getting paymentMethod.

@dasjet forgive me, but I don't think so. If you console.log(setupIntent), then you get this:

Screenshot 2019-08-08 at 11 42 15 am

@alphametric is right on this one. I'm currently working with the API myself, the object property is payment_method. I was confused myself at the beginning, had to print the entire object to find out that the actual property is called differently.

It's just a typo in the docs, easy enough for @driesvints to correct :)

On the same note, another typo (which I presume was wrongly imported from the Stripe's documentation) is the following:

image

Well spotted @codefir, looks like another type.

@alphametric My bad. I was mixed up with Line 248 in billing.md. I was using stripe.createPaymentMethod not stripe.handleCardSetup.

Oh, is there a difference in the Stripe API between the two approaches? Does one return paymentMethod and another payment_method?

Yes we can get the paymentMethod.id and use it for single charge.

Hey all. Just pushed a commit which should fix the typos. Please note that there's indeed a difference between stripe.createPaymentMethod & stripe.handleCardSetup. Thanks for testing!

Was this page helpful?
0 / 5 - 0 ratings