#priyanka_unexpected

1 messages ยท Page 1 of 1 (latest)

gentle mapleBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1359516794871742515

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

wanton dune
#

Hi there ๐Ÿ‘‹ can you tell me more about the race condition you're seeing? What is your code trying to do? Are you folloiwng the guidance provided in our reference doc for the paymentRequest.update function?
https://docs.stripe.com/js/payment_request/update

shadow gazelle
#

paymentRequest.update({
total: {
label: priceData?.description,
amount: priceData.total_price,
},
})
Using priceData in the dependency for the above useeffect.
When there is a pricedata change, we are making api request to update price changes but when we click on gpay payment button element, the price is still old that is without the offer update.

#

The price is not updated immediately

wanton dune
#

Hm, that doesn't sound like a race condition if it's consistently behaving that way. Are you logging the contents of your variable to make sure it's getting updated before you call .update?

shadow gazelle
#

if there is already a payment Request we are updating it by calling update method or else creating new request

wanton dune
#

That's not the concern though right? The concern is that your priceData.total_price isn't getting updated before you're calling paymentRequest.update?

shadow gazelle
#

yes correct

#

i was explaing the functionality

wanton dune
#

So are you logging the contents of priceData.total_price before you call paymentRequest.update? Are you seeing that it's updated as expected before you make the call to us?

shadow gazelle
#

const orderTotal = useMemo(() => {
return priceData?.total_price / 100.0;
}, [priceData]); which is doing here:
<NumericFormat
value={orderTotal}, after this when we click on element it should have updated one:
paymentRequest.update({
total: {
label: priceData?.description,
amount: priceData.total_price,
},
})
[priceData, stripe, paymentRequest]);

wanton dune
#

How are you calling that? Is it inside of your click handler?

shadow gazelle
#

