#OwenN-detach PM

1 messages ยท Page 1 of 1 (latest)

opaque estuary
#

๐Ÿ‘‹ happy to help

pulsar birch
#

Thank you for the help ! I've checked the docs already but I'm still stuck on the Connect account part.
Is this parameter not available on the paymentmethod.detach method ? Should I (very reluctantly) use the API keys of the Connect accounts instead ?
Did I make a dumb syntax error that I have missed all those hours ?
Here's the different ways I tried to write it and the errors it threw at me :

Stripe::PaymentMethod.detach(
    pm.id,
    stripe_account: csa.csa_key
)

and

Stripe::PaymentMethod.detach(
    pm.id,
    {stripe_account: csa.csa_key}
)

Results in:
"No such PaymentMethod: 'pm_1LKjXXXXXXXXXXXX'"

Stripe::PaymentMethod.detach(
    {
        pm.id
    },
    stripe_account: csa.csa_key
)

Results in :
"syntax error, unexpected '\n', expecting =>
syntax error, unexpected ')', expecting 'end' "

opaque estuary
pulsar birch
#

Let me get you one really quick!

#

req_8OHkh18peCMmAq

opaque estuary
#

oh wait I see the issue

#

your passing the account id wrong

#

your passing it as parameters to the detach method

#

I'm taking a look

pulsar birch
#

So I should write it like :

Stripe::PaymentMethod.detach(
  paymentmethod.id,
  { stripe_account: acc.id}
)

correct ?

#

Thank you for your time btw

opaque estuary
#

yes exactly

#

another thing

#
  paymentmethod.id,
  {},
  { stripe_account: acc.id}
)```
#

I think this is the right way

pulsar birch
#

Thanks, let me try !

#

The other way gave me an error

opaque estuary
#

could you please provide me with request ids?

pulsar birch
#

Hey it worked! I have another error now but it's not on the same topic

#

So I'll debug it myself

#

Thank you so much tarzan

opaque estuary
#

I might be able to help if you share the request id

pulsar birch
#

Is there any way to explain the extra {} that needs to be written there ?
Is this just to prevent stripe from thinking it's part of the request body ?

opaque estuary
#

yes basically there's the id, the params which is the equivalent of the request body and the opts which are the headers

pulsar birch
#

Cool, that makes more sense

#

And no worries about the other error, I'll be able to deal with this one

#

Thank you so much for your help ๐Ÿ™‚

#

Have a good day