#ninjaleodie132_api

1 messages ¡ Page 1 of 1 (latest)

digital windBOT
#

👋 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/1359969478716424372

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

gloomy crater
#

I am using react-native-sdk. It happens on

const resultInit = await initPaymentSheet({
        customerId: data.customerId,
        customerEphemeralKeySecret: data.customerEphemeralKeySecret,
        paymentIntentClientSecret: data.paymentIntentClientSecret,
        // returnURL: `http://localhost:5173/redirect/order?orderId=${data.orderId}`,
        returnURL: `atomic://payment-return`, // Update this to use your URL scheme
        merchantDisplayName: "Atomic",
      });
      console.log("resultInit", resultInit);

      const resultPresent = await presentPaymentSheet();

Then i try to amazon pay, and i get this error

fossil wharf
#

This started happening out of nowhere.
To be clear, are you saying this started but you didn't upgrade your SDK version, change your code, or do anything else in your environment?

gloomy crater
#

Thank you for the fast reply!
As far as I can tell i haven't changed anything since 2 hours ago when this started happening. I only set it up this morning too.

#

Ive made sure to cancel all pending payments (didnt think that should be an issue, but tried anyway).

fossil wharf
#

Gotcha, looking into this issue. Also as a quick heads up, there are bots that scrape servers like this for emails to spam so I deleted the message with your email. I do still have the address though.

#

And can you tell me more about when specifically this error is thrown? Is it after 3DS as in that issue or does it happen other times as well

gloomy crater
#

Thank you!

#

These are my steps right now
A customer wants to pay, so they need a payment sheet link.

const ephemeralKey = await this.localStripe.ephemeralKeys.create(
      { customer: customerStripeCustomerId },
      { apiVersion: "2023-10-16" },
    );
const paymentIntent = await this.localStripe.paymentIntents.create({

Then i use the result

      customerEphemeralKeySecret: ephemeralKey.secret,
      paymentIntentClientSecret: paymentIntent.client_secret,}

In my frontend and do:
const resultInit = await initPaymentSheet({
With those values
and finally
const resultPresent = await presentPaymentSheet();

I have been having some issues with return_urls but i would be surprised if that was causing this issue.
Let me know if i can send additional details for any of these steps.
I would be super super appreciate if we can solve this problem, been banging my head all day on it haha

fossil wharf
#

Gotcha, seeing what I can find. And to confirm, does this happen specifically after your app has to handle a return URL from a redirect, or are you seeing it other times as well?

gloomy crater
#

it happens only as soon as i try to pay, like in that screenshot above.

#

this is one of two stripe interactions my app has right now. 1. seller onboarding (connect express), 2. customer pays the seller

fossil wharf
#

Gotcha, and this happens immediately when you try to pay with any payment method?

gloomy crater
#

Yeah it loads for a quick second

#

i tried multiple customer objects as well, and the same thing happened for both.
Just in case it had been some kind of transient error or something was left in a bad state accidentally.

fossil wharf
#

Gotcha, can you send me your full code for how you are calling initPaymentSheet?

gloomy crater
#

this is the frontend:

const data: PrepStripePaymentResponse = await response.json();
// export interface PrepStripePaymentResponse {
//   customerId: string;
//   customerEphemeralKeySecret: string;
//   paymentIntentClientSecret: string;
//   orderId: string;
// }

const resultInit = await initPaymentSheet({
  customerId: data.customerId,
  customerEphemeralKeySecret: data.customerEphemeralKeySecret,
  paymentIntentClientSecret: data.paymentIntentClientSecret,
  returnURL: `http://localhost:5173/redirect/order?orderId=${data.orderId}`,
  merchantDisplayName: "Atomic",
});
console.log("resultInit", resultInit);

const resultPresent = await presentPaymentSheet();

This is the backend (what feeds the response.json()):

const customer = await this.localStripe.customers.create();
const ephemeralKey = await this.localStripe.ephemeralKeys.create(
  { customer: customerStripeCustomerId },
  { apiVersion: "2023-10-16" },
);
console.log("amount 100", amount * 100);
console.log("customerStripeCustomerId", customerStripeCustomerId);
console.log("bizStripeAccountId", bizStripeAccountId);
const paymentIntent = await this.localStripe.paymentIntents.create({
  amount: amount * 100, // amount in cents
  currency: "usd",
  customer: customerStripeCustomerId, // created earlier or reused
  application_fee_amount: 10, // 0.1% fee to us
  transfer_data: {
    destination: bizStripeAccountId,
  },
  automatic_payment_methods: {
    enabled: true,
  },
  metadata: {
    order_id: orderId,
  },
});
#

Also as added (confusing) context, i just tried it on my phone, and that worked fine. The ios simulator is not currently working.

#

And a full reset on the simulator (ie fully quitting it) did resolve the issue.
Is there anything odd about the code i've sent?

fossil wharf
#

It looks a lot like the code in our docs. the one thing that jumped out to me is that I think localhost will refer to the phone when you pass it as part of the config there, so that may be causing some weirdness, though I don't think it would cause this. So you aren't seeing this error anywhere anymore?

#

It definitely could have just been a transient state on the iOS simulator

gloomy crater
#

Yeah, that might be what it is.

#

Do with it what you will, but i think for now i know how to fix it (just hard reset my simulator)

#

Thanks for the help Pompey, hope it wasn't a waste of time haha