title: WooCommerce REST API v3 remote ordering and payment and sending all data into WP
body: <p>I started creating a program where we can browse products by category. Add items to our cart (in messenger) and update cart etc.</p>
  
  <p>We have Stripe / PayPal already connected to our App and would like to handle everything on our end, in the app. Then, when the order is completed, send the entire order as the data array into WP.</p>
  
  <p>A few questions since I'm stuck.</p>
  
  <p>I'd use this part from the API docs:
  <a href="https://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-an-order" rel="nofollow noreferrer">https://woocommerce.github.io/woocommerce-rest-api-docs/?php#create-an-order</a></p>
  
  <pre><code>&lt;?php
  $data = [
      'payment_method' =&gt; 'bacs',
      'payment_method_title' =&gt; 'Direct Bank Transfer',
      'set_paid' =&gt; true,
      'billing' =&gt; [
          'first_name' =&gt; 'John',
          'last_name' =&gt; 'Doe',
          'address_1' =&gt; '969 Market',
          'address_2' =&gt; '',
          'city' =&gt; 'San Francisco',
          'state' =&gt; 'CA',
          'postcode' =&gt; '94103',
          'country' =&gt; 'US',
          'email' =&gt; 'john.doe@example.com',
          'phone' =&gt; '(555) 555-5555'
      ],
      'shipping' =&gt; [
          'first_name' =&gt; 'John',
          'last_name' =&gt; 'Doe',
          'address_1' =&gt; '969 Market',
          'address_2' =&gt; '',
          'city' =&gt; 'San Francisco',
          'state' =&gt; 'CA',
          'postcode' =&gt; '94103',
          'country' =&gt; 'US'
      ],
      'line_items' =&gt; [
          [
              'product_id' =&gt; 93,
              'quantity' =&gt; 2
          ],
          [
              'product_id' =&gt; 22,
              'variation_id' =&gt; 23,
              'quantity' =&gt; 1
          ]
      ],
      'shipping_lines' =&gt; [
          [
              'method_id' =&gt; 'flat_rate',
              'method_title' =&gt; 'Flat Rate',
              'total' =&gt; 10
          ]
      ]
  ];
  
  print_r($woocommerce-&gt;post('orders', $data));
  </code></pre>
  
  <p>I have some issues with that though. I haven't tested it yet because we use it on a live store, but I'd like to know some stuff that isn't mentioned anywhere. Except for when using a 3rd party plugin, which we don't want. We want to only use the native, clean WooCommerce plugin.</p>
  
  <p>• Is it possible to use a payment method as the reference, even though it does not exist in WP itself? So, if we use Stripe to create and pay for the order in messenger even though Stripe itself isn't in use in our store, can we still push that as the payment reference in the $data array here:</p>
  
  <pre><code>'payment_method' =&gt; 'stripe',
  'payment_method_title' =&gt; 'Offsite Payment Method',
  </code></pre>
  
  <p>I read you need to create the order first normally if you want to get the payment token, and then update the status after payment, but since we're doing the entire ordering and payment processing offsite (only utilizing the WooCommerce catalog) and want to shoot in the order after a successful ordering process outside of WP, I'm a bit puzzled.</p>
  
  <p>There's a lot of info to be found about missing cart features unless you use something like cocart, which we don't want since we can't ask customers to all install another to be able to use our tool.</p>
  
  <p>Anybody came across a similar use case?</p>