#ikaruga_api
1 messages · Page 1 of 1 (latest)
👋 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/1459011655341183200
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
what do you mean by backend running on emulator?
Do you mean the ephemeral key works fine on emulator, instead?
Basically, yes.
With Expo, when I run my app locally on an emulator, the backend part is also run locally.
But when I compile it to APK, Expo automatically builds and hosts the backend part on its servers.
I could confirm this by creating a dummy API that returns "hello" on a Post request and it works.
But when trying to reach my "payment-sheet" API, I get a timeout error.
Here's the code of said API if it helps :
import { STRIPE_PUBLIC, STRIPE_SECRET } from "@/components/constants/stripe";
import { Stripe } from "stripe";
export const stripe = new Stripe(STRIPE_SECRET, {
apiVersion: "2025-12-15.clover",
appInfo: { name: "Aether Trove" },
});
export async function POST(req) {
// Use an existing Customer ID if this is a returning customer.
console.log("req", req);
const { amount } = await req.json();
const customer = await stripe.customers.create();
const ephemeralKey = await stripe.ephemeralKeys.create(
{ customer: customer.id },
{ apiVersion: "2025-12-15.clover" }
);
const paymentIntent = await stripe.paymentIntents.create({
amount: amount * 100,
currency: "hkd",
customer: customer.id,
// In the latest version of the API, specifying the `automatic_payment_methods` parameter
// is optional because Stripe enables its functionality by default.
automatic_payment_methods: {
enabled: true,
},
});
return Response.json({
paymentIntent: paymentIntent.client_secret,
ephemeralKey: ephemeralKey.secret,
customer: customer.id,
publishableKey: STRIPE_PUBLIC,
});
}
Yes, here's my dummy API that works :
return Response.json({ hello: "worldPost" });
}
Tested in app with a dummy field and via Postman
Alright on the hosted backend, can you see its log? I guess it's time to add some debug log there
Does it not reach the endpoint at all, or stuck inside it
Unfortunately, I don't know if or how I can get access to the hosted console. All I know is that the request on /api/payment-sheet returns a timeout.
I think I found how to get logs !
console.log("req", req);
This console log has been displayed, so the end point is actually reached !
I now need to figure out why I get stuck inside.
I need to recompile, that might take a while. Thanks for your patience.
Here's my modified API with additional console logs
import { Stripe } from "stripe";
export const stripe = new Stripe(STRIPE_SECRET, {
apiVersion: "2025-12-15.clover",
appInfo: { name: "Aether Trove" },
});
export async function POST(req) {
// Use an existing Customer ID if this is a returning customer.
console.log("req", JSON.stringify(req));
const { amount } = await req.json();
console.log("amount", amount);
const customer = await stripe.customers.create();
console.log("customer", customer);
const ephemeralKey = await stripe.ephemeralKeys.create(
{ customer: customer.id },
{ apiVersion: "2025-12-15.clover" }
);
console.log("ephemeralKey", ephemeralKey);
const paymentIntent = await stripe.paymentIntents.create({
amount: amount * 100,
currency: "hkd",
customer: customer.id,
// In the latest version of the API, specifying the `automatic_payment_methods` parameter
// is optional because Stripe enables its functionality by default.
automatic_payment_methods: {
enabled: true,
},
});
console.log("paymentIntent", paymentIntent);
return Response.json({
paymentIntent: paymentIntent.client_secret,
ephemeralKey: ephemeralKey.secret,
customer: customer.id,
publishableKey: STRIPE_PUBLIC,
});
}
Here's the result I get when reaching it :
So basically, it seems to indicate that const customer = await stripe.customers.create(); generates the timeout.
Could it be some kind of CORS issue that prevents me from reaching stripe servers from this address, but would not be a problem from localhost ?
Yes probably. Can you look at your request log on your Stripe Dashboard? Does it show a Create Customer call?
If not then the server may not be able to reach Stripe. Did you configure its secret key?
I am using test data
test API keys
Checking on Stripe now
Cannot find the call in the Stripe Dashboard
That means the server can't reach Stripe server
Can you run a script on it?
Or look at IP or domain allow list
This is more of network troubleshooting
https://github.com/stripe/stripe-reachability for testing
I'll try that and come back to you
⛔️ Stripe developers have stepped away for a short while
Please leave your questions here, and we’ll respond as soon as we're back! If you need help urgently, you can contact Stripe support for help.
👋 I will close this thread for inactivity. But if you want to continue, feel free to open a new thread and it will link back here
I cannot run a script on the server, unfortunately
You would want to ask Expo community or the server provider for that, unfortunately