Charge from a card to specific merchant - Stripe?

≡放荡痞女 提交于 2020-01-24 20:54:26

问题


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.

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.


回答1:


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.



来源:https://stackoverflow.com/questions/42853469/charge-from-a-card-to-specific-merchant-stripe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!