File tree Expand file tree Collapse file tree
official/docs/node/current/luma Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const EasyPost = require ( "@easypost/api" ) ;
2+
3+ const api = new EasyPost ( "EASYPOST_API_KEY" ) ;
4+
5+ ( async ( ) => {
6+ const shipment = await api . Shipment . retrieve ( "shp_..." ) ;
7+ await shipment . buy ( shipment . lowestRate ( ) ) ;
8+
9+ console . log ( shipment ) ;
10+ } ) ( ) ;
Original file line number Diff line number Diff line change 1+ const EasyPost = require ( "@easypost/api" ) ;
2+
3+ const api = new EasyPost ( "EASYPOST_API_KEY" ) ;
4+
5+ ( async ( ) => {
6+ const shipment = await api . Shipment . create ( {
7+ to_address : {
8+ name : "Dr. Steve Brule" ,
9+ street1 : "5744 Silverton Ave" ,
10+ city : "McKinney" ,
11+ state : "TX" ,
12+ zip : "75070" ,
13+ country : "US" ,
14+ phone : "8573875756" ,
15+ email : "dr_steve_brule@gmail.com" ,
16+ } ,
17+ from_address : {
18+ name : "EasyPost" ,
19+ street1 : "417 Montgomery Street" ,
20+ street2 : "5th Floor" ,
21+ city : "San Francisco" ,
22+ state : "CA" ,
23+ zip : "94104" ,
24+ country : "US" ,
25+ phone : "4153334445" ,
26+ email : "support@easypost.com" ,
27+ } ,
28+ parcel : {
29+ length : 20.2 ,
30+ width : 10.9 ,
31+ height : 5 ,
32+ weight : 65.9 ,
33+ } ,
34+ carrier_accounts : [ "ca_1" , "ca_2" ] ,
35+ service : "Priority" ,
36+ carrier : "USPS" ,
37+ } ) ;
38+
39+ console . log ( shipment ) ;
40+ } ) ( ) ;
Original file line number Diff line number Diff line change 1+ const EasyPostClient = require ( "@easypost/api" ) ;
2+
3+ const client = new EasyPostClient ( "EASYPOST_API_KEY" ) ;
4+
5+ ( async ( ) => {
6+ const promise = await client . Shipment . lumaPromise ( {
7+ to_address : {
8+ name : "Dr. Steve Brule" ,
9+ street1 : "5744 Silverton Ave" ,
10+ city : "McKinney" ,
11+ state : "TX" ,
12+ zip : "75070" ,
13+ country : "US" ,
14+ phone : "8573875756" ,
15+ email : "dr_steve_brule@gmail.com" ,
16+ } ,
17+ from_address : {
18+ name : "EasyPost" ,
19+ street1 : "417 Montgomery Street" ,
20+ street2 : "5th Floor" ,
21+ city : "San Francisco" ,
22+ state : "CA" ,
23+ zip : "94104" ,
24+ country : "US" ,
25+ phone : "4153334445" ,
26+ email : "support@easypost.com" ,
27+ } ,
28+ parcel : {
29+ length : 20.2 ,
30+ width : 10.9 ,
31+ height : 5 ,
32+ weight : 65.9 ,
33+ } ,
34+ ruleset_name : "test_ruleset_deliver_by_2" ,
35+ planned_ship_date : "2025-07-03" ,
36+ deliver_by_date : "2025-07-06" ,
37+ } ) ;
38+
39+ console . log ( promise ) ;
40+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments