4
votes

Does anyone know how to transfer to a bank account using Stripe API?

In the Stripe Reference it looks very simple: https://stripe.com/docs/api/python#create_transfer

stripe.Transfer.create(
  amount=400,
  currency="usd",
  destination="acct_19MKfXGyOv0GIG6Z",
  description="Transfer for [email protected]"
)

I don't understand where the destination id comes from. How can I get the destination id of a bank account?

Thanks

3

3 Answers

5
votes

There are two types of transfers with Stripe:

  • internal transfers, from a Stripe platform account to one of its connected accounts. This is known as a "special-case transfer".

  • external transfers, from a Stripe account to its associated bank account.

If you only have a single bank account for a given currency, you can use the special value "default_for_currency" for the destination parameter.

E.g. if you run this code:

stripe.Transfer.create(
  amount=400,
  currency="usd",
  destination="default_for_currency",
  description="Transfer for [email protected]"
)

then $4.00 would be sent to your USD bank account.

EDIT: On newer API versions (>= 2017-04-06), "internal transfers" are now simply known as "transfers", and "external transfers" are now known as "payouts". Cf. this doc page for more information.

1
votes

I have to use the below code in my existing project

Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));
  // Create a Charge:
    $charge = \Stripe\Charge::create([
        'amount' => 1300,
        'currency' => 'GBP',
        'customer' => 'cus_FM5OdvqpYD7AbR', // customer id
        'transfer_group' => date('y-m-d_h:i:s'),
        'transfer_data' => [
            'destination' => 'acct_1EuyLUIpWjdwbl8y', // destination id
            'amount' => 700
        ]
    ]);

    dd($charge);
0
votes

https://stripe.com/docs/connect/custom-accounts this above link will let you know how to get bank account id

stripe.accounts.create({
  country: "US",
  type: "custom"
}).then(function(acct) {
  // asynchronously called
});

you can get

this code will give acc. id in response that you can use in destination.