#RGRTHAT

1 messages ยท Page 1 of 1 (latest)

ancient boneBOT
charred arch
#

hi! it could be, it would depend. That's what the setup_future_usage parameter on PaymentIntents is for. When you say "Connect", what exact model of charging are you using? Direct or Destination charges for instance?

rapid oxide
#

direct

#

u pay straight away with ur card

#

Currently i have had a seperate page where u can "setup" ur card

charred arch
rapid oxide
#

yes

charred arch
#

ok, further question. Do you want to save the card details on the connected merchant account, or on your platform account?

rapid oxide
#

connected account i suppose

#

cuz if i have alot of connected accounts its easier to keep track of things

charred arch
#

then you simply pass setup_future_usage when creating the PaymentIntent. https://stripe.com/docs/payments/save-during-payment covers this, it's the same thing, only difference for Connect is you would be passing Stripe-Account and an application_fee_amount as well for example.

rapid oxide
#

I try do do clientside js stripe .confirmCardPayment('{PAYMENT_INTENT_CLIENT_SECRET}', { payment_method: { card: cardElement, }, }) but get error saying ```js
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'HTMLDivElement'
| property '__reactFiber$fdinkoi3ows' -> object with constructor 'FiberNode'
--- property 'stateNode' closes the circle
at JSON.stringify (<anonymous>)

#

I use this cardElement

#
import {
  PaymentElement,
} from "@stripe/react-stripe-js";
#

maybe this cardElement is wrong for the .confirmCardPayment

charred arch
#

either way there's no client side component to this, setup_future_usage is something you set on the server side

#

if you have a working client side integration for taking a payment on a connected account using Elements, nothing has to change on the frontend. You just pass setup_future_usage when creating the PaymentIntent.

rapid oxide
#

I have now implemented a checkout where user can choose between using existing card or use another new card by entering card details

#

@charred arch so if I add "setup future usage": "off_session" as parameter on paymentIntent serverside, this will save a paymentMethod?

main dew
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

rapid oxide
#
let paymentIntent = await stripe.paymentIntents.create(
              {
                customer: connected_account_customer_id,
                setup_future_usage: "off_session",
                
              },
              {
                stripeAccount: stripe_account_id,
              }
            );
#

will this save the paymentMethod?

#

currently i have saved a user paymentMethod using setupIntent

#

but i want to save the paymentMethod at first ever payment with a card

main dew
#

adding setup_future_usage as off_session tells Stripe to save the Payment Method you're collecting for this Payment Intent for future usage

rapid oxide
#

just for this specific paymentIntent?

#

i need to be able to save the payment method at first ever payment with card, and then fetch the payment method l8r to see if a customer have an already existing payment method

#

so customer dont have to paste card details again

main dew
#

in this case the future usage is set to be off_session meaning that you can use the Payment Method to collect payments without having your customer in your website to authenticate the payment

main dew
rapid oxide
#

it doesnt seem to have saved a payment method

#

i created a new account and did my first ever payment

main dew
#

the payment method is saved on the Connected Account

#

could you please share the Payment Intent ID?

rapid oxide
#

i have created a hook that calls for all payment methods

#

but i see now that it only fetches the payment methods of customer and not payment methods of customer that is for the connect account

#

let me check when i add the connect account parameter

#

it should find the paymentmethod then

main dew
#

yes

rapid oxide
#

is it possible to clone a platform customer to make the customer a connected account customer?

main dew
#

yes

rapid oxide
#

current i create a connected account customer, but i need to fetch the connected account customer based on platform customer

main dew
rapid oxide
#

yeh but this uses the old token crap

main dew
#

in this case it's not a problem to use tokens

#

there are some cases where tokens are still the valid way to go

rapid oxide
#

is it possible to create connect account using stripe.customers.create, but where u can specify platform "customer"

main dew
#

no not really

rapid oxide
#

isnt it possible to search payment methods?

#

BY metadata for example

main dew
#

no unfortunately that's not possible

rapid oxide
#

the issue i have is this:

#

how can I fetch connected customer based on platform customer

#

cuz i create the connected customer by using customer.create()

#

when i create the connected customer i dont create it based on platform customer

surreal vapor
#

You would need to store that info on your backend somewhere, or on the metadata of either the platform or connected customer

#

We don't really save info like "cus_123 on the platform is cus_456 on this connected account", so you would need to keep track of that yourself in some way

rapid oxide
#

in my webhook how can i listen for setupintent success?

#

i need to create a connected payment method from the platform payment method when setupintent is complete

#

what is the event name

surreal vapor