I hope that somebody can help. I know that it is communicating because when I remove something required it lets me know something is missing. With everything valid though, I get no returned response and the order doesn't show up in ShipStation. Any ideas? Maybe I overlooked something?
public function __invoke(){
$json_payload = '
{
"orderNumber": "TEST-ORDER-API-DOCS",
"orderKey": "1",
"orderDate": "2023-03-12T08:46:27.0000000",
"orderStatus": "awaiting_shipment",
"customerEmail": "headhoncho@whitehouse.gov",
"billTo": {
"name": "Tovis",
"company": "Vizcom",
"street1": "4500 Broadmoor Ave SE",
"street2": null,
"street3": null,
"city": "Grand Rapids",
"state": "MI",
"postalCode": "49512",
"country": "US",
"phone": "555-555-5555",
"residential": true
},
"shipTo": {
"name": "The President",
"company": "US Govt",
"street1": "1600 Pennsylvania Ave",
"street2": "Oval Office",
"street3": null,
"city": "Washington",
"state": "DC",
"postalCode": "20500",
"country": "US",
"phone": "555-555-5555",
"residential": true
},
"customerNotes": "Please ship as soon as possible!",
"internalNotes": "Customer called and would like to upgrade shipping",
"requestedShippingService": "Priority Mail",
"carrierCode": "fedex",
"serviceCode": "fedex_2day",
"packageCode": "package",
"confirmation": "delivery",
"shipDate": "2023-03-20",
"weight": {
"value": 25,
"units": "ounces"
},
"dimensions": {
"units": "inches",
"length": 7,
"width": 5,
"height": 6
}
}
';
$key = config('shipstation.key');
$secret = config('shipstation.secret');
$url = 'https://ssapi.shipstation.com/orders/createorder';
$credentials = base64_encode("$key:$secret");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json',
'Host: ssapi.shipstation.com',
"Authorization: Basic $credentials",
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_payload);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
