title: Can't Transfer Amount to Connect Stripe Account
body: <p><strong>BackGround:</strong></p>
  
  <p>What i'm trying to do is set-up a marketplace where the customer can acquire services of a seller,The Project is a MERN Stack Travel Application to be exact. What i would like is for the customer to Pay the Platform(<em>My Website connected with Stripe</em>) when he wishes to acquire a service e.g a hotel Room. The Customer stays at the hotel for the allotted time and when he checksout the platform keeps some of the customers amount as application fee and transfers the rest to the service provider,in this case the hotel.</p>
  
  <p><strong>Current Effort:</strong> </p>
  
  <p>I Used <code>STRIPE CONNECT</code> to acheive the required functionality.</p>
  
  <p>(<code>Note</code>: you guys don't need to see all of the code below just the heading and description would give you an idea of what i have done and what i'm trying to ask,but please do read the <strong>issue</strong> section)</p>
  
  <p>i create a <code>Connect account</code> for the seller when he signs up on my Website</p>
  
  <p><strong>Create Connect Account</strong></p>
  
  <pre><code>const express = require("express");
  const router = express.Router();
    router.post("/createAccount", async (req, res) =&gt; {
    const { name, email } = req.body; //Data Passed from the FrontEnd
    stripe.accounts.create(
      {
        type: "custom",
        country: "US",
        email: email,
        requested_capabilities: ["card_payments", "transfers"],
      },
      function (err, account) {
        res.json({ account: account });
      }
    );
  });
  </code></pre>
  
  <p>When the Seller Provides the rest of the required details(including bank Account) after logging-in to the <code>Seller Portal</code> i create a <code>bank_account</code>,update the already created <code>Connect Account</code> and link the <code>bank_account</code> with the <code>Connect Account</code> (Hopefully, that somehow makes sense)</p>
  
  <p><strong>Create Bank Account</strong></p>
  
  <pre><code>  router.post("/createBankAccount", async (req, res) =&gt; {
    const { account_holder_name, routing_number, account_number } = req.body;
    stripe.tokens.create(
      {
        bank_account: {
          country: "US",
          currency: "USD",
          account_holder_name,
          account_holder_type: "individual",
          routing_number,
          account_number,
        },
      },
      function (err, token) {
        res.send(token);
      }
    );
  });
  </code></pre>
  
  <p><strong>Update Account:</strong></p>
  
  <pre><code>  router.post("/updateAccount", async (req, res) =&gt; {
        const {
          AccountID,
          Day,
          Month,
          Year,
          first_name,
          last_name,
          email,
          BankAccountID,
        } = req.body;
  
        const FrontFilePath = fs.readFileSync("PathToFileHere");
        const FrontPhotoIDUpload = await stripe.files.create({
          file: {
            data: FrontFilePath,
            name: "FrontPhotoID.jpg",
            type: "application.octet-stream",
          },
          purpose: "identity_document",
        });
  
        const BackFilePath = fs.readFileSync("PathToFileHere");
        const BackPhotoIDUpload = await stripe.files.create({
          file: {
            data: BackFilePath,
            name: "BackPhotoID.jpg",
            type: "application.octet-stream",
          },
          purpose: "identity_document",
        });
  
        stripe.accounts.update(
          AccountID,
          {
            business_type: "individual",
            individual: {
              dob: { day: Day, month: Month, year: Year },
              first_name: first_name,
              last_name: last_name,
              id_number: "006-20-8311",
              phone: "605-628-6049",
              address: {
                city: "Half Way",
                line1: "2467  Twin House Lane",
                postal_code: "65663",
                state: "MO",
              },
              email,
              ssn_last_4: "8311",
              verification: {
                document: {
                  front: FrontPhotoIDUpload.id,
                  back: BackPhotoIDUpload.id,
                },
              },
            },
            business_profile: {
              mcc: "4722",
              url: "http://www.baoisne.com",
            },
            tos_acceptance: {
              date: Math.floor(Date.now() / 1000),
              ip: req.connection.remoteAddress, 
            },
          },
          function (err, account) {
            console.log(err);
            console.log(account);
          }
        );
       //Connect External Account
        stripe.accounts.createExternalAccount(
          AccountID,
          {
            external_account: BankAccountID,
          },
          function (err, bankAccount) {
            console.log(err);
            res.send(bankAccount);
          }
        );
      });
  </code></pre>
  
  <p>Then when the customers provides his account details i charge the customer,keep some money as application fee and move the rest to the Service Providers Connect account.</p>
  
  <p><strong>Charge Customer</strong></p>
  
  <pre><code>  router.post("/charge", async (req, res) =&gt; {
    const { TokenID, CustomerID, Amount, AccountID } = req.body;
    let PaymentAmount = Amount * 100;
    let application_fee_amount = 400;
    try {
      const payment = await stripe.paymentIntents.create({
        amount: PaymentAmount,
        currency: "USD",
        description: "We did it boss",
        payment_method_data: {
          type: "card",
          card: {
            token: TokenID,
          },
        },
        receipt_email: "abdullahabid427@gmail.com",
        customer: CustomerID,
        application_fee_amount,
        transfer_data: {
        destination: AccountID,
        },
        confirm: true,
      });
      return res.status(200).json({
        confirm: "Payment Succeeded",
      });
    } catch (error) {
      console.log(error);
      return res.status(400).json({
        message: error.message,
      });
    }
  });
  </code></pre>
  
  <p>By doing the above procedure a connect account is created and the amount is moved into the connected account.</p>
  
  <blockquote>
    <p><strong>Issue</strong></p>
  </blockquote>
  
  <p>The Above procedure although works correctly, it moves the amount into the Connected Service Provider Account directly after the customer is charged, what i would like is for the customer to pay the platform and after the Service Provider has provided his services , the Platform pays the Service Provider, i thought about removing </p>
  
  <pre><code>  application_fee_amount,
    transfer_data: {
    destination: AccountID,
    }
  </code></pre>
  
  <p>the above parameters in the <code>Charge</code> or <code>Stripe.paymentIntents.create</code> endpoint, and after Service Provider has completed his services i transfer the amount using the Stripe Transfer API</p>
  
  <pre><code>router.post("/transfer", async (req, res) =&gt; {
    try {
      console.log("TRANSFER=");
      const { AccountID, amount } = req.body;
      const transfer = await stripe.transfers.create({
        amount,
        currency: "USD",
        destination: AccountID,
      });
      res.send(transfer);
    } catch (error) {
      res.send(error);
    }
  });
  </code></pre>
  
  <p>the issue here is that transfer endpoint returns "<em>Your destination account needs to have at least one of the following capabilities enabled: transfers, legacy_payments</em>" , i have checked the Connected Account in Stripe Dashboard and in the Capabilities section <code>Card_Payment</code> and <code>Transfers</code> are both set to Active, plus Payments and Payouts are both Enabled and the status of the connect account is "Complete"</p>
  
  <p>So if anyone could point in the right direction i would really Appreciate it,Cheers :)</p>