#junaid_abbasi999
1 messages · Page 1 of 1 (latest)
I am using test mode of stripe.
Hello! Do you mind sharing a request ID I can take a look at?
where would i find the request Id?
You should be able to find it in the Dashboard
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
don't have any request in dashboard but I consoled the response that i am getting and in that I see this " requestId: undefined,"..
sorry the response is not consoled.... It's what I am getting at my terminal..... requestId is undefined. there is also a lot more information attached to it.
Gotcha
Let's take a different approach - can you share the Customer ID you're trying to retrieve, and the code you're using to do it?
cus_NSbfYUbm7rB8PN
app.post("/retrieve-account", async (req, res) => {
console.log("customerId:", req.body.accountId);
const account = await stripe.accounts.retrieve(req.body.accountId);
console.log(account);
res.json(account);
});
Why are you using stripe.accounts.retrieve and not stripe.customers.retrieve?
Glad I could help!
one last thing my customer object has default_source and invoiceSettings.default_payment_method set to null even though I have added two credit cards to this specific customer. I have a requirement where i need to find the default card attached to a customer.
Hi, stepping in here
That is expected, you'd want to look at https://stripe.com/docs/api/customers/object#customer_object-default_source.
ID of the default payment source for the customer.
If you are using payment methods created via the PaymentMethods API, see the invoice_settings.default_payment_method field instead.
Yes I got that. But how will I able to get the default payemnt method id?
if these two are null eventhough payment methods are added to it
I see your question. From looking at this customer, cus_NSbfYUbm7rB8PN you shared earlier, neither of these payment methods are set as the default. These appear to be only attached to the customer, https://stripe.com/docs/api/payment_methods/attach.
To set a payment method as the default, you can make an Update a Customer, https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method.
one last thing if i didn't set a default payment method how will stripe decide what payment method to charge?
No, you'd need to explicitly pass the payment method id when creating the subscription.
no but for future payment you need an id for payment method.
What do you mean for 'future payments'? Are you talking about when you create a one-time Payment Intent for that customer?
I'm not 100% clear on what you're trying to do. However, once you have setup the payment method, you can use that payment method for future payments. You'd need to pass the payment method id for that payment.
Ok let me draw a sceneroi for you to understand.
user 1 orders a service from user 2 and sets his payment method, user 1 will not be charget at this time.
user 2 provides the service and clicks a button named as 'confirm'. Then we charge the user 1 off-session.
for now what I am doing is when user 1 is ordering a service, I save the id of the first card that is returned by stripe card list api in my database. And when user 2 click 'confirm'. I retrieve that ID and I charge user 1.
Hope that makes my case clear enough