#rome-help
1 messages · Page 1 of 1 (latest)
Cool
Can I get the customer ID from the result?
Tried rersult.paymentMethod.customer.id but it didnt work
Add credit card
stripe.createPaymentMethod({
var res = stripePaymentMethodHandler(result);
ah, then no at that point there is no customer context yet, its not been attached to a customer
What are you trying to do?
I have few case when the customer ID is missing
And then its give me an error message in the checkout
What is the best approach for this cases?
If you're creating a payment method like that i don't think I'd expect it to ever have a customer
Do you mean Stripe's hosted Checkout, or your own checkout/payment flow?
My own checkout
Can you share a specific example of the error you're encountering? ie, perhaps with a request id like req_123 https://stripe.com/docs/api/request_ids
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
No such customer: 'cus_JLKO5pybI2sejC'; a similar object exists in live mode, but a test mode key was used to make this request
Sorry not that
You passed an empty string for 'customer'
Im creating new payment method
And when customer is click on confirm order
Im attaching the payment method to the customer
But some times I have cases of old customers who dosent have stripe customer ID
And then its throwing this error
"You passed an empty string for 'customer'"
Can you share the request ID from the headers of the response please?
If you don't have a customer ID to send, you should omit the parameter instead of sending an empty string
I dont have it now
What do you mean omit
Got it
Thanks!
Will try to
But dont I need to attach the payment method to a customer?
I thought this is mandatory
var options = new PaymentMethodAttachOptions
{
Customer = customerDt.Rows[0]["token"].ToString(),
};
try
{
var service = new PaymentMethodService();
service.Attach(
pmDt.Rows[0]["token"].ToString(),
options
);
So can I just omit the attached process?
Yes tried it and it's working!
Thanks a lot
You can use a payment method once without attaching it, attaching is not required
To be able to re-use it in future though it must be attached
But you need to make sure you send a valid customer ID in the customer parameter
if your customer record in your database doesnt have a stripe customer ID yet, you'll need to create that customer first.