Its in the useEffect(() => {
if (!stripe || !priceData?.currency || !priceData?.total_price) return;

  try {
    if (!paymentRequest) {}

else{paymentRequest.update({
total: {
label: priceData?.description,
amount: priceData.total_price,
},
})
[priceData, stripe, paymentRequest]);
then in UI:
paymentRequest && (
<Stack
id="fast-pay"
component="div"
spacing={3}
>
<Typography
variant="h5"
color="primary"
sx={{ marginBottom: 1 }}
>
Express Checkout
</Typography>
<PaymentRequestButtonElement
options={{
paymentRequest,
}}
/>
<Divider>
<Typography
variant="body14"
color="text.secondary"
>
OR
</Typography>
</Divider>
</Stack>
)

wanton dune
#

Sorry, I'm not the most familiar with React, does that mean it's not part of your click handler for the Payment Request Button? Asking as we do recommend calling from within the click handler if you're trying to update the Payment Request object just before showing the payment request modal.

To update the PaymentRequest right before the payment interface is initiated, call paymentRequest.update in your click event handler.
https://docs.stripe.com/js/payment_request/update#:~:text=To update the PaymentRequest right before the payment interface is initiated%2C call paymentRequest.update in your click event handler

shadow gazelle
#

I tried with onClick it seems its not suggested for react, can you check with someone with React?

wanton dune
shadow gazelle
#

Warning: Failed prop type: Invalid prop children supplied to ForwardRef(Grid2), expected a ReactNode.

#

getting this error

gentle mapleBOT
wanton dune
#

Getting that error where? What code are you trying to run?

shadow gazelle
#

const updatePaymentRequestInstance = (event) => {
event.preventDefault();
if (paymentRequest) {
paymentRequest.update({
total: {
label: priceData?.description,
amount: priceData.total_price,
}
});
paymentRequest.show();
}
};

<PaymentRequestButtonElement
options={paymentRequestOptions}
onClick={updatePaymentRequestInstance}
/>

wanton dune
#

Wait, is your code to update your priceData.total_price also being called in that handler? Or like where are you first updating the amount you're providing to the payment request object?

Also, I don't see ForwardRef(Grid2) in your shared code excerpt, are you able to share any insight on what that is referring to?

shadow gazelle
#

<PaymentRequestButtonElement options={paymentRequestOptions} onClick={updatePaymentRequestInstance}/>
const updatePaymentRequestInstance = (event) => {
event.preventDefault();
if (paymentRequest) {
paymentRequest.update({
country: 'US', // Pass in country when updating code to support international plans
currency: priceData.currency.toLowerCase() || 'usd',
total: {
label: priceData?.description,
amount: priceData.total_price, // Stripe accepts amount in cents, which is returned by our API
},
});
}
}
const paymentRequestOptions = useMemo(() => {
return {
paymentRequest: paymentRequest,
};
}, [paymentRequest]);

Unsupported prop change: options.paymentRequest is not a mutable property. Error Component Stack

silk lintel
#

Hi taking over as toby had to step away

#

Give me a bit to catch up

shadow gazelle
#

Sure

stray geyser
#

Hello ๐Ÿ‘‹
Can you change options={paymentRequestOptions} to options={paymentRequestOptions.paymentRequest} ?

#

and see if that works

#

actually that might give you an error as well ๐Ÿค”

#

let's see if the error changes though

shadow gazelle
#

Hi also another issue, In our production environment, we observe that the Payment Request Button displays Link, Apple Pay, and Google Pay options as expected. However, in our test and development environments, only Apple Pay and Google Pay are visible; the Link option is absent. We have ensured that the payment method configuration for Link is activated in all environments. Could you please help us understand why Link is not appearing in the test and development environments despite identical configurations?

stray geyser
#

let's focus on one question at a time please

#

just to make sure I'm on the same page -- are you using your own custom button OR using the default button that comes with Payment Request Button?

#

I ask because I see paymentRequest.show() in your React code, which you should only be calling if you're using a custom button

shadow gazelle
#

default

stray geyser
#

Gotcha. So in that case, you should remove paymentRequest.show(); from your update function

shadow gazelle
#

If i remove that on clicking the gpay button nothing happens, so added that

#

now popup is shown

stray geyser
#

Are you changing the price after the wallet buttons are clicked on?

#

What exactly triggers price change?

#

paymentRequest.update({..}) runs async so I suspect the bug you're seeing is due to your code calling paymentRequest.show(); on the old paymentRequest object

shadow gazelle
#

I think price issue is fixed now

stray geyser
#

how did you fix it?

#

Since paymentRequest.update({..}) runs async you might be seeing this pricing issue show up randomly

shadow gazelle
#

onClick was not correctly handled

stray geyser
#

okay ๐Ÿ‘

shadow gazelle
#

Please fix link issue

#

In our production environment, we observe that the Payment Request Button displays Link, Apple Pay, and Google Pay options as expected. However, in our test and development environments, only Apple Pay and Google Pay are visible; the Link option is absent. We have ensured that the payment method configuration for Link is activated in all environments. Could you please help us understand why Link is not appearing in the test and development environments despite identical configurations?

stray geyser
#

I mean I can't fix link issue myself. I can help you work through it

#

Are you seeing any errors in your console regarding link?

shadow gazelle
#

no

stray geyser
#

Is the page you're testing with remotely accesible? If so, can you share the URL?

shadow gazelle
#

LINK
:
e
abort
:
ฦ’ ()
authentication
:
accountId
:
null
apiKey
:
"pk_test_51RByZvPgD1KBucBdIXLv1euiBXKuLwEC1cO4HcK5ZnZrYh8mJxxh6iRtloAGYUoMEn2ha3JfDyAzLHlUTvItxuuj00iX9ZsCRy"
[[Prototype]]
:
Object

ฦ’ toString()

#

It needs vpn

stray geyser
shadow gazelle
#

Link is supported, but only when card funding sources are used
how to check that?

stray geyser
#

You can log into your link account you're testing with and check if you've connected a card or a bank account

shadow gazelle
#

I dont have link account

#

but the link option shows on production environment

stray geyser
#

I think that's probably why link isn't showing up

Customers see Apple Pay or Google Pay if they enabled them on their device, and depending on the browser they use. If Link appears, it could be because customers:

  • Donโ€™t have Apple Pay or Google Pay enabled on their device.
  • Use Chrome with active, authenticated Link sessions.
shadow gazelle
#

not on test

#

on test i can see apple pay

stray geyser
#

Yup so that seems expected based on the above

#

are you seeing apple pay or google pay on production?

shadow gazelle
#

_canMakePaymentAvailability
:
APPLE_PAY: null
BROWSER:null
GOOGLE_PAY: true
LINK: false

#

No not google pay on production but if i open different browser with google pay false on test environment also i cannot see link

#

canMakePaymentAvailability
:
APPLE_PAY: null
BROWSER: false
GOOGLE_PAY: false
LINK: false

stray geyser
#

With Payment Request Button,

  • Google Pay is only supported on Chrome
  • Apple Pay is only supported on Safari
  • Link only shows up if Apple Pay and Google Pay aren't showing up OR if your browser has an authenticated link session

You'd want to make sure you've registered the domain for your production site - https://docs.stripe.com/payments/payment-methods/pmd-registration

That affects wallet availability too

shadow gazelle
#

I am able to see link on production

stray geyser
#

That's because your google pay isn't showing up

shadow gazelle
#

This is test on the same browser where gpay is false

#

On browser for the same url with gpay true on test:

stray geyser
#

What do you mean by gpay is false?

Do you mean you don't have a wallet configured? How are you disabling google pay here?

shadow gazelle
#

In different browser profile where wallet is not configured

stray geyser
shadow gazelle
#

yes its registered

stray geyser
#

Can you share your account ID?

#

just to clarify, you need to register the domain and the subdomain both

shadow gazelle
#

how to check?

#

account id

stray geyser
shadow gazelle
#

test: acct_19avFnB6uaytLGAa

#

production I think: acct_103zxh4iXjmKuwuf

stray geyser
#

Thanks. It looks like Link is disabled on Payment Request Button for the test account for some reason. My team won't know why.

Do you have a Stripe rep / contact? If so, you can ask them to have it enabled. Or else you can write in and create a support ticket to get this enabled -
https://support.stripe.com/?contact=true

shadow gazelle
#

Is it the issue?

#

Could you enable?

stray geyser
#

I can't do that unfortunately.. My team won't have the right access/tools to do this.

shadow gazelle
#

Thanks

#

for production is it enabled? Can you send any confirmation regarding the same?

#

discrepency between test and prod

stray geyser
#

I don't see the same block on the production. So yeah it shouldn't be disabled on the production.

#

Disabled for just that test account

shadow gazelle
#

block means?

#

U assumed?

stray geyser
#

not sure what you mean by that

shadow gazelle
#

I don't see the same block on the production. So yeah it shouldn't be disabled on the production.
means?

#

How did you confirm from stripe that it is not enabled?

stray geyser
#

I looked it up using the account IDs you've shared plus our own internal tools

shadow gazelle
#

Can you share the block?

stray geyser
#

What do you mean by share the block?

shadow gazelle
#

I want to share to my team that Stripe has confirmed

stray geyser
#

You can copy this thread URL on discord and use that for reference.
I can't share any internal details around this.

#

But yeah, I can confirm that there's a difference between your testing and production accounts.
Your test account has link disabled for Payment Request Button

shadow gazelle
#

Okay thanks for the confirmation

gentle mapleBOT
stray geyser
#

Anything else we can help you with?

shadow gazelle
#

no thanks:)