建立联系
Context::initialize(
$this->key,
$this->secret,
$_ENV['SHOPIFY_API_SCOPES'],
$_ENV['SHOPIFY_URL'],
new FileSessionStorage('/tmp/php_sessions'),
'2023-01',
);
$id = uniqid();
$shopDomain = $this->url;
$isOnline = false;
$state = bin2hex(random_bytes(16));
$session = new \Shopify\Auth\Session($id, $shopDomain, $isOnline, $state);
$session->setAccessToken($this->token);
$this->test_session = $session;
获得成就:
$fulfillment = Fulfillment::create(
$this->test_session,
$fulfillmentData,
['order_id' => $order->getId()]
);
返回对象
但是
$fulfillment = new Fulfillment($this->test_session);
$fulfillment->message = "The package was shipped this morning.";
$fulfillment->notify_customer = false;
$fulfillment->tracking_info = [
"number" => 1562678,
"url" => "https://www.my-shipping-company.com",
"company" => "my-shipping-company"
];
/** @var Product $item */
foreach ($order->getLineItems() as $item) {
$fulfillment->line_items_by_fulfillment_order = [
[
"fulfillment_order_id" => $order->getId(),
"fulfillment_order_line_items" => [
[
"id" => $item->getId(),
"quantity" => 1
]
]
]
];
}
$fulfillment->save(
true, // Update Object
);
给我
REST 请求失败:“未找到”
我使用(symfony 6,php 8.2)
use Shopify\Auth\OAuth;
use Shopify\Rest\Admin2023_01\Fulfillment;
use Shopify\Rest\Admin2023_01\Webhook;
use Shopify\Utils;