#aaparth-payment-button
1 messages · Page 1 of 1 (latest)
Hi! What do you mean by payment method id?
You should create a Payment Intent on the backend, and it will automatically create a Payment Method for you.
Did you follow our guide on the payment request button here? https://stripe.com/docs/stripe-js/elements/payment-request-button
Have you tried Google Pay or Apple Pay in india? Have you seen any error message?
request timeout in Google Pay
Can you share a PaymentIntent ID if you have one (pi_xxx)? And what part of your code is generating the timeout?
let me check
i got error when i pay using testing card in google pay. Error - Your request failed. Use a different payment method, or contact us. Learn more [OR-CCSEH-21]
Can you share your account ID? You can find it at the top right of this page: https://dashboard.stripe.com/settings/account
acct_1Eep6YCmxQwltEUM
Thanks! Give me a few minutes to look into this.
you probably are using the Indian version of Google Pay, which is different from the one in the rest of the world, we don't support it
you probably have the https://play.google.com/store/apps/details?id=com.google.android.apps.nbu.paisa.user version of Google Pay installed. Stripe doesn't work with that one, you need https://play.google.com/store/apps/details?id=com.google.android.apps.walletnfcrel .
@dense remnant
the account is from UK and we are developing the system.
@edgy basin ok, but are you in India and are using an phone with the Indian version of Google Pay?
@dense remnant
I have installed https://play.google.com/store/apps/details?id=com.google.android.apps.walletnfcrel
cool
still it does not works for me
so is this in livemode or test mode?
test mode
do you have a credit card in your Google Pay account?
what type of card is it? (like which brand)
MasterCard
is it a website you're building or a mobile Android app
website
link?
take out the alert()
like the alert(ev.paymentMethod.id);
remove it
it stops the rest of the code executing until the box is closed, and you can't see or close the box because the Google Pay popup is still open. So the code is frozen so processing the payment and calling the function to close the GPay popup never happens and eventually it times out.
use console.log to debug, it's 2022 😓
removed it
@dense remnant let me check
@dense remnant i have checked my code, clientSecret is defined in click of paymentmethod but where to get value of clientSecret ?
ok you are extremely lost then
the clientSecret comes from your backend server.
you create a PaymentIntent object on your server by calling our API, and then you send a field of that object (the secret) to the frontend and use it in that code.
you really need to start with https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements for example. (also your payment page makes no sense today because you_only_ support Google/Apple Pay, if the customer doesn't have those how would they pay you? you need to have a normal credit card form too)
@dense remnant
this is the testing page as of now to check for Apple & Google pay
ok!
@dense remnant is there any demo example available for this on Github or somewhere else ?
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements has links to a sample repo yes
because the documentation is little bit tricker to understand and we got lost in between
I highly suggest you use ^^ that guide (the PaymentElement), it supports cards and Google Pay directly, you don't have to build the PaymentRequestButton itself on its own
we have used this in another application where stripe handles this but in this the client requires it to be custom on the website so we have to use the Payment buttons
to be clear, I'm not talking about Checkout
okay then
but ok, if you've used this stuff before than you know what PaymentIntents are right? and how you need to create one on the backend and return the client_secret to the frontend
it's the same here
the docs for the PaymentRequestButton assume you're familiar with that already
it's also step 4 in the guide : https://stripe.com/docs/stripe-js/elements/payment-request-button?html-or-react=html#html-js-create-payment but I guess you missed that part
yeah @dense remnant and btw thanks with this, now will check this out and if we stuck somewhere then will ping again over here
can you not archieve this thread for now so we can message you again over here only and don't have to start again
sorry but no, this is not a 1-on-1 support channel, it's for one-off questions to unblock you. We work different timezones and shifts so you can't always talk to me
okay
@dense remnant
we got this to work and the payment has been succeed in dashboard but just one more question. How will be know when the payment is successful
you get a payment_intent.succeeded webhook
okay and anything else on the View page ?
the Promise from calling confirmCardPayment resolves with success.
okay thanks, was looking for Promise
your code has a line already : // The payment has succeeded.
that's where the execution goes when the payment has succeeed.
note you can not rely on that code to execute, you must use webhooks to actually process the user's order and update your database since otherwise you will have cases where the customer pays but the frontend code doesn't execute and you fail to update your records
okay
@dense remnant
over here we have a code which checks for 3D Secure cards, so when that is encountered what is the next step like we do for in mobile sdk. HandleNextAction
what do you mean by 'over here'?
just a moment
I mean what if confirmResult.paymentIntent.status === "requires_action"
then the code will close the payment sheet(ev.complete('success')) and then presents the 3D Secure popup(by calling stripe.confirmCardPayment again).
okay so then we confirm that
@dense remnant
how can we subscribe to price with this, do we need to create the payment intent with price_id or something else ?
you mean you want to start a subscription(recurring payments)?
yes
before I answer — can you use Checkout or is that not possible?
not possible as we need to do in this only
ok, then be aware you have a lot work ahead of you
okay no worries
actually we have subscriptions running from our mobile apps so webhook and everything else is tested and working fine
you want this guide :
https://stripe.com/docs/billing/subscriptions/build-subscription?ui=elements
in Step 6 https://stripe.com/docs/billing/subscriptions/build-subscription?ui=elements#collect-payment it deals with handling the client_secret from the Invoice of a Subscription to use with Elements. You can use that client_secret with the code for the PaymentRequestButton if needed, it works the same as if you created the Paymentintent directly.
i.e you create a Subscription -> get the Invoice->PaymentIntent->clientSecret and use that on the frontend.