Search code examples
phpstripe-paymentsstripe-connect

How to find PLATFORM_SECRET_KEY in Stripe


How can i get PLATFORM_SECRET_KEY in my test stripe account i am payment using stripe connect

\Stripe\Stripe::setApiKey(PLATFORM_SECRET_KEY);
    $tr = \Stripe\Payout::create(array(
      "amount" => 24784,
      "currency" => "usd",
      "source_type" => "bank_account"
    ));

Solution

  • This represents the API key of your own account so it can be found in your dashboard: https://dashboard.stripe.com/account/apikeys

    You would be acting as the platform where you make API requests on behalf of your connected accounts which is why you would use your own API key. You also need to pass the connected account id in the Stripe-Account header as documented here. The code should look like this:

    \Stripe\Stripe::setApiKey(PLATFORM_SECRET_KEY);
    $payout = \Stripe\Payout::create(
      array(
        "amount" => 24784,
        "currency" => "usd",
        "source_type" => "bank_account"
      ),
      array(
        "stripe_account" => "acct_XXXXX"
      )
    ));