#tmbax-paymentrequest-issue

1 messages ยท Page 1 of 1 (latest)

severe pondBOT
cobalt kindle
#

Hello ๐Ÿ‘‹
How can I help?

uncut dragon
#

hi

#

Hi all
We have developed a website with ReactJS
In this project, we have used the following libraries for payment
@stripe/stripe-js@^2.1.7
@stripe/react-stripe-js@^2.3.1

The implementation is based on the link below

https://stripe.com/docs/stripe-js/elements/payment-request-button#verifying-your-domain-with-apple-pay

Google payment works fine
Apple Pay only works in private browser mode ๐Ÿ˜• ๐Ÿ‘€

After checking, we have noticed that in Safari, the return values are null in the paymentRequest.canMakePayment() method.
Payment Request Button
Collect payment and address information from customers who use Apple Pay, Google Pay, or Link.
Payment Request Button

#

Apple pay does not work in normal browser mode
apple pay only work in private mode of safari

#

and you can see this images

cobalt kindle
#

Is this page live? If so, can you share a link?

Apple Pay by default shows up in private mode. If it's not showing up in normal window then it means

1/ either the domain isn't correctly configured
Or
2/ You don't have the wallet configured correctly on your machine

uncut dragon
#

page is live

cobalt kindle
#

Can you share the link?

uncut dragon
cobalt kindle
uncut dragon
#

we dont use button element

#

After checking, we have noticed that in Safari, the return values are null in the paymentRequest.canMakePayment() method.

cobalt kindle
#

I'm asking you to visit the page above and see if you can see apple pay button on stripe docs page

#

What sort of element are you using for Apple Pay?

uncut dragon
#

I use custom api not Apple pay button element

cobalt kindle
#

What custom API?

uncut dragon
#

this function: paymentRequest.canMakePayment() always return null

#

in safari browser

cobalt kindle
#

I get that part. Can you clarify what flow/guide/element you're integrating in your app to accept apple pay?

Stripe PaymentElement, PaymentRequestButton, Express Checkout Element or Stripe hosted Checkout Page are the surfaces where we support Apple Pay.

Looking at the site you've built, I don't see any of those integration path being used

#

Are you following any guides?

uncut dragon
#

I'd better give you the code

cobalt kindle
uncut dragon
#

hanzo

#

are you here ?

cobalt kindle
#

Please be patient, working with multiple folks

uncut dragon
#

ok firend\

cobalt kindle
#

Can you clarify what you meant by

I use custom api not Apple pay button element

uncut dragon
#

My problem is not related to PaymentRequestButtonElement

#

The problem is that the method below returns a null value

#

paymentRequest.canMakePayment()

cobalt kindle
#

As i mentioned earlier, that method can return null for various reasons. In order for me to dive deeper, i need to understand what you're integrating.

You've provided mixed details so far with no clear direction on what stripe doc you're following for this

#

I can't help you if I don't understand what you're trying to integrate

uncut dragon
#

paymentRequest.canMakePayment()
.then((result) => {
if (result) {
const {
applePay,
googlePay,
} = result;
if(applePay){
paymentRequest.show();
}
}
});

bro see this code. is it true ?

cobalt kindle
#

Code is syntactically correct but not sure in what context you're trying to implement it so can't confirm if its accurate for your integration

uncut dragon
#

Ok, let me explain the scenario
A person enters the website
Adds products to your cart
Click on the basket and enter a page
Enter information on this page
Then determine the type of payment
In the next step, by clicking on an order registration button, the payment operation begins
If the payment type is Apple Pay. Check the wallet status and then the Apple Pay payment window will open.
Finally, upon receiving the result of the operation (in case of successful payment), we register the order

The point here is that we have not used the PaymentRequestButtonElement component that is available in the library, and the paymentRequest.show() method can be called instead.

cobalt kindle
#

Check the wallet status and then the Apple Pay payment window will open.
How exactly would the window open?

The point here is that we have not used the PaymentRequestButtonElement component that is available in the library, and the paymentRequest.show() method can be called instead.
you can't call show(...) directly.
You need to use some sort of a button

uncut dragon
#

oh

#

but show method work with google pay

#

it work with google pay

#

ok

#

I have concluded from your words that I should use the following commeonnet

#

PaymentRequestButtonElement

cobalt kindle
#

Yes, let me just double check something

uncut dragon
#

