#rome-help

1 messages · Page 1 of 1 (latest)

tardy nymph
#

hey @silver cloak lets chat in a thread here please

silver cloak
#

Cool

#

Can I get the customer ID from the result?

tardy nymph
#

Result of which call, exactly?

#

ie, what is that handler handling

silver cloak
#

Add credit card

#

stripe.createPaymentMethod({

#

var res = stripePaymentMethodHandler(result);

tardy nymph
#

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?

silver cloak
#

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?

tardy nymph
#

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?

silver cloak
#

My own checkout

tardy nymph
silver cloak
#

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'"

tardy nymph
#

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

silver cloak
#

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

tardy nymph
#

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

silver cloak
#

Got you

#

Thanks

tardy nymph
#

if your customer record in your database doesnt have a stripe customer ID yet, you'll need to create that customer first.