In stripe transfer getting error "No such destination: default_for_currency"

1k views Asked by At

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

1

There are 1 answers

0
stevec On

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