<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$url = 'https://api.example.com/api/orders';
$token = 'YOUR_ACCESS_TOKEN';
$response = $client->post($url, [
'headers' => [
'Authorization' => "Bearer $token",
'Content-Type' => 'application/json',
],
'json' => [
'affiliate_slug' => 'affiliate123',
'order_no' => 'ORDER-001',
'total_shipping_value' => 15.00,
'total_discount_value' => 5.00,
'currency_code' => 'USD',
'order_rows' => [
[
'product_sku' => 'SKU123',
'product_name' => 'Product Name A',
'segment_slug' => 'segment-001',
'price_value' => 100.00,
'tax_value' => 5.00,
'quantity' => 2,
]
],
'customer' => [
'name' => 'John Doe',
'email' => 'john.doe@example.com',
],
],
]);
echo $response->getBody();