2

I am using stripe php sdk in laravel application , where seller user adds dummy bank account number and routing number in bank detail. Now seller payout his stripe balance into their bank account using below strip Transfer api-

function payout()
{
    Stripe::setApiKey($this->secret_key);
    $balance = Balance::retrieve();
    $balance = $balance->available[0]->amount;

    if ($balance == 0) {
        return true;
    }

    $transfer = Transfer::create([
        "amount" => $balance ,
        "currency" => 'gbp',
        "destination" => 'default_for_currency',
        "description" => config('app.name') . ' payout.'
    ]);

    if ($transfer->failure_code !== null) {
        throw new Exception($transfer->failure_message);
    }

    $transaction = new StripeTransfer();
    $transaction->user_id = $this->user_id;
    $transaction->stripe_id = $transfer->id;
    $transaction->amount = $balance;
    $transaction->save();

    return true;
}

But this gives below error-

"No such destination: default_for_currency"

I am using it in test env. May this effecting. Please help in provide good solution. Thanks

Lokendra Parihar
  • 121
  • 2
  • 13

1 Answers1

0

The destination should be a valid Stripe account id. e.g. something like "acct_1HKbBD2oxnBfnQ8N"

stevec
  • 41,291
  • 27
  • 223
  • 311