App reviews, troubleshooting, and recommendations
Hello. It is our first try with Shopify API. We want to Create Draft Orders via Shopify ADMIN API and although we can get response back about how many draft orders are open (count) and what those are, when we try to create a draft order we get response 200 and ERROR. We are on Laravel Framework. (the code is below)
in the store backend, we see message
"Some of your custom apps and/or admin webbook subscriptions may not work as expected because they are using deprecated API versions. etc etc etc." Our code is below and it appears we use version 2023-07
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Gnikyt\BasicShopifyAPI\BasicShopifyAPI;
use Gnikyt\BasicShopifyAPI\Options;
use Gnikyt\BasicShopifyAPI\Session;
class OrderController extends Controller
{
public function index()
{
return 'Order Index Page';
}
public function draft(Request $request)
{
echo 'Draft Order ...<br>';
// Create options for the API
$options = new Options();
$options->setVersion('2023-07');
// Create the client and session
$api = new BasicShopifyAPI($options);
/////////////////
$api->setSession(new Session('XXXXXXXX', 'XXXXXXXxxxXXX'>
// Create a draft order
$param = [
'draft_order' => [
'line_items' => [
[
'title' => 'Basketball',
'price' => 1.00,
'quantity' => 1,
'grams' => 50,
]
],
'tax_lines' => [
[
'price' => 1.00,
'rate' => 0.08,
'title' => 'HST'
]
],
'transactions' => [
[
'amount' => 1.00,
'kind' => 'sale',
'status' => 'success',
]
],
'total_tax' => 0.08,
'currency' => 'USD',
]
];
echo 'Create draft order: <br>';
print_r($param);
echo '<br>';
$result = $api->rest('POST', '/admin/api/2023-07/draft_orders.json', $param);
if ($result) {
if ($result['status'] == 201) {
//print_r($result['body']->container['draft_orders']);
echo '<br>Create draft order success<br>';
} else {
echo 'Error: ' . $result['errors'] . ', status: ' . $result['status'] . '<br>';
}
} else {
echo 'Network error<br>';
}
Our developer is using https://github.com/gnikyt/Basic-Shopify-API
Solved! Go to the solution
This is an accepted solution.
There is sample PHP code in the docs, did you try that?
Also some of those params don't look valid.
This is an accepted solution.
There is sample PHP code in the docs, did you try that?
Also some of those params don't look valid.
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025