#jayvir_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1276462667195744257
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- jayvir_api, 18 hours ago, 9 messages
- jayvir_api, 1 day ago, 15 messages
new
Hi, what's exactly the challenge you're facing here?
let paymentMethodDetails = await stripe.paymentIntents.retrieve(transaction_id, {
stripeAccount: config.connectedAccountId,
})
const setupIntent = await stripe.setupIntents.create({
payment_method: paymentMethodDetails?.payment_method,
customer: customerId
});
Error attaching PaymentMethod to Platform: StripeInvalidRequestError: No such PaymentMethod: 'pm_1PqUO5JRoJfA1S16xFRbeK8k'; It's possible this PaymentMethod exists on one of your connected accounts, in which case you should retry this request on that connected account. Learn more at https://stripe.com/docs/connect/authentication
i want to copy the payment_method in platform from one connected account
then use same payment_method to charge amount from another connected account
customerId is of platform account
paymentMethodDetails - 1st connected account
I suggested to you yesterday, that you can't copy a PaymentMethod from a Connected account (CA) to the Platform. Only Platform -> CA.
oh
then how should i proceed ?
platform account - A
one of connected account ie X - paymentIntent Method - created customer & payment method - payment happen here
one of connected account ie Y - use above method & card info charges once again
platform account - A - will get application fee from X - $3
Real example :
$106 - to be charged to user & by connected account ie X
$3 - taken by stripe
$3 - taken platform account - A as application fee
$100 - net received by connected account ie X
now again charges $5 from one of connected account ie Y
this should happen
i need to execute this
Real example :
$106 - to be charged to user & by connected account ie X
$3 - taken by stripe
$3 - taken platform account - A as application fee
$100 - net received by connected account ie X
now again charges $5 from one of connected account ie Y
this should happen
i need to execute this
@candid chasm @burnt cairn guide me
You should probably collect the PaymentMethod on the Platform account, and then copy it to the Connected accounts.
You can't copy PaymentMethods that were collected on the Connected accounts to any other account
yes I agree with @burnt cairn, if you want to share payment methods across different connected accounts you should save the payment method first on the platform and then you can clone it across all of your connected accounts when you want to
bur how ?can u example me ?
const customer = await stripe.customers.create({
name: 'Jenny Rosen',
});
const setupIntent = await stripe.setupIntents.create({
customer: '{{CUSTOMER_ID}}',
});
const paymentMethod = await stripe.paymentMethods.create(
{
customer: '{{PLATFORM_CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID}}',
},
{
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
}
);
const paymentIntent = await stripe.paymentIntents.create(
{
payment_method: '{{PAYMENT_METHOD_ID}}',
currency: 'USD',
amount: 1099,
off_session: true,
confirm: true,
},
{
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
}
);
const paymentMethod = await stripe.paymentMethods.create(
{
customer: '{{PLATFORM_CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID}}',
},
{
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
}
);
how to get PAYMENT_METHOD_ID?
generally paymentIntents it get excuted first ?
const paymentIntent = await stripe.paymentIntents.create(
{
payment_method: '{{PAYMENT_METHOD_ID}}',
currency: 'USD',
amount: 1099,
off_session: true,
confirm: true,
},
{
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
}
);
I'm not sure what this whole code is suppose to mean
const paymentIntent = await stripe.paymentIntents.create(
{
amount: 1000,
currency: 'usd',
automatic_payment_methods: {
enabled: true,
},
customer: customerId
application_fee_amount: 123,
},
{
stripeAccount: '{{CONNECTED_ACCOUNT_ID}}',
}
);
i am using this
so how i will get
You should probably collect the PaymentMethod on the Platform account, and then copy it to the Connected accounts.
You can't copy PaymentMethods that were collected on the Connected accounts to any other account ?
you create a SetupIntent on the platform
customer: '{{CUSTOMER_ID}}',
});```
then you collect the Payment Method in the frontend
then you clone the Customer/PM into your connected account
customerId should be platform or connected account ?
and then you create a Direct Charge in yout connected acccount
platform
when you're not passing stripeAccount you're creating objects on your platform account
then you collect the Payment Method in the frontend
how to collect & pass in backend ?
then you clone the Customer/PM into your connected account
how to clone ?
then you collect the Payment Method in the frontend
how to collect & pass in backend ?
https://docs.stripe.com/payments/save-and-reuse
then you clone the Customer/PM into your connected account
how to clone ?
https://docs.stripe.com/connect/direct-charges-multiple-accounts#clone-payment-method
please read the docs I'm sending you
so i need create session intead of paymentIntents ?
what session?
sorry I see what you mean no you don't have to
https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
stripe.checkout.sessions instead of stripe.paymentIntents.create. ?
you should create a SetupIntent
u mean just SetupIntent
then charge money from backend ?
const paymentIntent = await stripe.paymentIntents.create({
amount: 1099,
currency: 'usd',
automatic_payment_methods: {enabled: true},
customer: '{{CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID}}',
return_url: 'https://example.com/order/123/complete',
off_session: true,
confirm: true,
},
{
stripeAccount: '{{X}}',
});
const paymentIntent2 = await stripe.paymentIntents.create({
amount: 299,
currency: 'usd',
automatic_payment_methods: {enabled: true},
customer: '{{CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID}}',
return_url: 'https://example.com/order/123/complete',
off_session: true,
confirm: true,
},
{
stripeAccount: '{{Y}}',
});
right ?
let's step back for a second
what are you trying to achieve
let's forget about the implementation
would you mind telling me more about your use case?
Real example :
$106 - to be charged to user & pass to connected account ie X
$3 - taken by stripe
$3 - taken platform account - A as application fee
$100 - net received by connected account ie X
now again user charges $5 from one of connected account ie Y
so user will get charged twice :
106
5
user will enter card info - once
this should happen
hope u got what i want to achieve @candid chasm ?
yes I just wanted to make sure that it's not a multi-party payout (e.g. paying the restaurant and the delivery person)
ok
so yes what we were doing is correct
one thing missing here is the cloning that I sent you a doc for
so before you can create a PaymentIntent on the connected account you need to clone the Customer and their PaymentMethod to the Connected Account
all of this assuming that you are creating Standard Connect Accounts
yes Standard Connect Accounts
setup SetupIntent - in frontend & backend - for getting just card information
clone CUSTOMER_ID1
clone PAYMENT_METHOD_ID1
const paymentIntent = await stripe.paymentIntents.create({
amount: 1099,
currency: 'usd',
automatic_payment_methods: {enabled: true},
customer: '{{CUSTOMER_ID}}',
payment_method: '{{PAYMENT_METHOD_ID1}}',
return_url: 'https://example.com/order/123/complete',
off_session: true,
confirm: true,
},
{
stripeAccount: '{{X}}',
});
clone CUSTOMER_ID2
clone PAYMENT_METHOD_ID2
const paymentIntent2 = await stripe.paymentIntents.create({
amount: 299,
currency: 'usd',
automatic_payment_methods: {enabled: true},
customer: '{{CUSTOMER_ID2}}',
payment_method: '{{PAYMENT_METHOD_ID2}}',
return_url: 'https://example.com/order/123/complete',
off_session: true,
confirm: true,
},
{
stripeAccount: '{{Y}}',
});
now flow is correct ?
yes
it is bigger change
we were using paymentIntent
right ?
yes but card is loaded based on PaymentIntents Id right before ?
now it will based on setupIntents ?
yes but card is loaded based on PaymentIntents transaction_id
what do you mean by that?
card view was loaded based on PaymentIntents Id right ?
yes
you're still using PaymentIntents
but you're adding some steps before that
so no changes in frontend ?
or both frontend & backend need to change ?
both need to change
in the front end instead of using confirmPayment you would use confirmSetup
ya just saw that
was going to ask same
so in the way bigger change right @candid chasm
whole flow need to changed from front & back end ?
yes
i got basic how the flow should be now atleast after this conversation
thanks @candid chasm
CC @real moat @dire flax