#sapient-dev_code

1 messages · Page 1 of 1 (latest)

balmy yokeBOT
#

👋 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.

hasty drift
#

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

hoary beacon
#

message
:
"No such PaymentMethod: 'pm_1SNsdRIH539HR1gQi71FS583'"

getting this error

hasty drift
hoary beacon
#

Yes sure

balmy yokeBOT
hoary beacon
#

req_m3Sv87qv9MpkwQ

Request id for the error

prisma comet
#

👋 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

hoary beacon
#

Then what was the issue I have connected the connected account and now want to make payment from it.

prisma comet
#

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

hoary beacon
#

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,
}
);

prisma comet
#

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] to true and automatic_payment_methods[allow_redirects] to never when creating Setup Intents and Payment Intents

hoary beacon
#

Okay.