But pay attention
Even if we use this component, the method below will still return null value

#

paymentRequest.canMakePayment()

cobalt kindle
#

Yeah the .show(...) function would need to be called for an event handler (like click or submit)

You can't just call .show() right after canMakePayment() is called.

But pay attention
Even if we use this component, the method below will still return null value
paymentRequest.canMakePayment()
That's what I am double checking right now

#

give me a sec

uncut dragon
#

ok bro

cobalt kindle
#

okay so here's what I see on your site

#

when going through a test checkout

#

the error message is for what I mentioned above where you need to use a gesture handler to call show(..)

meaning canMakePayment(...) returns true on my machine

#

Hence, apple pay isn't configured correctly on your machine.

#

Do you see the same on your end?

uncut dragon
#

We need to see the status of the button on this page to ensure that Apple Pay is configured correctly?

#

ok w8

cobalt kindle
#

Yes, that's why I asked you to check this in my intial messages. It helps confirm if you have the Apple Pay wallet configured correctly

uncut dragon
#

I checked this page and I could see the Apple Pay button, which means that the device settings are done correctly

cobalt kindle
#

Are you seeing apple pay button under the title? Like the very first button
Are you able to click on it? Can you share a screenshot?

uncut dragon
#

yes

#

i sent top you images

cobalt kindle
uncut dragon
#

w8

severe pondBOT
uncut dragon
hushed olive
#

Hi ๐Ÿ‘‹

I'm stepping in as @cobalt kindle needs to go. I see that your Safari browser is correctly configured for Apple Pay so we can rule that out

uncut dragon
#

hi friend

#

ok

#

go next step

hushed olive
#

So what exactly are you trying to do? There's a lot of context in this thread and I won't be able to read it all

uncut dragon
#

ok i say

#

On our website, payment through Google Pay works properly, but Apple Pay only works in the private mode of the browser.
After checking, we found that the following method returns null value

#

canMakePayment

#

As a result, it is not possible to show the Apple Pay button to the user

hushed olive
#

What Stripe products are you using? Payment Request Button? Express Checkout Element?

uncut dragon
#

I dont know but it is my code

#

paymentRequest.canMakePayment()
.then((result) => {
if (result) {
const {
applePay,
googlePay,
} = result;
if(applePay){
paymentRequest.show();
}
}
});

hushed olive
#

That doesn't tell me a lot

uncut dragon
#

you need a payment intent ?

hushed olive
#

How are you creating the payment request?

uncut dragon
#

server side

#

are you need content of a payment intent ?

hushed olive
#

Sure but just the ID will work

uncut dragon
#

w8

hushed olive
uncut dragon
#

payment intent

#

{
"clientSecret": "pi_3NzLzwH12VUlMrqL0SOb9kLx_secret_AHlVn43MatgRfBgKHAj9SIWvg",
"paymentRequest": {
"country": "CA",
"currency": "cad",
"total": {
"label": "Order Total Amount",
"amount": 1487
},
"requestPayerName": true,
"requestPayerEmail": true
}
}

hushed olive
uncut dragon
#

yes it crated client side

#

w8

uncut dragon
#

let pr = {...data.paymentRequest};
pr.currency = pr.currency.toLowerCase();

                                const paymentRequest =
                                    stripe.paymentRequest(pr);
hushed olive
#

Okay, what is in the data.paymentRequest?

uncut dragon
#

{
"country": "CA",
"currency": "cad",
"total": {
"label": "Order Total Amount",
"amount": 1487
},
"requestPayerName": true,
"requestPayerEmail": true
}

hushed olive
#

Okay, all of that looks correct. But when you call canMakePayment you get back a null?

uncut dragon
#

yes

hushed olive
#

And what is the domain you are using?

uncut dragon
hushed olive
#

Okay I can see that domain registered to your account

uncut dragon
#

yes

#

check website with safari

hushed olive
#

I'm having trouble adding toppings to a pizza. Do you have a more simplified place I can test without going through all this set up?

severe pondBOT
uncut dragon
#

yes

prime swift
#

@uncut dragon I'm taking over and it's a really long thread with a ton of back and forth. Let me know once you have a clear simple repro that doesn't require any manual steps or login and a clear summary of the issue

#

tmbax-paymentrequest-issue

uncut dragon
#

So far, 2-3 people have changed and I'm really tired of explaining