#RGRTHAT

1 messages · Page 1 of 1 (latest)

supple oasisBOT
dense orchid
#

Hi there

#

Assuming you mean "Connected Account" when you say "connected"?

obtuse mist
#

Im trying to check if a payment method already exist for a certain connected customer based on their id

#
const connected_customer_payment_methods = await stripe.customers.listPaymentMethods(
        connected_customer_id,
        { type: "card" },
        { stripeAccount }
      );
#

this doesnt seem to work

dense orchid
#

Should be const connected_customer_payment_methods = await stripe.customers.listPaymentMethods( connected_customer_id, { type: "card", stripeAccount } );

obtuse mist
#

oh in the same object as type

#

let me try that

obtuse mist
dense orchid
#

Err doh

#

You had it right the first time

#

What is happening with your original syntax?

#

Have you logged out your variables?

obtuse mist
#

if i want to clone a payment method, is it like so: ```js
const connected_payment_method = await stripe.paymentMethods.create(
{

        customer: platform_customer_id,
        payment_method: platform_payment_method_id,
      },
      {
        stripeAccount: connected_account_id,
      }
    );
#

@dense orchid is it the connected customer id, or platform customer id

#

when u want to add a payment method to the connect customer

dense orchid
#

Platform Customer ID when you clone

#

So what you have looks good

#

Then did you attach the new PaymentMethod to a Customer on the Connected Account?

obtuse mist
#

but i need to attach the payment method to the connected customer i just created

obtuse mist
#

cuz i have a conditional code over this, that check for payment method for the specific connected customer, so i dont clone the payment method multiple times

#

i have created the payment method now for connected account, but i need to attach the payment method to the customer

dense orchid
obtuse mist
#

I just add the payment method that i just cloned to the payment intent? u dont attach the newly cloned payment intent to the actual customer

dense orchid
#

You can also attach it when you charge it if you are charging it immediately

obtuse mist
#

damn nice

#

didnt even knew this existed

dense orchid
#

If you use that PaymentMethod with a PaymentIntent and use setup_future_usage and pass a Customer ID then the PaymentMethod will automatically be attached to that Customer on successful payment

obtuse mist
#

yeh if i put "future_usage"? will that automatically set the paymentmethod for the customer?

#

yup

#

well i suppose i dont need the attach then, cuz else i will attach it twice

dense orchid
#

Right wasn't sure what your flow was exactly

#

But likely you only want to attach on charge