#Clelio Quattrocchi

1 messages · Page 1 of 1 (latest)

dire frigateBOT
drowsy maple
#

Hi 👋 what help are you looking for?

austere rose
#

Hi

#

in EnlX Way we have already created a destination charge on our platform

#

but we wany the stripe fees are apyed by connected account

#

and not by us

#

so we have setted Stripe-Account header param

#

but we have an error in create payment intetn api

#

{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such PaymentMethod: 'pm_1NB3KLKEozv3OdijU5oxcIrL'; OAuth key or Stripe-Account header was used but API request was provided with a platform-owned payment method ID. Please ensure that the provided payment method matches the specified account.",
"param": "payment_method",
"request_log_url": "https://dashboard.stripe.com/acct_1NI9w4BCNKK99dJA/test/logs/req_COtuTEOTsaSbTH?t=1686660010",
"type": "invalid_request_error"
}
}

Learn more about error codes and how to resolve them.

drowsy maple
#

Ah, the error you posted in the main channel, that is likely happening because you're trying to access a Payment Method that belongs to a different account. Stripe accounts are not allowed to leverage objects from other accounts, even in Connect scenarios. So you're getting that error because you're trying to process a payment on a Connected Account, but the Payment Method you referenced doesn't exist on that account.

Changing your Connect integration isn't trivial.

#

Destination and Direct Charges are designed to work with specific type of Connected Accounts, if you want to change charge strucute you may also want to change the type of Connected Accounts that you are using.

austere rose
#

but one moment

#

if i create a payment intent in this way

#

curl --location --globoff --request POST 'https://api.stripe.com/v1/payment_intents?amount=1000&currency=usd&capture_method=manual&confirm=true&payment_method=pm_1NB3KLKEozv3OdijU5oxcIrL&on_behalf_of=acct_1NI9w4BCNKK99dJA&customer=cus_NwxES1zcRhRwre&transfer_data[destination]=acct_1NI9w4BCNKK99dJA&metadata[sessionId]=617b4397-e79c-464a-aace-0596a8efda13&description=EnelX SessionID 617b4397-e79c-464a-aace-0596a8efda13'
--header 'Authorization: Bearer sk_test_51Kf5qGKEozv3OdijqLoqPneJaiIAXgdhyUEW16HgxaRpQnk09QSMmdPspOjBC78iulKf2DRpK5u5do8UyHwkS8ep00CMRIaHV5'
--header 'Cookie: __stripe_orig_props=%7B%22referrer%22%3A%22%22%2C%22landing%22%3A%22https%3A%2F%2Fdashboard.stripe.com%2Facct_1NI9w4BCNKK99dJA%2Ftest%2Flogs%2Freq_MSvq7Vk1tbAg6k%3Ft%3D1686650441%22%7D; machine_identifier=0gwq2xUZRPN97lVMzrhMgnLCUPWTVTJaRfqtYyvU7EwKPPmnHrH9BvEfXC2M%2FYpqyfM%3D; private_machine_identifier=R7eW7fcJ86GnzIwGBkL%2BCIaX%2FK5Lnhlq5fpjy6DJ0gqhZhBLxHw9E%2FDqA%2FGjSFVlf74%3D; stripe.csrf=d3kC031LvJNMeVDVYcJcF3YlGR3wvRSy713wCxz5F0WDdCm1S66iS6WY6wI3UnM_x_NZJeAM01a8lPr9t3ZPWzw-AYTZVJyyOAPDrx1TUrtOzBqDms7K39FJSrCuLVBKek7p1JoAMQ%3D%3D'

#

the payment intent is created

#

even if paymentMethod doesn't belong to connected account

#

if I delete transfer_data[destination]

#

and fill Stripe-Account doesn't work

#

we have a b2c (paymentMethod and customer) will pay a recharge session

drowsy maple
#

(You will likely want to roll your secret key now that it has been exposed in a public forum)

austere rose
#

these money will be transfered to connected account

#

but we wnt that fee is payed by connected account and not by us

#

I don't know id it's clear my point

drowsy maple
# austere rose the payment intent is created

This is expected behavior. Destination Charges process the payments on the Platform Account, and then transfers a portion of the funds from the payment to the Connected Account. That request succeeds because the Payment Method being used belongs to the Platform Account, so it is available where the Payment Intent is being created.

Direct Charges process payments directly on the Connected Accounts, and then transfer some of the proceeds to the Platform Account. So if you removed transfer_data[destination] and replaced it with the stripe-account header, then that request would fail because the specified Payment Method wouldn't exist on the Connected Account where the intent is being created.

austere rose
#

Should payment method associated also to connected account?

#

I mean, in order to transfer stripe fees to connected account, I should create a payment method for each stripe account connected?

#

we have multiple stripe connected accounts

drowsy maple
#

But Transfers are done automatically as part of Destination and Direct charges, what are you trying to accomplish?

austere rose
#

we have some eletrical charging stations

#

we sell stations to companies

#

when a person charge his car on that stations

#

tha amount to pay is transfered to stripe account of owner of station

#

this flow works

#

but we are paying stripe fees for each transaction

#

and we want that company pays this fee

drowsy maple
#

Then you need to redesign your integration

austere rose
#

when a person insert a payment method, we create it in our stripe account

#

how does we have to redesign it?

drowsy maple
austere rose
#

it's not clear to me

#

a read documentation

#

but payment methods where should be created?

#

in some step I have specify the payment method where take the money

#

we have 3 actors

#

b2c -- our platform --- connected account

#

when i create a charge why a payment method isn't setted

#

?

drowsy maple
#

For Direct Charges, the Payment Methods need to be created on the Connected Accounts. Are you passing a Payment Method's ID in your requests?

austere rose
#

ok

#

so for each connected account i have create a payment method

#

right?

#

this means that if I have connected account A, B and C

#

b2c has to create 3 time the payment method

drowsy maple
#

Correct

#

Are you planning to collect payment method details one time and then reuse those across multiple connected accounts?

austere rose
#

yes

#

we create payment method once time

#

in our platform

#

and reuse it on multiple connected accounts

#

with transfer.destionation this work

#

but we pay stripe fee

#

I understood that if would want don't pay stripe fee

#

we have to create payment method on each connected account

drowsy maple
austere rose
#

ok let me investigate

#

for each connected account the clone is needed once?

drowsy maple
#

Yup

#

The cloned payment methods are not kept in sync with the ones they are copies of though, so if the Payment Method is updated on the Platform Account it will need to be re-cloned to the Connected Accounts.

austere rose
#

what means this error?

drowsy maple
austere rose
#

ok

#

the customer should be cloned as well?

#

I have cloned payment method

#

on connected account

#

now creating payment intent

#

curl --location --globoff --request POST 'https://api.stripe.com/v1/payment_intents?amount=1000&currency=usd&capture_method=automatic&confirm=true&payment_method=pm_1NIXjhBCNKK99dJA1Px5FFUp&customer=cus_NwxES1zcRhRwre&metadata[sessionId]=617b4397-e79c-464a-aace-0596a8efda13&description=EnelX SessionID 617b4397-e79c-464a-aace-0596a8efda13'
--header 'Authorization: Bearer sk_test_51Kf5qGKEozv3OdijqLoqPneJaiIAXgdhyUEW16HgxaRpQnk09QSMmdPspOjBC78iulKf2DRpK5u5do8UyHwkS8ep00CMRIaHV5'
--header 'Stripe-Account: acct_1NI9w4BCNKK99dJA' \

#

{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such customer: 'cus_NwxES1zcRhRwre'",
"param": "customer",
"request_log_url": "https://dashboard.stripe.com/acct_1NI9w4BCNKK99dJA/test/logs/req_IRzkEVjL6gUpTB?t=1686664780",
"type": "invalid_request_error"
}
}

Learn more about error codes and how to resolve them.

#

ok seems I can omit customer id

drowsy maple
#

Yup

austere rose
#

if I don't fill it

#

payment intent is created

#

but if i try again

#

{
"error": {
"message": "The provided PaymentMethod was previously used with a PaymentIntent without Customer attachment, shared with a connected account without Customer attachment, or was detached from a Customer. It may not be used again. To use a PaymentMethod multiple times, you must attach it to a Customer first.",
"request_log_url": "https://dashboard.stripe.com/acct_1NI9w4BCNKK99dJA/test/logs/req_Jr9tPbwrs96fAl?t=1686665086",
"type": "invalid_request_error"
}
}

drowsy maple
#

Yup, they're single use if not attached to a Customer

austere rose
#

so i have clone it again

#

there is a way to clone the customer on connected account?

drowsy maple
#

Not a way to clone the Customer, but you can create a Customer on the Connected Account to attach the Payment Method to so it is reusable.

austere rose
#

ok

#

tks a lot

drowsy maple
#

Any time!

austere rose
#

for your support