#cecilia-chen-_error
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1254965126403194911
đ Have more to share? Add 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.
- cecilia-chen-_docs, 59 minutes ago, 55 messages
Hi, the error sounds like you might be working with multiple Stripe account and mixing them up. Can you ensure that all keys belong to the same account?
Can you explain that to me please? I don't quite understand.
I am the developer trying to build the platform, and I used the published key that i found through the stripe dashboard
the logic is like, when a user create an account on my app, i will create a stripe account for him/her
so the user can buy services from other users
users can publish services on my app, and set the price
`// Create a SetupIntent for Saving a Payment Method
exports.createSetupIntent = functions.https.onCall(async (data, context) => {
const uid = context.auth?.uid;
if (!uid) {
throw new functions.https.HttpsError("unauthenticated", "User must be authenticated to call this function.");
}
try {
const customerId = data.customer_id;
if (!customerId) {
throw new functions.https.HttpsError('invalid-argument', 'Customer ID is required.');
}
// Create a SetupIntent for the customer
const setupIntent = await stripe.setupIntents.create({
customer: customerId,
usage: 'on_session' // Indicates that the payment method will be used for future payments when the customer is present
});
// Return the SetupIntent client secret
return {
setupIntent: setupIntent.client_secret
};
} catch (err) {
functions.logger.error('Error creating SetupIntent:', err);
throw new functions.https.HttpsError('internal', 'Unable to create SetupIntent: ' + err.message);
}
});`
Can you share the setup intent id where you saw this error?
"seti_1PVNxp07TXb9PM9Qq3jyQ7ZT_secret_QM6AF3Y6DkX69ypXXPzmLQjxJwRHGKW"
I printed it out
can you share the request id to create the setup intent please? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_oBI7guQip7jU5U
private func getSetupIntentForCustomer(stripeId: String) async throws -> String { let result = try await Functions.functions().httpsCallable("createSetupIntent").call(["customer_id": stripeId]) guard let data = result.data as? [String: Any], let setupIntentClientSecret = data["setupIntent"] as? String else { throw NSError(domain: "Invalid setupIntent data", code: -1, userInfo: nil) } return setupIntentClientSecret }
`// Create a SetupIntent for Saving a Payment Method
exports.createSetupIntent = functions.https.onCall(async (data, context) => {
const uid = context.auth?.uid;
if (!uid) {
throw new functions.https.HttpsError("unauthenticated", "User must be authenticated to call this function.");
}
try {
const customerId = data.customer_id;
if (!customerId) {
throw new functions.https.HttpsError('invalid-argument', 'Customer ID is required.');
}
// Create a SetupIntent for the customer
const setupIntent = await stripe.setupIntents.create({
customer: customerId,
usage: 'on_session' // Indicates that the payment method will be used for future payments when the customer is present
});
// Return the SetupIntent client secret
return {
setupIntent: setupIntent.client_secret
};
} catch (err) {
functions.logger.error('Error creating SetupIntent:', err);
throw new functions.https.HttpsError('internal', 'Unable to create SetupIntent: ' + err.message);
}
});`
req_oBI7guQip7jU5U
Sorry, I did not realize you were integrating with mobile. I do not have enough mobile expertise so let me grab a teammate who does.
Actually, can you share the request id where you create the SetupIntent from the following code:
// Create a SetupIntent for the customer
const setupIntent = await stripe.setupIntents.create({
customer: customerId,
usage: 'on_session' // Indicates that the payment method will be used for future payments when the customer is present
});