Search code examples
phplaravelstripe-paymentsstripe-connect

Stripe Connect and Managed Accounts


I was wondering for a bit of clarification and help regarding Stripe.

Basically, I have the following:

    //get the card token from the stripe request
    $customerTok = request('stripeToken');

    //create the customer with this token
    $customer = \Stripe\Customer::create(array(
        "email" => \Auth::user()->email,
        "source" => $customerTok,
        ));

Where customerTok is the bank token passed by Stripe.js (entering their card number, cvc and exp date), and I'm creating the customer in my Stripe Dashboard.

$cardTok = \Stripe\Token::create(array(
   "card"=>$customer->sources->retrieve(default_source),
));`

Then I grab a token for their card? (I think this is wrong but this is the principle?)

I now need to make them into a connect managed account (I need users to be able to pay each other, like eBay)

 $account = \Stripe\Account::create(
          array(
            "country" => "GB",
            "managed" => true,                
            "external_account"=>$customer->id,
));

Obviously this isn't production ready code, I'm just trying to understand the flow and if I'm understanding this correctly.. Can anyone explain why this isn't working right now and what I'm getting wrong?

Thanks,


Solution

  • Generally, you cannot retokenize payment information from saved customers (outside of specific scenarios).

    Note also that Stripe can only do payouts to debit cards (not credit cards), and only in the US. In all other countries, Stripe can only do payouts to bank accounts.

    If your platform's users are both buyers and sellers, you will need to create two different resources for each of them:

    • a customer object to act as a payment source (when the user buys something)

    • an account object to act as a payment destination (when a user sells something)

    I recommend that you reach out to Stripe's support at https://support.stripe.com/email to explain your business model so that you can receive personalized advice for your integration.