I am trying to use stripe Direct Charges and it's working when user user new card (with token id).
Problem: When trying with save customer id and save card id. When i am trying to charge with custom-id and source=> save card id It's giving error customer not exist. But Both customer and card id exist.
$charge = \Stripe\Charge::create([
"customer" => $userdata->stripe_id,
"amount" => $amount,
"currency" => "usd",
"source" => $findcard['card_id'],
"application_fee" => $fee,
], ["stripe_account" => $talent_stripeid]);
Error: No such customer: cus_EOwmc6nVmU7oNu
I was getting the same error and when reached out to Stripe support got the following answer which helped me to solve the issue:
The error you are running into is happening because the customer object is on the platform account, but when you add the "Stripe-account" parameter to your charge request, you're moving the command to the connected account, and so can't reach the customer object.
To make the customer available, you'll need to share the customer to the connected account. You'll basically create a token or source from the customer object on your platform, and then share that with the connected account, to process a payment, or to save locally, so the connected account can use it directly.
https://stripe.com/docs/connect/shared-customers
Alternatively, you can keep the customer information on your platform account and perform Destination charges, just sending to the connected account "their share" of the proceeds: