#swathi
1 messages · Page 1 of 1 (latest)
Hello there
hie
Are you just trying to collect card details via Google Pay?
yes intially am saving card details and then after successful authentication we are collecting amount
Gotcha, and are you using a SetupIntent to do so?
yes
Gotcha, I believe that with a SetupIntent then the amount should show as 0 automatically?
Are you not seeing that?
That said, something else you can use is setting pending on your PaymentItem object: https://stripe.com/docs/js/appendix/payment_item_object#payment_item_object-pending
This will remove the amount at times which can be helpful to avoid confusion for your customers
Otherwise, I don't recall if you can set amount to 0, but I believe you can. You should be able to test it out
before creating setupIntent for googlepay/applepay we will create a paymentRequest right?
In paymentRequest: we have total object in that we have amount parameter, here can we pass 0 amount?
Yes
thanks
one more issue
getting following error while passing value to the paymentRequest
Invalid value for paymentRequest(): total.amount should be a positive amount in the currency's subunit. You specified: 599.
Hmm can you log out revisedPrice just before you set stripe.paymentRequest?
And currency.toLowerCase()?
I think our API doesn't care about case sensitivity here btw
revisedPrice--- 5.99
StripeAppleGoogleForm.js?bf7e:100 currency--- usd
Yep so you don't want the ., try just 599
Did you hardcode it?
then it is working fine
Okay so yeah it is something about your revisedPrice variable initialization that is causing the issue
How do you initialize that?
am doing price(5.99) multiplied by 100 and passing it to revisedprice(599)
Can you show me the code?
It sounds like when you do that multiplication it seems that it is setting the decimal
Okay so I see you have a commented out log there
If you comment that in, you see 599?
yes
Hmmm very strange
Let's try doing something like let testAmount = dataHelper.calculateStripeAmount(revisedPrice, currency) up above the paymentRequest and then log out testAmount
issue resolved thanks
Out of curiosity, what was it?