#sapient-dev_code
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/1433394019991556137
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
hey there! 'no such XYZ' errors generally mean that you're trying to interact with an object that doesn't exist in the account you're using
in connect scenarios, this usually means that the 'Stripe-Account' header isn't being configured correctly/consistently: https://docs.stripe.com/connect/authentication
message
:
"No such PaymentMethod: 'pm_1SNsdRIH539HR1gQi71FS583'"
getting this error
can you share the request ID for this?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
Yes sure
req_m3Sv87qv9MpkwQ
Request id for the error
👋 Hi there! I'm taking over for my colleague; give me a moment to catch up
As @hasty drift hinted at, the Payment Method pm_1SNsdRIH539HR1gQi71FS583 exists on the account acct_1RYiwzIH539HR1gQ — but it seems this request was made on behalf of another connected account, acct_1SN9DfI7ul0jKqQB
Then what was the issue I have connected the connected account and now want to make payment from it.
The request you shared used the Stripe-Account header with acct_1SN9DfI7ul0jKqQB to create a Payment Intent. However, you passed in a payment_method that belongs to a different Stripe account
You would need to pass in a payment_method belonging to the same connected account, acct_1SN9DfI7ul0jKqQB
req_34UsgdXQ7J5SWy
Can you check for this req_id what was the issue still getting same error of no such payment Method
req_HZ5IWD4yjnLxnZ
Error resolve related to the no such payment method. Please check above request Id. Below is my code for you reference
const paymentIntent = await stripe.paymentIntents.create(
{
amount: Math.round(amount * 100),
currency: "aud",
payment_method: paymentMethodId,
confirm: true,
metadata: {
userId: String(userId),
providerId: String(providerId),
},
automatic_payment_methods: { enabled: true },
expand: ["charges"],
},
{
stripeAccount: provider.stripeAccountId,
}
);
Taking a look
The error message tells you what the issue is:
Because some of these payment methods might redirect your customer off of your page, you must provide a
return_url
You can follow the advice in the error message, or provide a return_url that users will be redirected to once they complete their payment on another site (e.g. if they get redirected to PayPal for example):
If you don't want to accept redirect-based payment methods, set
automatic_payment_methods[enabled]totrueandautomatic_payment_methods[allow_redirects]toneverwhen creating Setup Intents and Payment Intents
Okay.