Amazon - Rates with Insured Value and Items

Carrier: Amazon
Action: Rates with Insured Value and Items
Description: Example implementation for Amazon Rates with Insured Value and Items
{
  "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",
    "packages": [
      {
        "weight": 3.4,
        "length": 20,
        "width": 12,
        "height": 12,
        "insured_value": 89.98,
        "insured_currency": "USD",
        "items": [
          {
            "quantity": 1,
            "weight": 1.2
          },
          {
            "quantity": 1,
            "weight": 2.2
          }
        ]
      }
    ],
    "ship_name": "Your Company",
    "ship_addr1": "940 Presidio Ave",
    "ship_city": "San Francisco",
    "ship_state": "CA",
    "ship_code": "94115",
    "ship_country": "US",
    "ship_phone": "5552881660",
    "to_name": "John Doe",
    "to_addr1": "940 Presidio Ave",
    "to_addr2": "#103",
    "to_city": "San Francisco",
    "to_state": "CA",
    "to_code": "94115",
    "to_country": "US",
    "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',
    'packages' => 
    array (
      0 => 
      array (
        'weight' => 3.4,
        'length' => 20,
        'width' => 12,
        'height' => 12,
        'insured_value' => 89.98,
        'insured_currency' => 'USD',
        'items' => 
        array (
          0 => 
          array (
            'quantity' => 1,
            'weight' => 1.2,
          ),
          1 => 
          array (
            'quantity' => 1,
            'weight' => 2.2,
          ),
        ),
      ),
    ),
    'ship_name' => 'Your Company',
    'ship_addr1' => '940 Presidio Ave',
    'ship_city' => 'San Francisco',
    'ship_state' => 'CA',
    'ship_code' => '94115',
    'ship_country' => 'US',
    'ship_phone' => '5552881660',
    'to_name' => 'John Doe',
    'to_addr1' => '940 Presidio Ave',
    'to_addr2' => '#103',
    'to_city' => 'San Francisco',
    'to_state' => 'CA',
    'to_code' => '94115',
    'to_country' => 'US',
    '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',
            'packages': [{'height': 12,
                          'insured_currency': 'USD',
                          'insured_value': 89.98,
                          'items': [{'quantity': 1, 'weight': 1.2},
                                    {'quantity': 1, 'weight': 2.2}],
                          'length': 20,
                          'weight': 3.4,
                          'width': 12}],
            'refresh_token': 'Atzr|your-refresh-token',
            'ship_addr1': '940 Presidio Ave',
            'ship_city': 'San Francisco',
            'ship_code': '94115',
            'ship_country': 'US',
            'ship_name': 'Your Company',
            'ship_phone': '5552881660',
            'ship_state': 'CA',
            'to_addr1': '940 Presidio Ave',
            'to_addr2': '#103',
            'to_city': 'San Francisco',
            'to_code': '94115',
            'to_country': 'US',
            'to_name': 'John Doe',
            'to_state': 'CA',
            '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",
   "packages"=>
    [{"weight"=>3.4,
      "length"=>20,
      "width"=>12,
      "height"=>12,
      "insured_value"=>89.98,
      "insured_currency"=>"USD",
      "items"=>
       [{"quantity"=>1, "weight"=>1.2}, {"quantity"=>1, "weight"=>2.2}]}],
   "ship_name"=>"Your Company",
   "ship_addr1"=>"940 Presidio Ave",
   "ship_city"=>"San Francisco",
   "ship_state"=>"CA",
   "ship_code"=>"94115",
   "ship_country"=>"US",
   "ship_phone"=>"5552881660",
   "to_name"=>"John Doe",
   "to_addr1"=>"940 Presidio Ave",
   "to_addr2"=>"#103",
   "to_city"=>"San Francisco",
   "to_state"=>"CA",
   "to_code"=>"94115",
   "to_country"=>"US",
   "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",
    "packages": [
      {
        "weight": 3.4,
        "length": 20,
        "width": 12,
        "height": 12,
        "insured_value": 89.98,
        "insured_currency": "USD",
        "items": [
          {
            "quantity": 1,
            "weight": 1.2
          },
          {
            "quantity": 1,
            "weight": 2.2
          }
        ]
      }
    ],
    "ship_name": "Your Company",
    "ship_addr1": "940 Presidio Ave",
    "ship_city": "San Francisco",
    "ship_state": "CA",
    "ship_code": "94115",
    "ship_country": "US",
    "ship_phone": "5552881660",
    "to_name": "John Doe",
    "to_addr1": "940 Presidio Ave",
    "to_addr2": "#103",
    "to_city": "San Francisco",
    "to_state": "CA",
    "to_code": "94115",
    "to_country": "US",
    "weight_unit": "LB",
    "length_unit": "IN"
  }
}
)
← Back to Amazon Examples

Other Amazon Examples

Authenticate
Example implementation for Amazon Authenticate
Label
Example implementation for Amazon Label
Label with Amazon Order
Example implementation for Amazon Label with Amazon Order
Purchase Shipment
Example implementation for Amazon Purchase Shipment
Rates
Example implementation for Amazon Rates
Tracking
Example implementation for Amazon Tracking
Void Shipment
Example implementation for Amazon Void Shipment