Amazon - Buy Shipping Rates for an Amazon Order

Carrier
Amazon
Action
Buy Shipping Rates for an Amazon Order
{
  "carrier": "amazon",
  "action": "getallrates",
  "params": {
    "client_id": "amzn1.application-oa2-client.abc123",
    "client_secret": "your-client-secret",
    "refresh_token": "Atzr|your-refresh-token",
    "application_id": "AmazonShipping_US",
    "order": {
      "id": "111-7676169-9674624"
    },
    "packages": [
      {
        "weight": 3.4,
        "length": 20,
        "width": 12,
        "height": 12,
        "insured_value": 89.98,
        "items": [
          {
            "id": "28367575711066",
            "quantity": 1,
            "weight": 1.2,
            "value": 49.99,
            "description": "Blue widget"
          },
          {
            "id": "28367575711067",
            "quantity": 1,
            "weight": 2.2,
            "value": 39.99,
            "description": "Red widget"
          }
        ]
      }
    ],
    "shipper": "Your Company",
    "ship_name": "Warehouse",
    "ship_addr1": "123 Main St",
    "ship_city": "Whitehall",
    "ship_state": "MT",
    "ship_code": "59759",
    "ship_country": "US",
    "ship_phone": "1231231234",
    "ship_email": "[email protected]",
    "weight_unit": "LB",
    "length_unit": "IN"
  }
}

<?php
$rs = new RocketShipIt;
$response = $rs->request(
array (
  'carrier' => 'amazon',
  'action' => 'getallrates',
  'params' => 
  array (
    'client_id' => 'amzn1.application-oa2-client.abc123',
    'client_secret' => 'your-client-secret',
    'refresh_token' => 'Atzr|your-refresh-token',
    'application_id' => 'AmazonShipping_US',
    'order' => 
    array (
      'id' => '111-7676169-9674624',
    ),
    'packages' => 
    array (
      0 => 
      array (
        'weight' => 3.4,
        'length' => 20,
        'width' => 12,
        'height' => 12,
        'insured_value' => 89.98,
        'items' => 
        array (
          0 => 
          array (
            'id' => '28367575711066',
            'quantity' => 1,
            'weight' => 1.2,
            'value' => 49.99,
            'description' => 'Blue widget',
          ),
          1 => 
          array (
            'id' => '28367575711067',
            'quantity' => 1,
            'weight' => 2.2,
            'value' => 39.99,
            'description' => 'Red widget',
          ),
        ),
      ),
    ),
    'shipper' => 'Your Company',
    'ship_name' => 'Warehouse',
    'ship_addr1' => '123 Main St',
    'ship_city' => 'Whitehall',
    'ship_state' => 'MT',
    'ship_code' => '59759',
    'ship_country' => 'US',
    'ship_phone' => '1231231234',
    'ship_email' => '[email protected]',
    'weight_unit' => 'LB',
    'length_unit' => 'IN',
  ),
)
);

rs.request(
  {'action': 'getallrates',
 'carrier': 'amazon',
 'params': {'application_id': 'AmazonShipping_US',
            'client_id': 'amzn1.application-oa2-client.abc123',
            'client_secret': 'your-client-secret',
            'length_unit': 'IN',
            'order': {'id': '111-7676169-9674624'},
            'packages': [{'height': 12,
                          'insured_value': 89.98,
                          'items': [{'description': 'Blue widget',
                                     'id': '28367575711066',
                                     'quantity': 1,
                                     'value': 49.99,
                                     'weight': 1.2},
                                    {'description': 'Red widget',
                                     'id': '28367575711067',
                                     'quantity': 1,
                                     'value': 39.99,
                                     'weight': 2.2}],
                          'length': 20,
                          'weight': 3.4,
                          'width': 12}],
            'refresh_token': 'Atzr|your-refresh-token',
            'ship_addr1': '123 Main St',
            'ship_city': 'Whitehall',
            'ship_code': '59759',
            'ship_country': 'US',
            'ship_email': '[email protected]',
            'ship_name': 'Warehouse',
            'ship_phone': '1231231234',
            'ship_state': 'MT',
            'shipper': 'Your Company',
            'weight_unit': 'LB'}}

)

rs.request(
  {"carrier"=>"amazon",
 "action"=>"getallrates",
 "params"=>
  {"client_id"=>"amzn1.application-oa2-client.abc123",
   "client_secret"=>"your-client-secret",
   "refresh_token"=>"Atzr|your-refresh-token",
   "application_id"=>"AmazonShipping_US",
   "order"=>{"id"=>"111-7676169-9674624"},
   "packages"=>
    [{"weight"=>3.4,
      "length"=>20,
      "width"=>12,
      "height"=>12,
      "insured_value"=>89.98,
      "items"=>
       [{"id"=>"28367575711066",
         "quantity"=>1,
         "weight"=>1.2,
         "value"=>49.99,
         "description"=>"Blue widget"},
        {"id"=>"28367575711067",
         "quantity"=>1,
         "weight"=>2.2,
         "value"=>39.99,
         "description"=>"Red widget"}]}],
   "shipper"=>"Your Company",
   "ship_name"=>"Warehouse",
   "ship_addr1"=>"123 Main St",
   "ship_city"=>"Whitehall",
   "ship_state"=>"MT",
   "ship_code"=>"59759",
   "ship_country"=>"US",
   "ship_phone"=>"1231231234",
   "ship_email"=>"[email protected]",
   "weight_unit"=>"LB",
   "length_unit"=>"IN"}}

)

rocketshipit.request(
  {
  "carrier": "amazon",
  "action": "getallrates",
  "params": {
    "client_id": "amzn1.application-oa2-client.abc123",
    "client_secret": "your-client-secret",
    "refresh_token": "Atzr|your-refresh-token",
    "application_id": "AmazonShipping_US",
    "order": {
      "id": "111-7676169-9674624"
    },
    "packages": [
      {
        "weight": 3.4,
        "length": 20,
        "width": 12,
        "height": 12,
        "insured_value": 89.98,
        "items": [
          {
            "id": "28367575711066",
            "quantity": 1,
            "weight": 1.2,
            "value": 49.99,
            "description": "Blue widget"
          },
          {
            "id": "28367575711067",
            "quantity": 1,
            "weight": 2.2,
            "value": 39.99,
            "description": "Red widget"
          }
        ]
      }
    ],
    "shipper": "Your Company",
    "ship_name": "Warehouse",
    "ship_addr1": "123 Main St",
    "ship_city": "Whitehall",
    "ship_state": "MT",
    "ship_code": "59759",
    "ship_country": "US",
    "ship_phone": "1231231234",
    "ship_email": "[email protected]",
    "weight_unit": "LB",
    "length_unit": "IN"
  }
}
)

← All Amazon examples