Reputation: 51
I'm working with Bigcommerce API using php. I've successfully created store/order/created
webhook, but it only fires when I create the order using the store control panel, it's not working when I post an order to orders
endpoint in the code even though my order has been successfully created.
The example order that I posted is like below:
$product = new \stdClass();
$product->product_id = 194;
$product->sku = 'test-prod-1';
$product->quantity = 1;
$shippingAddress = new \stdClass();
$shippingAddress->first_name = "Trisha";
$shippingAddress->last_name = "McLaughlin";
$shippingAddress->street_1 = "Mikonkatu 15A";
$shippingAddress->city = "Helsinki";
$shippingAddress->zip = "00100";
$shippingAddress->country_iso2 = "FI";
$shippingAddress->phone = "0452507625";
$orderData = array(
'date_created' => 'Wed, 14 Nov 2012 19:26:23 +0000',
'customer_id' => 1,
'payment_method' => 'Cash',
'external_source' => 'Test',
'billing_address' => $shippingAddress,
'status_id' => 11,
'products' => array(
$product
)
);
$bcOrder = Bigcommerce::createOrder($orderData);
Anyone had the same issue?
Thanks
Upvotes: 3
Views: 413
Reputation: 1866
You are more likely to see store/order/updated
correctly fire when a successful order has been placed. store/order/created
may fire when an unsuccessful order was attempted and some other variables, but the first store/order/updated
should correctly identify a new order in the system.
Upvotes: 1