1
votes

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 and Raju were An is the customer and added a card to make payment and Raju is the service provide who need to receive payment.

enter image description here

Card added under An

enter image description here

Account added under Raju

enter image description here

Like this there would be many customers and providers those need to dynamically accept and make payment automatically using stripe API's.

1

1 Answers

1
votes

Customers are payment sources. They can provide funds, but not receive them.

In order to accept payments on behalf of third parties, you must use Stripe Connect. You would create accounts (not customers) for your merchants.

I recommend you spend some time browsing through Connect's documentation, and reach out directly to Stripe's support if you have questions about how to apply Connect to your specific business model.