Let me illustrate my payment logic first off all.
I have two user-level in my app
Service provider will set up his bank a/c's to receive payment. So, I have created a customer Merchant1 in stripe then added & verified an a/c under that customer object. then saved the customer id for using it later.
Customer will add his cards for making payment for a service. I have created a customer Customer1 and added card under then saved the customer id .
Now I have to charge from Customer1 to Merchant1. Everything is works well except the final procedure IE, Charging.
I have gone through stripe charging docs but I couldn't find out how to charge directly from Customer1 to Merchant1.
By using the following code I had tried out but It seems the destination account should be connected to use the param destination
. Ain't understand what's a connected account. I just want to tranfer from one customer card to other ones account. I'm stucked completely. Pl. offer me a helping hand.
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
\Stripe\Charge::create(array(
"amount" => 1500,
"currency" => "usd",
"customer" => $customer_id, // Previously stored, then retrieved
"destination" => {CONNECTED_STRIPE_ACCOUNT_ID}
));
And also tried with the below snippet but that giving an error response like Merchant not found
$charge_deails = \Stripe\Charge::create(array(
"amount" => "300",
"currency" => "usd",
"customer" => "***",
"destination"=>"**",
"description" => $requestParams['additional_description']));
Any help would greatly appreciated.
Update
Attachment for clarification
Two customers
An
andRaju
wereAn
is the customer and added a card to make payment andRaju
is the service provide who need to receive payment.
Card added under
An
Account added under
Raju
Like this there would be many customers and providers those need to dynamically accept and make payment automatically using stripe API's.