#Clelio Quattrocchi
1 messages · Page 1 of 1 (latest)
Hi 👋 what help are you looking for?
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"
}
}
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.
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¤cy=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
(You will likely want to roll your secret key now that it has been exposed in a public forum)
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
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.
If you would like to build a Direct Charges flow, I would recommend ensuring you're working with Standard Connected Accounts and then follow this guide:
https://stripe.com/docs/connect/direct-charges
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
No, Transfers are the objects used to move money between a Platform and Connected Account, you do not need to create a Payment Method for that.
But Transfers are done automatically as part of Destination and Direct charges, what are you trying to accomplish?
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
Then you need to redesign your integration
when a person insert a payment method, we create it in our stripe account
how does we have to redesign it?
You need to switch to Direct Charges, with Destination Charges your Platform is expected to pay the Stripe fees:
https://stripe.com/docs/connect/charges#stripe-fees
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
?
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?
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
Correct
Are you planning to collect payment method details one time and then reuse those across multiple connected accounts?
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
Okay, to do that with Direct Charges you'll also need to implement Payment Method cloning:
https://stripe.com/docs/connect/cloning-customers-across-accounts
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.
curl --location --request POST 'https://api.stripe.com/v1/tokens?customer=cus_NwxES1zcRhRwre'
--header 'Authorization: Bearer sk_test_51Kf5qGKEozv3OdijqLoqPneJaiIAXgdhyUEW16HgxaRpQnk09QSMmdPspOjBC78iulKf2DRpK5u5do8UyHwkS8ep00CMRIaHV5'
--header 'Stripe-Account: acct_1NI9w4BCNKK99dJA
{
"error": {
"message": "The customer must have an active payment source attached.",
"request_log_url": "https://dashboard.stripe.com/acct_1NI9w4BCNKK99dJA/test/logs/req_mcWSGUGYcrX7OV?t=1686664319",
"type": "invalid_request_error"
}
}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
what means this error?
Apologies, that was the wrong guide for your setup, can you try this approach instead:
https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods
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¤cy=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"
}
}
ok seems I can omit customer id
Yup
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"
}
}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yup, they're single use if not attached to a Customer
so i have clone it again
there is a way to clone the customer on connected account?
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.
Any time!
for your support