#qadeer_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/1305878986865377331
๐ Have more to share? Add more 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.
- qadeer_docs, 4 hours ago, 7 messages
๐ happy to help
hello
would you mind sharing the request ID that failed?
I am creating payment method and assigning it to customer. When i assign paymentId to customer i get error no payment id exist
yes
I am gettig object from createPaymentmethod api
{
"id": "pm_1QKJfiAL2DaIkOXQ6jIFXdrZ",
"object": "payment_method",
"allow_redisplay": "unspecified",
"billing_details": {
"address": {
"city": null,
"country": "PK",
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": "raxi@mailinator.com",
"name": "Tatiana Snyder",
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": null
},
"country": "US",
"display_brand": "visa",
"exp_month": 3,
"exp_year": 2033,
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1731416298,
"customer": null,
"livemode": false,
"radar_options": {},
"type": "card"
}
and i pas this id to attach payment to customer
if (paymentMethod) {
attachCardResponse = await api.post(apiRoutes.ATTACH_CARD_CUSTOMER, {
email: user.email,
name: user.name,
paymentId: paymentMethod.id,
});
please follow these steps https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup
const newUserSubscription = new UserSubscription();
const { name, email, paymentId } = request.body;
const customers = await stripe.customers.search({
query: `email:'${email}'`,
});
if (customers.data.length) {
return sendErrorResponse(
response,
"customer already exist with this email",
404
);
}
const customer = await stripe.customers.create({
name: name,
email: email,
});
const result = await stripe.paymentMethods.attach(paymentId, {
customer: customer.id,
});
await stripe.customers.update(customer.id, {
invoice_settings: {
default_payment_method: paymentId,
},
});
This is my api that attach payment id to costomer
I did not get this. This is not the soltuion. If i change the stripe account same this piece of code works
you should follow the code I sent you
and use the SetupIntent instead of the attach PM API
But could you tell me the why should not i use PM API and why it's working for other stripe account
I need to see the request ID to know exactly what's happening
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Here whenever i try to attach payment id this api crash
please share the request ID req_xxx
req_A0jdgMf6acZcJ7
ok so basically you're creating the PaymentMethod on the frontend using the acct_1ODrzaAL2DaIkOXQ's publishable key
which is your US account
Yes i am creating paymentMethod on frontEnd
and in the backend you're trying to attach it to a customer created using the acct_1Q7u7iA5VZGs0nQZ's secret key
which is you AU account
the resource_missing is in that case expected since the PM you created on your US account is not accessible by the AU account
I am using the secret key and publishable key from same account that were created in AU.
It's strange
I checked it and it's test mode publishable key
of the US account
Could it be that first time i used the publishable key of us
and now it's no accepting it ?
you can check the request that created the PaymentMethod on your US account https://dashboard.stripe.com/test/logs/req_ns0QdQB2TFHhpv
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
How can i delete the payment method
it's in test mode so no need to delete anything
But still i cannot asign payment method to client because they are of different countries
you need to change the publishable key on your frontend
let me double check
Keys are good
const options: StripeElementsOptionsMode = {
mode: "setup",
currency: "usd",
paymentMethodCreation: "manual",
paymentMethodTypes: ["card"],
};
could it be because of currency: "usd", ?
no not related to the currency
how are you setting your key?
is it hardcoded in the code, or in an environment variable? are you testing this locally or on a public server?
i am setting them in env and testng locally
Yes this is on frontend
ok please restart your frontend server
changing environment variables while the server is running doesn't reflect the changes
could you create a new PM and send me the PM ID pm_xxx
'pm_1QKK9HAL2DaIkOXQbTmypYkA'
Here i just created now
Also i just using this endpoint to see if endpoint was created or not. It's returing me empty array
const paymentMethodsLit = await stripe.paymentMethods.list()
Yes, because that endpoint is for fetching payment methods related to Treausry. There's no API to list unattached payment methods
This was created here: https://dashboard.stripe.com/test/logs/req_41yGSoYpoESMag
Using the key of acct_1ODrzaAL2DaIkOXQ (a US account)
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
So your code that initialises Stripe.js is using keys from a different account, as my colleague has explained
I already got your point. But i am not getting it's creating payment method in my different stripe account
Not sure what else to say. The logs for the request that create the PM via Stripe.js indicate how and where the object was created
If I were you I'd reassess your code, specifically the part that initialises Stripe.js, and maybe see where the source of the pk_test_xxx key is. Try hard coding the key from the AU account instead of using an env variable
Okay thanks for this much help
Outside of that, we can't really help you I'm afraid. This is a integration issue in your code