[{"data":1,"prerenderedAt":827},["ShallowReactive",2],{"header:help":3,"footer:default":67,"story:navigation\u002Fsearch:help":250,"story:help\u002Fcategories":288,"story:help\u002Farticles\u002Fget-live-shipping-rates-with-postmen":314,"no-guide:get-live-shipping-rates-with-postmen":59,"article:\u002Fhelp\u002Farticles\u002Fget-live-shipping-rates-with-postmen":564,"story:contact":582,"help:tree:aaa21cba-6a8c-428b-9839-271c1db2453e":772,"_apollo:default":826},{"name":4,"created_at":5,"published_at":6,"updated_at":7,"id":8,"uuid":9,"content":10,"slug":57,"full_slug":58,"sort_by_date":59,"position":60,"tag_list":61,"is_startpage":24,"parent_id":62,"meta_data":59,"group_id":63,"first_published_at":64,"release_id":59,"lang":65,"path":59,"alternates":66,"default_full_slug":59,"translated_slugs":59},"Help Center Header","2024-08-09T18:06:34.939Z","2024-10-21T21:58:39.217Z","2024-10-21T21:58:39.232Z",10082752,"3e9b88f7-c163-4657-a2f2-62532d600fad",{"_uid":11,"link":12,"badge":16,"items":17,"title":13,"buttons":50,"new_tab":24,"submenu":51,"alignment":13,"component":52,"badge_link":53,"top_menu_items":56},"e5645a1a-f991-40e8-8d67-e40ebc082b5a",{"id":13,"url":13,"linktype":14,"fieldtype":15,"cached_url":13},"","story","multilink","Help Center",[18,27,34,39,44],{"_uid":19,"link":20,"title":23,"new_tab":24,"submenu":25,"component":26},"5cbe2861-1f49-4166-97da-a4dddd8105e3",{"id":21,"url":13,"linktype":14,"fieldtype":15,"cached_url":22},"4c0a2d99-ec30-4579-8ef1-6bf5564d4839","help\u002Fcategories\u002F","Articles",false,[],"header___item",{"_uid":28,"link":29,"title":32,"new_tab":33,"component":26},"1c8edeb5-b9e9-4cb8-b1c6-c1f292f7d7cd",{"id":13,"url":30,"linktype":31,"fieldtype":15,"cached_url":30},"https:\u002F\u002Fwiki.foxycart.com\u002F","url","Documentation",true,{"_uid":35,"link":36,"title":38,"new_tab":33,"component":26},"8d7df70e-f087-4da0-b616-6f0e9a5af35c",{"id":13,"url":37,"linktype":31,"fieldtype":15,"cached_url":37},"https:\u002F\u002Fapi.foxycart.com\u002F","API Documentation",{"_uid":40,"link":41,"title":43,"new_tab":33,"component":26},"f76e7944-23d5-4652-87e4-cdae79272762",{"id":13,"url":42,"linktype":31,"fieldtype":15,"cached_url":42},"https:\u002F\u002Fstatus.foxy.io\u002F","System Status",{"_uid":45,"link":46,"title":49,"new_tab":24,"component":26},"0de16771-4c84-466c-a1da-d8568113c71f",{"id":47,"url":13,"linktype":14,"fieldtype":15,"cached_url":48},"01e4e370-f9b9-45af-8fa9-f15540699b0d","contact","Contact Us",[],[],"header",{"id":54,"url":13,"linktype":14,"fieldtype":15,"cached_url":55},"4a679eb7-662d-4ea4-a976-5a2acbf0b663","help\u002F",[],"help-header","navigation\u002Fhelp-header",null,20,[],10082747,"71b81c2e-5e09-48a1-a397-a3c72fcd344a","2022-09-21T14:50:25.655Z","default",[],{"name":68,"created_at":69,"published_at":70,"updated_at":71,"id":72,"uuid":73,"content":74,"slug":243,"full_slug":244,"sort_by_date":59,"position":245,"tag_list":246,"is_startpage":24,"parent_id":62,"meta_data":59,"group_id":247,"first_published_at":248,"release_id":59,"lang":65,"path":59,"alternates":249,"default_full_slug":59,"translated_slugs":59},"Default Footer","2024-08-09T18:06:59.024Z","2025-09-04T06:24:46.223Z","2025-09-04T06:24:46.241Z",10082753,"e59e67ac-248a-482f-84a1-53d4f318186a",{"_uid":75,"about":76,"logos":77,"socials":82,"sections":108,"component":225,"cta_title":226,"bottom_links":227,"cta_subtitle":241,"cta_button_link":242,"cta_button_text":183},"830983f5-c4c4-43c8-b150-86a5e3fa6dc8","Foxy’s hosted cart & payment page allow you to sell anything, using your existing website or platform.",[78],{"id":79,"alt":13,"name":13,"focus":13,"title":13,"filename":80,"copyright":13,"fieldtype":81},14760,"https:\u002F\u002Fa-us.storyblok.com\u002Ff\u002F1001040\u002Fx\u002F3b030847ec\u002Fb-corp.svg","asset",[83,90,96,102],{"_uid":84,"icon":85,"link":86,"name":88,"component":89},"faf0a618-ea94-42ea-9182-03be18c43216","fa-facebook",{"id":13,"url":87,"linktype":31,"fieldtype":15,"cached_url":87},"https:\u002F\u002Fwww.facebook.com\u002Ffoxycart","Facebook","footer___social",{"_uid":91,"icon":92,"link":93,"name":95,"component":89},"14309c18-7e79-423e-b375-34555bac0811","fa-instagram",{"id":13,"url":94,"linktype":31,"fieldtype":15,"cached_url":94},"https:\u002F\u002Fwww.instagram.com\u002Ffoxy_io","Instagram",{"_uid":97,"icon":98,"link":99,"name":101,"component":89},"8f7fe7cf-0dd3-4596-8334-226ea466716a","fa-linkedin",{"id":13,"url":100,"linktype":31,"fieldtype":15,"cached_url":100},"https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Ffoxycart.com","LinkedIn",{"_uid":103,"icon":104,"link":105,"name":107,"component":89},"90a675b4-dd97-40b5-be09-00a87223d4c5","fa-youtube",{"id":13,"url":106,"linktype":31,"fieldtype":15,"cached_url":106},"https:\u002F\u002Fwww.youtube.com\u002Fuser\u002Ffoxycart","Youtube",[109,139,184,206],{"_uid":110,"name":111,"items":112,"component":138},"82849945-282f-488c-b18d-a8d2252f514a","Company",[113,120,126,132],{"_uid":114,"link":115,"title":118,"new_tab":24,"component":119},"1f699ab1-938b-4d9d-9825-aabcbe6f57fe",{"id":116,"url":13,"linktype":14,"fieldtype":15,"cached_url":117},"63634293-a749-4226-9439-9f38ee6dcda0","about-us","About Us","footer___menu_items",{"_uid":121,"link":122,"title":125,"new_tab":24,"component":119},"b26b00f1-a0e7-4be2-8ab3-428b8cc841f8",{"id":123,"url":13,"linktype":14,"fieldtype":15,"cached_url":124},"26cb7c55-faed-4a77-a291-1552d4111b3e","how-foxy-works","How Foxy Works",{"_uid":127,"link":128,"title":131,"new_tab":24,"component":119},"b40c68a0-1ceb-4226-9515-6176534f61fe",{"id":129,"url":13,"linktype":14,"fieldtype":15,"cached_url":130},"dc6657d7-7f4f-4c0d-b781-e971b038ee26","for-good","Foxy For Good",{"_uid":133,"link":134,"title":137,"new_tab":24,"component":119},"3ad0c134-bef9-4fff-b891-e09f16109036",{"id":135,"url":13,"linktype":14,"fieldtype":15,"cached_url":136},"23cae210-baf4-4588-9862-d09f4f52ccd2","brand-assets","Brand Assets","footer___section",{"_uid":140,"name":141,"items":142,"component":138},"a6805fa8-ac60-47f1-b8f0-f27aded0afbe","Product",[143,149,155,161,167,173,179],{"_uid":144,"link":145,"title":148,"new_tab":24,"component":119},"b39c8a4e-2383-486f-b76a-11fbb15d8134",{"id":146,"url":13,"linktype":14,"fieldtype":15,"cached_url":147},"bb04690f-fe98-4ce6-80be-05b950f2364f","features\u002F","Features",{"_uid":150,"link":151,"title":154,"new_tab":24,"component":119},"64f8a41f-c181-433d-bc0a-fc94e71ecbf6",{"id":152,"url":13,"linktype":14,"fieldtype":15,"cached_url":153},"c450c58d-761d-48c0-a9af-0b064611689b","pricing","Pricing",{"_uid":156,"link":157,"title":160,"new_tab":24,"component":119},"6e0b287f-fd8c-4146-9e0e-0ab0b5c9ce3c",{"id":158,"url":13,"linktype":14,"fieldtype":15,"cached_url":159},"fab20ad9-e76a-4947-b709-3a6fdfa88028","blog\u002Fcategories\u002Fproduct-updates","Product Updates",{"_uid":162,"link":163,"title":166,"new_tab":24,"component":119},"47e5a074-a6b5-4f1c-8c2f-89a2ae9f83eb",{"id":164,"url":13,"linktype":14,"fieldtype":15,"cached_url":165},"d2c83612-d611-47f3-a3b4-ca7fe08540b8","changelogs\u002F","Changelogs",{"_uid":168,"link":169,"title":172,"new_tab":24,"component":119},"b5c08774-542f-4ffd-b357-c94d674488b9",{"id":170,"url":13,"linktype":14,"fieldtype":15,"cached_url":171},"08876121-0df3-4ed9-aa11-902b3e41cd02","whats-next","What's Next",{"_uid":174,"link":175,"title":178,"new_tab":24,"component":119},"9c2704ed-6d9f-43e1-9e67-c8d91c083288",{"id":176,"url":13,"linktype":14,"fieldtype":15,"cached_url":177},"056a7857-b18f-4025-8f97-91a38fc19bc8","compare\u002F","Compare",{"_uid":180,"link":181,"title":183,"new_tab":24,"component":119},"5f2db35b-674b-406a-8fa7-d246633af9fe",{"id":13,"url":182,"linktype":31,"fieldtype":15,"cached_url":182},"https:\u002F\u002Fadmin.foxy.io\u002Fsign-up","Try Foxy Free",{"_uid":185,"name":186,"items":187,"component":138},"63fa1f29-4252-4640-9922-fe310e69e54a","Security",[188,194,200],{"_uid":189,"link":190,"title":193,"new_tab":24,"component":119},"1158ddb6-9eb0-466f-8eb6-7ca2ae66c8b8",{"id":191,"url":13,"linktype":14,"fieldtype":15,"cached_url":192},"1f58fb2c-8681-4742-b6e8-09999beae9f6","security-contact","Security Contact",{"_uid":195,"link":196,"title":199,"new_tab":24,"component":119},"9a79c54a-6022-4dfd-854b-766f5e4703ba",{"id":197,"url":13,"linktype":14,"fieldtype":15,"cached_url":198},"55cbfcc3-425a-4261-8037-54e919851d2d","pci","PCI Compliance",{"_uid":201,"link":202,"title":205,"new_tab":24,"component":119},"0b85f5b6-9534-4071-b323-b39d053dd4d7",{"id":203,"url":13,"linktype":14,"fieldtype":15,"cached_url":204},"c3ac0fe3-83e2-4879-afbd-d4c83e1590df","help\u002Farticles\u002Four-official-domains-public-code","Domains & Codebases",{"_uid":207,"name":208,"items":209,"component":138},"998ded67-d107-49f4-8154-ca6be51671ec","Support",[210,213,216,219,222],{"_uid":211,"link":212,"title":16,"new_tab":24,"component":119},"594ffd35-3049-4004-bb08-0db568ebd819",{"id":54,"url":13,"linktype":14,"fieldtype":15,"cached_url":55},{"_uid":214,"link":215,"title":32,"new_tab":33,"component":119},"0a1a55ab-a985-4f9d-8b42-26da714d0c1c",{"id":13,"url":30,"linktype":31,"fieldtype":15,"cached_url":30},{"_uid":217,"link":218,"title":38,"new_tab":33,"component":119},"61e0b7c8-aadf-419b-a339-b3ccabc65bf4",{"id":13,"url":37,"linktype":31,"fieldtype":15,"cached_url":37},{"_uid":220,"link":221,"title":43,"new_tab":33,"component":119},"fd67a89e-1c54-4d31-94b5-64be999062d6",{"id":13,"url":42,"linktype":31,"fieldtype":15,"cached_url":42},{"_uid":223,"link":224,"title":49,"new_tab":24,"component":119},"231a6f71-e996-4ad4-b033-d4d5542f34f0",{"id":47,"url":13,"linktype":14,"fieldtype":15,"cached_url":48},"footer","Get started with our *unlimited free trial*.",[228,235],{"_uid":229,"link":230,"text":233,"component":234},"f0b77210-2632-45a2-8436-e57cad84d01a",{"id":231,"url":13,"linktype":14,"fieldtype":15,"cached_url":232},"60ba16a2-c1f4-485f-b978-8d2eeeafbf5a","terms-of-service","Terms of Service","footer___bottom_links",{"_uid":236,"link":237,"text":240,"component":234},"4bd497b0-993f-4b4d-a5b7-8a49c7c8fec9",{"id":238,"url":13,"linktype":14,"fieldtype":15,"cached_url":239},"332302b9-1d18-4016-b9c8-9b33c72d782b","privacy-policy","Privacy Policy","No credit card required.",{"id":13,"url":182,"linktype":31,"fieldtype":15,"cached_url":182},"default-footer","navigation\u002Fdefault-footer",50,[],"11006268-07f9-41e9-96f3-c51fb723399d","2022-09-21T20:39:02.357Z",[],{"name":251,"created_at":252,"published_at":253,"updated_at":254,"id":255,"uuid":256,"content":257,"slug":279,"full_slug":282,"sort_by_date":59,"position":283,"tag_list":284,"is_startpage":24,"parent_id":62,"meta_data":59,"group_id":285,"first_published_at":286,"release_id":59,"lang":65,"path":59,"alternates":287,"default_full_slug":59,"translated_slugs":59},"Search","2024-10-21T22:08:54.973Z","2025-05-26T09:17:25.790Z","2025-05-26T09:17:25.804Z",13592003,"14cbc359-9ac1-4a7a-a8de-ad4ac8ef26d4",{"_uid":258,"name":251,"indices":259,"summary":13,"component":279,"primary_image":280},"5e4a56e8-76f1-4790-b3a7-70f1be97d042",[260,265,269,274],{"key":261,"_uid":262,"icon":13,"name":263,"component":264},"all","c12a3210-7323-4273-8217-5215e52efe84","All","index",{"key":266,"_uid":267,"icon":268,"name":23,"component":264},"help_center_article","5acff080-95e4-44d3-8dcf-1b19720af382","fa-file-alt",{"key":270,"_uid":271,"icon":272,"name":273,"component":264},"help_center_guide","b8fbc206-c083-471e-a1f0-0ebeb90a669d","fa-book","Guides",{"key":275,"_uid":276,"icon":277,"name":278,"component":264},"blog_post","23419e83-2e56-4c4c-8a05-9fd1b3c9a9bd","fa-file-image","Blog Posts","search",{"id":59,"alt":59,"name":13,"focus":59,"title":59,"source":59,"filename":13,"copyright":59,"fieldtype":81,"meta_data":281},{},"navigation\u002Fsearch",60,[],"11e1fd31-95cd-4fc9-b736-8b8910663e6c","2024-10-21T23:17:05.904Z",[],{"name":23,"created_at":289,"published_at":290,"updated_at":291,"id":292,"uuid":21,"content":293,"slug":307,"full_slug":22,"sort_by_date":59,"position":308,"tag_list":309,"is_startpage":33,"parent_id":310,"meta_data":59,"group_id":311,"first_published_at":312,"release_id":59,"lang":65,"path":59,"alternates":313,"default_full_slug":59,"translated_slugs":59},"2022-09-19T14:42:29.685Z","2024-07-30T18:17:22.506Z","2024-07-30T18:17:22.525Z",2660,{"_uid":294,"icon":13,"name":23,"guides":295,"pinned":24,"summary":296,"category":13,"component":297,"blog_posts":298,"content_hub":24,"icon_custom":299,"case_studies":300,"faq_sections":301,"help_articles":302,"featured_guides":303,"mailbox_category":13,"featured_articles":304,"featured_blog_posts":305,"featured_case_studies":306},"d6dae89a-907a-4bf7-82de-fe2ba875ee6e",[],"Get your questions answered with our browsable knowledge base.","help_center_category",[],{"id":59,"alt":59,"name":13,"focus":59,"title":59,"filename":13,"copyright":59,"fieldtype":81},[],[],[],[],[],[],[],"categories",530,[],2658,"19ebcdd2-027f-47f5-9a5b-a8992c959578","2022-09-19T16:24:39.219Z",[],{"name":315,"created_at":316,"published_at":317,"updated_at":318,"id":319,"uuid":320,"content":321,"slug":557,"full_slug":558,"sort_by_date":59,"position":559,"tag_list":560,"is_startpage":24,"parent_id":561,"meta_data":59,"group_id":562,"first_published_at":317,"release_id":59,"lang":65,"path":59,"alternates":563,"default_full_slug":59,"translated_slugs":59},"Get Live Shipping Rates with Postmen","2026-06-08T21:12:53.444Z","2026-06-24T15:27:12.686Z","2026-06-24T15:27:12.731Z",185399596876982,"aaa21cba-6a8c-428b-9839-271c1db2453e",{"_uid":322,"body":323,"name":315,"image":552,"pinned":24,"summary":554,"category":555,"component":266,"related_articles":556},"b555f986-9b08-4e37-88c7-ed2a9ad8a460",{"type":324,"content":325},"doc",[326,334,340,345,350,401,406,418,424,429,520,525,539],{"type":327,"attrs":328,"content":330},"heading",{"level":329,"textAlign":59},2,[331],{"text":332,"type":333},"Overview","text",{"type":335,"attrs":336,"content":337},"paragraph",{"textAlign":59},[338],{"text":339,"type":333},"Postmen (by AfterShip) returns rates from multiple carriers through one API. If you need rates from carriers that Foxy does not natively support, you can fetch them from your Postmen account using Foxy's Custom Shipping Code feature. This article shows you the code to connect to Postmen and how to install it on your store.",{"type":327,"attrs":341,"content":342},{"level":329,"textAlign":59},[343],{"text":344,"type":333},"Before You Start",{"type":335,"attrs":346,"content":347},{"textAlign":59},[348],{"text":349,"type":333},"You will need:",{"type":351,"content":352},"bullet_list",[353,361,368,386],{"type":354,"content":355},"list_item",[356],{"type":335,"attrs":357,"content":358},{"textAlign":59},[359],{"text":360,"type":333},"A Postmen account with an API key. Postmen provides separate Production and Testing keys; pick the one that matches the environment you want.",{"type":354,"content":362},[363],{"type":335,"attrs":364,"content":365},{"textAlign":59},[366],{"text":367,"type":333},"One or more shipper accounts created in Postmen (Postmen dashboard, under Shipper Accounts). Make sure they belong to the same environment (Production or Testing) as your API key.",{"type":354,"content":369},[370],{"type":335,"attrs":371,"content":372},{"textAlign":59},[373,375,384],{"text":374,"type":333},"Custom Shipping Code enabled on your store. See ",{"text":376,"type":333,"marks":377},"Add Custom Shipping Code",[378],{"type":379,"attrs":380},"link",{"href":381,"uuid":382,"anchor":59,"target":383,"linktype":14},"\u002Fhelp\u002Farticles\u002Fadd-custom-shipping-code","bfd72855-b922-47e8-bd7d-5d43162103db","_self",{"text":385,"type":333},".",{"type":354,"content":387},[388],{"type":335,"attrs":389,"content":390},{"textAlign":59},[391,393,400],{"text":392,"type":333},"At least one product category set to a delivery type of \"Shipped using live shipping rates\". See ",{"text":394,"type":333,"marks":395},"Shipping and Categories",[396],{"type":379,"attrs":397},{"href":398,"uuid":399,"anchor":59,"target":383,"linktype":14},"\u002Fhelp\u002Farticles\u002Fshipping-and-categories","b7d2c21b-aa39-4e1f-aea1-4a57bb102f35",{"text":385,"type":333},{"type":327,"attrs":402,"content":403},{"level":329,"textAlign":59},[404],{"text":405,"type":333},"The Shipping Code",{"type":335,"attrs":407,"content":408},{"textAlign":59},[409,411,416],{"text":410,"type":333},"This code builds a rate request from the cart payload, loops the cart items into the parcel, posts the request to the Postmen rates endpoint, then adds each returned rate to the cart. Postmen expects 3 letter (ISO 3166 alpha 3) country codes, so the included ",{"text":412,"type":333,"marks":413},"country_to_3",[414],{"type":415},"code",{"text":417,"type":333}," helper converts Foxy's 2 letter codes. Set the options at the top to match your account and packaging.",{"type":419,"attrs":420,"content":421},"code_block",{"class":59},[422],{"text":423,"type":333},"\u002F\u002F Set to the API key of your Postmen account\nlet api_key = 'YOUR-POSTMEN-API-KEY';\n\u002F\u002F Set to false to use test shipper accounts\nlet is_production = true;\n\u002F\u002F Shipper accounts\nlet shipper_accounts = [\n    { 'id': 'SHIPPER-ACCOUNT-ID-1' },\n    { 'id': 'SHIPPER-ACCOUNT-ID-2' }\n];\n\u002F\u002F Weight units for the store ('lb' or 'kg')\nlet weight_unit = 'lb';\n\u002F\u002F Length units for the store ('in' or 'cm')\nlet length_unit = 'in';\n\u002F\u002F Parcel dimensions\nlet parcel_width = 20,\n    parcel_height = 10,\n    parcel_depth = 10;\n\n\n\nconst shipment = cart['_embedded']['fx:shipment'];\n\nlet payload = {\n    'async': false,\n    'shipper_accounts': shipper_accounts,\n    'shipment': {\n        'parcels': [\n            {\n                'box_type': 'custom',\n                'weight': {\n                    'value': shipment['total_weight'],\n                    'unit': weight_unit\n                },\n                'dimension': {\n                    'width': parcel_width,\n                    'height': parcel_height,\n                    'depth': parcel_depth,\n                    'unit': length_unit\n                },\n                'items': [\n                    \u002F\u002F Populated below\n                ]\n            }\n        ],\n        'ship_from': {\n            'state': shipment['origin_region'],\n            'postal_code': shipment['origin_postal_code'],\n            'country': country_to_3(shipment['origin_country']),\n        },\n        'ship_to': {\n            \u002F\u002F Populated below\n            'country': country_to_3(shipment['country']),\n            'type': shipment['is_residential'] ? 'residential' : 'business'\n        }\n    },\n    'is_document': false\n};\n\n\u002F\u002F Ship to address\nif (shipment['first_name']) {\n    payload.shipment.ship_to['contact_name'] = shipment['first_name'] + \" \" + shipment['last_name'];\n}\nif (shipment['address1']) {\n    payload.shipment.ship_to['street1'] = shipment['address1'];\n}\nif (shipment['city']) {\n    payload.shipment.ship_to['city'] = shipment['city'];\n}\nif (shipment['region']) {\n    payload.shipment.ship_to['state'] = shipment['region'];\n}\nif (shipment['postal_code']) {\n    payload.shipment.ship_to['postal_code'] = shipment['postal_code'];\n}\n\n\u002F\u002F Items\nfor (let p in cart['_embedded']['fx:items']) {\n    let item = cart['_embedded']['fx:items'][p];\n\n    let item_details = {\n        'description': item.name,\n        'quantity': item.quantity,\n        'price': {\n            'amount': item.price,\n            'currency': cart.currency_code\n        },\n        'weight': {\n            'value': item.weight,\n            'unit': weight_unit\n        }\n    }\n\n    if (item.sku) {\n        item_details['sku'] = item.code\n    }\n\n    payload.shipment.parcels[0].items.push(item_details);\n}\n\ntry {\n    const endpoint = is_production ? 'https:\u002F\u002Fproduction-api.postmen.com\u002Fv3' : 'https:\u002F\u002Fsandbox-api.postmen.com\u002Fv3'\n    const response = await fetch(endpoint + '\u002Frates', {\n        method: 'POST',\n        body: JSON.stringify(payload),\n        headers: {\n            \"postmen-api-key\": api_key,\n            \"Content-Type\": \"application\u002Fjson\"\n        }\n    });\n    const data = await response.json();\n\n    if (data.meta.code != 200) {\n        console.log(data.meta)\n    }\n\n    for (let r = 0; r \u003C data.data.rates.length; r++) {\n        const rate = data.data.rates[r];\n\n        if (rate.service_name) {\n            rates.add(10000+r, rate.total_charge.amount, '', rate.service_name);\n        } else if (rate.error_message) {\n            console.log(rate.error_message);\n        }\n    }\n} catch(err) {\n  console.log(err);\n}\n\nfunction country_to_3(country) {\n    const iso3166_3 = {\n        AF: 'AFG', AX: 'ALA', AL: 'ALB', DZ: 'DZA', AS: 'ASM', AD: 'AND', AO: 'AGO', AI: 'AIA', AQ: 'ATA', AG: 'ATG', AR: 'ARG', AM: 'ARM', AW: 'ABW', AU: 'AUS', AT: 'AUT', AZ: 'AZE', BS: 'BHS', BH: 'BHR', BD: 'BGD', BB: 'BRB', BY: 'BLR', BE: 'BEL', BZ: 'BLZ', BJ: 'BEN', BM: 'BMU', BT: 'BTN', BO: 'BOL', BA: 'BIH', BW: 'BWA', BV: 'BVT', BR: 'BRA', VG: 'VGB', IO: 'IOT', BN: 'BRN', BG: 'BGR', BF: 'BFA', BI: 'BDI', KH: 'KHM', CM: 'CMR', CA: 'CAN', CV: 'CPV', KY: 'CYM', CF: 'CAF', TD: 'TCD', CL: 'CHL', CN: 'CHN', HK: 'HKG', MO: 'MAC', CX: 'CXR', CC: 'CCK', CO: 'COL', KM: 'COM', CG: 'COG', CD: 'COD', CK: 'COK', CR: 'CRI', CI: 'CIV', HR: 'HRV', CU: 'CUB', CY: 'CYP', CZ: 'CZE', DK: 'DNK', DJ: 'DJI', DM: 'DMA', DO: 'DOM', EC: 'ECU', EG: 'EGY', SV: 'SLV', GQ: 'GNQ', ER: 'ERI', EE: 'EST', ET: 'ETH', FK: 'FLK', FO: 'FRO', FJ: 'FJI', FI: 'FIN', FR: 'FRA', GF: 'GUF', PF: 'PYF', TF: 'ATF', GA: 'GAB', GM: 'GMB', GE: 'GEO', DE: 'DEU', GH: 'GHA', GI: 'GIB', GR: 'GRC', GL: 'GRL', GD: 'GRD', GP: 'GLP', GU: 'GUM', GT: 'GTM', GG: 'GGY', GN: 'GIN', GW: 'GNB', GY: 'GUY', HT: 'HTI', HM: 'HMD', VA: 'VAT', HN: 'HND', HU: 'HUN', IS: 'ISL', IN: 'IND', ID: 'IDN', IR: 'IRN', IQ: 'IRQ', IE: 'IRL', IM: 'IMN', IL: 'ISR', IT: 'ITA', JM: 'JAM', JP: 'JPN', JE: 'JEY', JO: 'JOR', KZ: 'KAZ', KE: 'KEN', KI: 'KIR', KP: 'PRK', KR: 'KOR', KW: 'KWT', KG: 'KGZ', LA: 'LAO', LV: 'LVA', LB: 'LBN', LS: 'LSO', LR: 'LBR', LY: 'LBY', LI: 'LIE', LT: 'LTU', LU: 'LUX', MK: 'MKD', MG: 'MDG', MW: 'MWI', MY: 'MYS', MV: 'MDV', ML: 'MLI', MT: 'MLT', MH: 'MHL', MQ: 'MTQ', MR: 'MRT', MU: 'MUS', YT: 'MYT', MX: 'MEX', FM: 'FSM', MD: 'MDA', MC: 'MCO', MN: 'MNG', ME: 'MNE', MS: 'MSR', MA: 'MAR', MZ: 'MOZ', MM: 'MMR', NA: 'NAM', NR: 'NRU', NP: 'NPL', NL: 'NLD', AN: 'ANT', NC: 'NCL', NZ: 'NZL', NI: 'NIC', NE: 'NER', NG: 'NGA', NU: 'NIU', NF: 'NFK', MP: 'MNP', NO: 'NOR', OM: 'OMN', PK: 'PAK', PW: 'PLW', PS: 'PSE', PA: 'PAN', PG: 'PNG', PY: 'PRY', PE: 'PER', PH: 'PHL', PN: 'PCN', PL: 'POL', PT: 'PRT', PR: 'PRI', QA: 'QAT', RE: 'REU', RO: 'ROU', RU: 'RUS', RW: 'RWA', BL: 'BLM', SH: 'SHN', KN: 'KNA', LC: 'LCA', MF: 'MAF', PM: 'SPM', VC: 'VCT', WS: 'WSM', SM: 'SMR', ST: 'STP', SA: 'SAU', SN: 'SEN', RS: 'SRB', SC: 'SYC', SL: 'SLE', SG: 'SGP', SK: 'SVK', SI: 'SVN', SB: 'SLB', SO: 'SOM', ZA: 'ZAF', GS: 'SGS', SS: 'SSD', ES: 'ESP', LK: 'LKA', SD: 'SDN', SR: 'SUR', SJ: 'SJM', SZ: 'SWZ', SE: 'SWE', CH: 'CHE', SY: 'SYR', TW: 'TWN', TJ: 'TJK', TZ: 'TZA', TH: 'THA', TL: 'TLS', TG: 'TGO', TK: 'TKL', TO: 'TON', TT: 'TTO', TN: 'TUN', TR: 'TUR', TM: 'TKM', TC: 'TCA', TV: 'TUV', UG: 'UGA', UA: 'UKR', AE: 'ARE', GB: 'GBR', US: 'USA', UM: 'UMI', UY: 'URY', UZ: 'UZB', VU: 'VUT', VE: 'VEN', VN: 'VNM', VI: 'VIR', WF: 'WLF', EH: 'ESH', YE: 'YEM', ZM: 'ZMB', ZW: 'ZWE', XK: 'XKX'\n    };\n\n    return iso3166_3[country];\n}",{"type":327,"attrs":425,"content":426},{"level":329,"textAlign":59},[427],{"text":428,"type":333},"Install the Integration",{"type":430,"attrs":431,"content":433},"ordered_list",{"order":432},1,[434,441,448,455,468,486,499,506,513],{"type":354,"content":435},[436],{"type":335,"attrs":437,"content":438},{"textAlign":59},[439],{"text":440,"type":333},"In the Foxy admin (admin.foxy.io), open the shipping settings for your store, scroll to Custom Shipping Code, and enable \"use custom code\".",{"type":354,"content":442},[443],{"type":335,"attrs":444,"content":445},{"textAlign":59},[446],{"text":447,"type":333},"In the code editor that appears, paste the code above. Do not save it yet.",{"type":354,"content":449},[450],{"type":335,"attrs":451,"content":452},{"textAlign":59},[453],{"text":454,"type":333},"In a new tab, log in to your Postmen account and go to the API keys section. Under Tokens, click \"Add new api key\" and complete the form.",{"type":354,"content":456},[457],{"type":335,"attrs":458,"content":459},{"textAlign":59},[460,462,466],{"text":461,"type":333},"Copy the generated API key from the Production or Testing tab (depending which type you created), then replace ",{"text":463,"type":333,"marks":464},"YOUR-POSTMEN-API-KEY",[465],{"type":415},{"text":467,"type":333}," in the code with it.",{"type":354,"content":469},[470],{"type":335,"attrs":471,"content":472},{"textAlign":59},[473,475,479,481,485],{"text":474,"type":333},"If you are using a Testing key, set ",{"text":476,"type":333,"marks":477},"is_production",[478],{"type":415},{"text":480,"type":333}," to ",{"text":482,"type":333,"marks":483},"false",[484],{"type":415},{"text":385,"type":333},{"type":354,"content":487},[488],{"type":335,"attrs":489,"content":490},{"textAlign":59},[491,493,497],{"text":492,"type":333},"Update the ",{"text":494,"type":333,"marks":495},"shipper_accounts",[496],{"type":415},{"text":498,"type":333}," array to list every shipper account you want to request rates from. Shipper accounts are created in Postmen under Shipper Accounts. Make sure they match the environment (Production or Testing) of your key.",{"type":354,"content":500},[501],{"type":335,"attrs":502,"content":503},{"textAlign":59},[504],{"text":505,"type":333},"Configure the weight unit, length unit, and parcel dimensions to match your shipments.",{"type":354,"content":507},[508],{"type":335,"attrs":509,"content":510},{"textAlign":59},[511],{"text":512,"type":333},"Save your settings. Wait roughly 10 to 15 seconds, then refresh the page. If the save was successful, you will see your code again after refreshing.",{"type":354,"content":514},[515],{"type":335,"attrs":516,"content":517},{"textAlign":59},[518],{"text":519,"type":333},"Test it. Add a product from a live rate shippable category to your cart, then enter a shipping address on the cart or checkout. You should see rates returning from your Postmen account.",{"type":327,"attrs":521,"content":522},{"level":329,"textAlign":59},[523],{"text":524,"type":333},"Customize the Integration",{"type":335,"attrs":526,"content":527},{"textAlign":59},[528,530,537],{"text":529,"type":333},"This is a basic setup. It returns every rate from Postmen and passes default values for the parcel. See the Postmen documentation on rate requests to customize the request further, and the ",{"text":531,"type":333,"marks":532},"Custom Shipping Code API Reference",[533],{"type":379,"attrs":534},{"href":535,"uuid":536,"anchor":59,"target":383,"linktype":14},"\u002Fhelp\u002Farticles\u002Fcustom-shipping-code-api-reference","7b057a6e-5277-42ef-8c0e-946e72139991",{"text":538,"type":333}," to output only specific rates or work with them further.",{"type":335,"attrs":540,"content":541},{"textAlign":59},[542,544,551],{"text":543,"type":333},"Rates from custom shipping code are not currency converted by Foxy. For non USD stores, set the rate values in the cart's currency yourself. See ",{"text":545,"type":333,"marks":546},"Shipping Currency Conversion",[547],{"type":379,"attrs":548},{"href":549,"uuid":550,"anchor":59,"target":383,"linktype":14},"\u002Fhelp\u002Farticles\u002Fshipping-currency-conversion","7c7777a7-e9ec-4bec-8321-501eb979d2d7",{"text":385,"type":333},{"id":59,"alt":59,"name":13,"focus":59,"title":59,"source":59,"filename":13,"copyright":59,"fieldtype":81,"meta_data":553},{},"Connect your Postmen account to your Foxy store with the Custom Shipping Code feature to fetch live rates from Postmen's supported carriers at checkout.","621d64cc-1acf-415b-9dd9-0492d1a683bf",[],"get-live-shipping-rates-with-postmen","help\u002Farticles\u002Fget-live-shipping-rates-with-postmen",-2040,[],2659,"7ed94872-9644-491e-a811-478d04c51809",[],{"html":565,"sections":566,"segments":578},"\u003Csection id=\"overview\" data-title=\"Overview\" data-title-node=\"H2\">\u003Chr class=\"my-8\" style=\"margin-left: -48px; margin-right: -40vw\">\u003Ch2 data-anchor-id=\"overview\">Overview\u003C\u002Fh2>\u003Cp>Postmen (by AfterShip) returns rates from multiple carriers through one API. If you need rates from carriers that Foxy does not natively support, you can fetch them from your Postmen account using Foxy&#039;s Custom Shipping Code feature. This article shows you the code to connect to Postmen and how to install it on your store.\u003C\u002Fp>\u003C\u002Fsection>\u003Csection id=\"before-you-start\" data-title=\"Before You Start\" data-title-node=\"H2\">\u003Chr class=\"my-8\" style=\"margin-left: -48px; margin-right: -40vw\">\u003Ch2 data-anchor-id=\"before-you-start\">Before You Start\u003C\u002Fh2>\u003Cp>You will need:\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>A Postmen account with an API key. Postmen provides separate Production and Testing keys; pick the one that matches the environment you want.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>One or more shipper accounts created in Postmen (Postmen dashboard, under Shipper Accounts). Make sure they belong to the same environment (Production or Testing) as your API key.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>Custom Shipping Code enabled on your store. See \u003Ca href=\"\u002Fhelp\u002Farticles\u002Fadd-custom-shipping-code\" target=\"_self\">Add Custom Shipping Code\u003C\u002Fa>.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>At least one product category set to a delivery type of &quot;Shipped using live shipping rates&quot;. See \u003Ca href=\"\u002Fhelp\u002Farticles\u002Fshipping-and-categories\" target=\"_self\">Shipping and Categories\u003C\u002Fa>.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003C\u002Fsection>\u003Csection id=\"the-shipping-code\" data-title=\"The Shipping Code\" data-title-node=\"H2\">\u003Chr class=\"my-8\" style=\"margin-left: -48px; margin-right: -40vw\">\u003Ch2 data-anchor-id=\"the-shipping-code\">The Shipping Code\u003C\u002Fh2>\u003Cp>This code builds a rate request from the cart payload, loops the cart items into the parcel, posts the request to the Postmen rates endpoint, then adds each returned rate to the cart. Postmen expects 3 letter (ISO 3166 alpha 3) country codes, so the included \u003Ccode class=\"badge bg-soft-danger text-danger\">country_to_3\u003C\u002Fcode> helper converts Foxy&#039;s 2 letter codes. Set the options at the top to match your account and packaging.\u003C\u002Fp>\u003Cdiv class=\"position-relative w-100 overflow-hidden rounded-2\" data-code-block>\u003Cdiv class=\"d-flex justify-content-end border-bottom\" style=\"background:#2b2c3b;\">\u003Cbutton type=\"button\" class=\"btn btn-link btn-sm text-light\" title=\"Copy\" data-code-button>\u003Cspan data-code-default style=\"\">\u003Ci class=\"fal fa-copy me-2\">\u003C\u002Fi> Copy \u003C\u002Fspan>\u003Cspan class=\"text-success\" data-code-success style=\"display:none;\">\u003Ci class=\"fal fa-check ms-2\">\u003C\u002Fi> Copied \u003C\u002Fspan>\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cdiv class=\"small\">\u003Cpre class=\"hljs p-2\" data-code-content>\u002F\u002F Set to the API key of your Postmen account\nlet api_key = &#x27;YOUR-POSTMEN-API-KEY&#x27;;\n\u002F\u002F Set to false to use test shipper accounts\nlet is_production = true;\n\u002F\u002F Shipper accounts\nlet shipper_accounts = [\n    { &#x27;id&#x27;: &#x27;SHIPPER-ACCOUNT-ID-1&#x27; },\n    { &#x27;id&#x27;: &#x27;SHIPPER-ACCOUNT-ID-2&#x27; }\n];\n\u002F\u002F Weight units for the store (&#x27;lb&#x27; or &#x27;kg&#x27;)\nlet weight_unit = &#x27;lb&#x27;;\n\u002F\u002F Length units for the store (&#x27;in&#x27; or &#x27;cm&#x27;)\nlet length_unit = &#x27;in&#x27;;\n\u002F\u002F Parcel dimensions\nlet parcel_width = 20,\n    parcel_height = 10,\n    parcel_depth = 10;\n\n\n\nconst shipment = cart[&#x27;_embedded&#x27;][&#x27;fx:shipment&#x27;];\n\nlet payload = {\n    &#x27;async&#x27;: false,\n    &#x27;shipper_accounts&#x27;: shipper_accounts,\n    &#x27;shipment&#x27;: {\n        &#x27;parcels&#x27;: [\n            {\n                &#x27;box_type&#x27;: &#x27;custom&#x27;,\n                &#x27;weight&#x27;: {\n                    &#x27;value&#x27;: shipment[&#x27;total_weight&#x27;],\n                    &#x27;unit&#x27;: weight_unit\n                },\n                &#x27;dimension&#x27;: {\n                    &#x27;width&#x27;: parcel_width,\n                    &#x27;height&#x27;: parcel_height,\n                    &#x27;depth&#x27;: parcel_depth,\n                    &#x27;unit&#x27;: length_unit\n                },\n                &#x27;items&#x27;: [\n                    \u002F\u002F Populated below\n                ]\n            }\n        ],\n        &#x27;ship_from&#x27;: {\n            &#x27;state&#x27;: shipment[&#x27;origin_region&#x27;],\n            &#x27;postal_code&#x27;: shipment[&#x27;origin_postal_code&#x27;],\n            &#x27;country&#x27;: country_to_3(shipment[&#x27;origin_country&#x27;]),\n        },\n        &#x27;ship_to&#x27;: {\n            \u002F\u002F Populated below\n            &#x27;country&#x27;: country_to_3(shipment[&#x27;country&#x27;]),\n            &#x27;type&#x27;: shipment[&#x27;is_residential&#x27;] ? &#x27;residential&#x27; : &#x27;business&#x27;\n        }\n    },\n    &#x27;is_document&#x27;: false\n};\n\n\u002F\u002F Ship to address\nif (shipment[&#x27;first_name&#x27;]) {\n    payload.shipment.ship_to[&#x27;contact_name&#x27;] = shipment[&#x27;first_name&#x27;] + &quot; &quot; + shipment[&#x27;last_name&#x27;];\n}\nif (shipment[&#x27;address1&#x27;]) {\n    payload.shipment.ship_to[&#x27;street1&#x27;] = shipment[&#x27;address1&#x27;];\n}\nif (shipment[&#x27;city&#x27;]) {\n    payload.shipment.ship_to[&#x27;city&#x27;] = shipment[&#x27;city&#x27;];\n}\nif (shipment[&#x27;region&#x27;]) {\n    payload.shipment.ship_to[&#x27;state&#x27;] = shipment[&#x27;region&#x27;];\n}\nif (shipment[&#x27;postal_code&#x27;]) {\n    payload.shipment.ship_to[&#x27;postal_code&#x27;] = shipment[&#x27;postal_code&#x27;];\n}\n\n\u002F\u002F Items\nfor (let p in cart[&#x27;_embedded&#x27;][&#x27;fx:items&#x27;]) {\n    let item = cart[&#x27;_embedded&#x27;][&#x27;fx:items&#x27;][p];\n\n    let item_details = {\n        &#x27;description&#x27;: item.name,\n        &#x27;quantity&#x27;: item.quantity,\n        &#x27;price&#x27;: {\n            &#x27;amount&#x27;: item.price,\n            &#x27;currency&#x27;: cart.currency_code\n        },\n        &#x27;weight&#x27;: {\n            &#x27;value&#x27;: item.weight,\n            &#x27;unit&#x27;: weight_unit\n        }\n    }\n\n    if (item.sku) {\n        item_details[&#x27;sku&#x27;] = item.code\n    }\n\n    payload.shipment.parcels[0].items.push(item_details);\n}\n\ntry {\n    const endpoint = is_production ? &#x27;https:\u002F\u002Fproduction-api.postmen.com\u002Fv3&#x27; : &#x27;https:\u002F\u002Fsandbox-api.postmen.com\u002Fv3&#x27;\n    const response = await fetch(endpoint + &#x27;\u002Frates&#x27;, {\n        method: &#x27;POST&#x27;,\n        body: JSON.stringify(payload),\n        headers: {\n            &quot;postmen-api-key&quot;: api_key,\n            &quot;Content-Type&quot;: &quot;application\u002Fjson&quot;\n        }\n    });\n    const data = await response.json();\n\n    if (data.meta.code != 200) {\n        console.log(data.meta)\n    }\n\n    for (let r = 0; r &lt; data.data.rates.length; r++) {\n        const rate = data.data.rates[r];\n\n        if (rate.service_name) {\n            rates.add(10000+r, rate.total_charge.amount, &#x27;&#x27;, rate.service_name);\n        } else if (rate.error_message) {\n            console.log(rate.error_message);\n        }\n    }\n} catch(err) {\n  console.log(err);\n}\n\nfunction country_to_3(country) {\n    const iso3166_3 = {\n        AF: &#x27;AFG&#x27;, AX: &#x27;ALA&#x27;, AL: &#x27;ALB&#x27;, DZ: &#x27;DZA&#x27;, AS: &#x27;ASM&#x27;, AD: &#x27;AND&#x27;, AO: &#x27;AGO&#x27;, AI: &#x27;AIA&#x27;, AQ: &#x27;ATA&#x27;, AG: &#x27;ATG&#x27;, AR: &#x27;ARG&#x27;, AM: &#x27;ARM&#x27;, AW: &#x27;ABW&#x27;, AU: &#x27;AUS&#x27;, AT: &#x27;AUT&#x27;, AZ: &#x27;AZE&#x27;, BS: &#x27;BHS&#x27;, BH: &#x27;BHR&#x27;, BD: &#x27;BGD&#x27;, BB: &#x27;BRB&#x27;, BY: &#x27;BLR&#x27;, BE: &#x27;BEL&#x27;, BZ: &#x27;BLZ&#x27;, BJ: &#x27;BEN&#x27;, BM: &#x27;BMU&#x27;, BT: &#x27;BTN&#x27;, BO: &#x27;BOL&#x27;, BA: &#x27;BIH&#x27;, BW: &#x27;BWA&#x27;, BV: &#x27;BVT&#x27;, BR: &#x27;BRA&#x27;, VG: &#x27;VGB&#x27;, IO: &#x27;IOT&#x27;, BN: &#x27;BRN&#x27;, BG: &#x27;BGR&#x27;, BF: &#x27;BFA&#x27;, BI: &#x27;BDI&#x27;, KH: &#x27;KHM&#x27;, CM: &#x27;CMR&#x27;, CA: &#x27;CAN&#x27;, CV: &#x27;CPV&#x27;, KY: &#x27;CYM&#x27;, CF: &#x27;CAF&#x27;, TD: &#x27;TCD&#x27;, CL: &#x27;CHL&#x27;, CN: &#x27;CHN&#x27;, HK: &#x27;HKG&#x27;, MO: &#x27;MAC&#x27;, CX: &#x27;CXR&#x27;, CC: &#x27;CCK&#x27;, CO: &#x27;COL&#x27;, KM: &#x27;COM&#x27;, CG: &#x27;COG&#x27;, CD: &#x27;COD&#x27;, CK: &#x27;COK&#x27;, CR: &#x27;CRI&#x27;, CI: &#x27;CIV&#x27;, HR: &#x27;HRV&#x27;, CU: &#x27;CUB&#x27;, CY: &#x27;CYP&#x27;, CZ: &#x27;CZE&#x27;, DK: &#x27;DNK&#x27;, DJ: &#x27;DJI&#x27;, DM: &#x27;DMA&#x27;, DO: &#x27;DOM&#x27;, EC: &#x27;ECU&#x27;, EG: &#x27;EGY&#x27;, SV: &#x27;SLV&#x27;, GQ: &#x27;GNQ&#x27;, ER: &#x27;ERI&#x27;, EE: &#x27;EST&#x27;, ET: &#x27;ETH&#x27;, FK: &#x27;FLK&#x27;, FO: &#x27;FRO&#x27;, FJ: &#x27;FJI&#x27;, FI: &#x27;FIN&#x27;, FR: &#x27;FRA&#x27;, GF: &#x27;GUF&#x27;, PF: &#x27;PYF&#x27;, TF: &#x27;ATF&#x27;, GA: &#x27;GAB&#x27;, GM: &#x27;GMB&#x27;, GE: &#x27;GEO&#x27;, DE: &#x27;DEU&#x27;, GH: &#x27;GHA&#x27;, GI: &#x27;GIB&#x27;, GR: &#x27;GRC&#x27;, GL: &#x27;GRL&#x27;, GD: &#x27;GRD&#x27;, GP: &#x27;GLP&#x27;, GU: &#x27;GUM&#x27;, GT: &#x27;GTM&#x27;, GG: &#x27;GGY&#x27;, GN: &#x27;GIN&#x27;, GW: &#x27;GNB&#x27;, GY: &#x27;GUY&#x27;, HT: &#x27;HTI&#x27;, HM: &#x27;HMD&#x27;, VA: &#x27;VAT&#x27;, HN: &#x27;HND&#x27;, HU: &#x27;HUN&#x27;, IS: &#x27;ISL&#x27;, IN: &#x27;IND&#x27;, ID: &#x27;IDN&#x27;, IR: &#x27;IRN&#x27;, IQ: &#x27;IRQ&#x27;, IE: &#x27;IRL&#x27;, IM: &#x27;IMN&#x27;, IL: &#x27;ISR&#x27;, IT: &#x27;ITA&#x27;, JM: &#x27;JAM&#x27;, JP: &#x27;JPN&#x27;, JE: &#x27;JEY&#x27;, JO: &#x27;JOR&#x27;, KZ: &#x27;KAZ&#x27;, KE: &#x27;KEN&#x27;, KI: &#x27;KIR&#x27;, KP: &#x27;PRK&#x27;, KR: &#x27;KOR&#x27;, KW: &#x27;KWT&#x27;, KG: &#x27;KGZ&#x27;, LA: &#x27;LAO&#x27;, LV: &#x27;LVA&#x27;, LB: &#x27;LBN&#x27;, LS: &#x27;LSO&#x27;, LR: &#x27;LBR&#x27;, LY: &#x27;LBY&#x27;, LI: &#x27;LIE&#x27;, LT: &#x27;LTU&#x27;, LU: &#x27;LUX&#x27;, MK: &#x27;MKD&#x27;, MG: &#x27;MDG&#x27;, MW: &#x27;MWI&#x27;, MY: &#x27;MYS&#x27;, MV: &#x27;MDV&#x27;, ML: &#x27;MLI&#x27;, MT: &#x27;MLT&#x27;, MH: &#x27;MHL&#x27;, MQ: &#x27;MTQ&#x27;, MR: &#x27;MRT&#x27;, MU: &#x27;MUS&#x27;, YT: &#x27;MYT&#x27;, MX: &#x27;MEX&#x27;, FM: &#x27;FSM&#x27;, MD: &#x27;MDA&#x27;, MC: &#x27;MCO&#x27;, MN: &#x27;MNG&#x27;, ME: &#x27;MNE&#x27;, MS: &#x27;MSR&#x27;, MA: &#x27;MAR&#x27;, MZ: &#x27;MOZ&#x27;, MM: &#x27;MMR&#x27;, NA: &#x27;NAM&#x27;, NR: &#x27;NRU&#x27;, NP: &#x27;NPL&#x27;, NL: &#x27;NLD&#x27;, AN: &#x27;ANT&#x27;, NC: &#x27;NCL&#x27;, NZ: &#x27;NZL&#x27;, NI: &#x27;NIC&#x27;, NE: &#x27;NER&#x27;, NG: &#x27;NGA&#x27;, NU: &#x27;NIU&#x27;, NF: &#x27;NFK&#x27;, MP: &#x27;MNP&#x27;, NO: &#x27;NOR&#x27;, OM: &#x27;OMN&#x27;, PK: &#x27;PAK&#x27;, PW: &#x27;PLW&#x27;, PS: &#x27;PSE&#x27;, PA: &#x27;PAN&#x27;, PG: &#x27;PNG&#x27;, PY: &#x27;PRY&#x27;, PE: &#x27;PER&#x27;, PH: &#x27;PHL&#x27;, PN: &#x27;PCN&#x27;, PL: &#x27;POL&#x27;, PT: &#x27;PRT&#x27;, PR: &#x27;PRI&#x27;, QA: &#x27;QAT&#x27;, RE: &#x27;REU&#x27;, RO: &#x27;ROU&#x27;, RU: &#x27;RUS&#x27;, RW: &#x27;RWA&#x27;, BL: &#x27;BLM&#x27;, SH: &#x27;SHN&#x27;, KN: &#x27;KNA&#x27;, LC: &#x27;LCA&#x27;, MF: &#x27;MAF&#x27;, PM: &#x27;SPM&#x27;, VC: &#x27;VCT&#x27;, WS: &#x27;WSM&#x27;, SM: &#x27;SMR&#x27;, ST: &#x27;STP&#x27;, SA: &#x27;SAU&#x27;, SN: &#x27;SEN&#x27;, RS: &#x27;SRB&#x27;, SC: &#x27;SYC&#x27;, SL: &#x27;SLE&#x27;, SG: &#x27;SGP&#x27;, SK: &#x27;SVK&#x27;, SI: &#x27;SVN&#x27;, SB: &#x27;SLB&#x27;, SO: &#x27;SOM&#x27;, ZA: &#x27;ZAF&#x27;, GS: &#x27;SGS&#x27;, SS: &#x27;SSD&#x27;, ES: &#x27;ESP&#x27;, LK: &#x27;LKA&#x27;, SD: &#x27;SDN&#x27;, SR: &#x27;SUR&#x27;, SJ: &#x27;SJM&#x27;, SZ: &#x27;SWZ&#x27;, SE: &#x27;SWE&#x27;, CH: &#x27;CHE&#x27;, SY: &#x27;SYR&#x27;, TW: &#x27;TWN&#x27;, TJ: &#x27;TJK&#x27;, TZ: &#x27;TZA&#x27;, TH: &#x27;THA&#x27;, TL: &#x27;TLS&#x27;, TG: &#x27;TGO&#x27;, TK: &#x27;TKL&#x27;, TO: &#x27;TON&#x27;, TT: &#x27;TTO&#x27;, TN: &#x27;TUN&#x27;, TR: &#x27;TUR&#x27;, TM: &#x27;TKM&#x27;, TC: &#x27;TCA&#x27;, TV: &#x27;TUV&#x27;, UG: &#x27;UGA&#x27;, UA: &#x27;UKR&#x27;, AE: &#x27;ARE&#x27;, GB: &#x27;GBR&#x27;, US: &#x27;USA&#x27;, UM: &#x27;UMI&#x27;, UY: &#x27;URY&#x27;, UZ: &#x27;UZB&#x27;, VU: &#x27;VUT&#x27;, VE: &#x27;VEN&#x27;, VN: &#x27;VNM&#x27;, VI: &#x27;VIR&#x27;, WF: &#x27;WLF&#x27;, EH: &#x27;ESH&#x27;, YE: &#x27;YEM&#x27;, ZM: &#x27;ZMB&#x27;, ZW: &#x27;ZWE&#x27;, XK: &#x27;XKX&#x27;\n    };\n\n    return iso3166_3[country];\n}\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fsection>\u003Csection id=\"install-the-integration\" data-title=\"Install the Integration\" data-title-node=\"H2\">\u003Chr class=\"my-8\" style=\"margin-left: -48px; margin-right: -40vw\">\u003Ch2 data-anchor-id=\"install-the-integration\">Install the Integration\u003C\u002Fh2>\u003Col class=\"step step-icon-sm step-dashed step-border-last-0 mt-3\">\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">1\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>In the Foxy admin (admin.foxy.io), open the shipping settings for your store, scroll to Custom Shipping Code, and enable &quot;use custom code&quot;.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">2\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>In the code editor that appears, paste the code above. Do not save it yet.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">3\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>In a new tab, log in to your Postmen account and go to the API keys section. Under Tokens, click &quot;Add new api key&quot; and complete the form.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">4\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>Copy the generated API key from the Production or Testing tab (depending which type you created), then replace \u003Ccode class=\"badge bg-soft-danger text-danger\">YOUR-POSTMEN-API-KEY\u003C\u002Fcode> in the code with it.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">5\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>If you are using a Testing key, set \u003Ccode class=\"badge bg-soft-danger text-danger\">is_production\u003C\u002Fcode> to \u003Ccode class=\"badge bg-soft-danger text-danger\">false\u003C\u002Fcode>.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">6\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>Update the \u003Ccode class=\"badge bg-soft-danger text-danger\">shipper_accounts\u003C\u002Fcode> array to list every shipper account you want to request rates from. Shipper accounts are created in Postmen under Shipper Accounts. Make sure they match the environment (Production or Testing) of your key.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">7\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>Configure the weight unit, length unit, and parcel dimensions to match your shipments.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">8\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>Save your settings. Wait roughly 10 to 15 seconds, then refresh the page. If the save was successful, you will see your code again after refreshing.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003Cli class=\"step-item\">\u003Cdiv class=\"step-content-wrapper\">\u003Cspan class=\"step-icon step-icon-soft-primary\">9\u003C\u002Fspan>\u003Cdiv class=\"w-100 overflow-hidden\">\u003Cdiv class=\"step-content mt-2\">\u003Cp>Test it. Add a product from a live rate shippable category to your cart, then enter a shipping address on the cart or checkout. You should see rates returning from your Postmen account.\u003C\u002Fp>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fli>\u003C\u002Fol>\u003C\u002Fsection>\u003Csection id=\"customize-the-integration\" data-title=\"Customize the Integration\" data-title-node=\"H2\">\u003Chr class=\"my-8\" style=\"margin-left: -48px; margin-right: -40vw\">\u003Ch2 data-anchor-id=\"customize-the-integration\">Customize the Integration\u003C\u002Fh2>\u003Cp>This is a basic setup. It returns every rate from Postmen and passes default values for the parcel. See the Postmen documentation on rate requests to customize the request further, and the \u003Ca href=\"\u002Fhelp\u002Farticles\u002Fcustom-shipping-code-api-reference\" target=\"_self\">Custom Shipping Code API Reference\u003C\u002Fa> to output only specific rates or work with them further.\u003C\u002Fp>\u003Cp>Rates from custom shipping code are not currency converted by Foxy. For non USD stores, set the rate values in the cart&#039;s currency yourself. See \u003Ca href=\"\u002Fhelp\u002Farticles\u002Fshipping-currency-conversion\" target=\"_self\">Shipping Currency Conversion\u003C\u002Fa>.\u003C\u002Fp>\u003C\u002Fsection>",[567,570,572,574,576],{"id":568,"title":332,"level":569},"overview","H2",{"id":571,"title":344,"level":569},"before-you-start",{"id":573,"title":405,"level":569},"the-shipping-code",{"id":575,"title":428,"level":569},"install-the-integration",{"id":577,"title":524,"level":569},"customize-the-integration",[579],{"type":580,"content":581},"html","\u003Ch2>Overview\u003C\u002Fh2>\u003Cp>Postmen (by AfterShip) returns rates from multiple carriers through one API. If you need rates from carriers that Foxy does not natively support, you can fetch them from your Postmen account using Foxy&#039;s Custom Shipping Code feature. This article shows you the code to connect to Postmen and how to install it on your store.\u003C\u002Fp>\u003Ch2>Before You Start\u003C\u002Fh2>\u003Cp>You will need:\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>A Postmen account with an API key. Postmen provides separate Production and Testing keys; pick the one that matches the environment you want.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>One or more shipper accounts created in Postmen (Postmen dashboard, under Shipper Accounts). Make sure they belong to the same environment (Production or Testing) as your API key.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>Custom Shipping Code enabled on your store. See \u003Ca href=\"\u002Fhelp\u002Farticles\u002Fadd-custom-shipping-code\" target=\"_self\">Add Custom Shipping Code\u003C\u002Fa>.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>At least one product category set to a delivery type of &quot;Shipped using live shipping rates&quot;. See \u003Ca href=\"\u002Fhelp\u002Farticles\u002Fshipping-and-categories\" target=\"_self\">Shipping and Categories\u003C\u002Fa>.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>The Shipping Code\u003C\u002Fh2>\u003Cp>This code builds a rate request from the cart payload, loops the cart items into the parcel, posts the request to the Postmen rates endpoint, then adds each returned rate to the cart. Postmen expects 3 letter (ISO 3166 alpha 3) country codes, so the included \u003Ccode class=\"badge bg-soft-danger text-danger\">country_to_3\u003C\u002Fcode> helper converts Foxy&#039;s 2 letter codes. Set the options at the top to match your account and packaging.\u003C\u002Fp>\u003Cpre>\u003Ccode>\u002F\u002F Set to the API key of your Postmen account\nlet api_key = &#039;YOUR-POSTMEN-API-KEY&#039;;\n\u002F\u002F Set to false to use test shipper accounts\nlet is_production = true;\n\u002F\u002F Shipper accounts\nlet shipper_accounts = [\n    { &#039;id&#039;: &#039;SHIPPER-ACCOUNT-ID-1&#039; },\n    { &#039;id&#039;: &#039;SHIPPER-ACCOUNT-ID-2&#039; }\n];\n\u002F\u002F Weight units for the store (&#039;lb&#039; or &#039;kg&#039;)\nlet weight_unit = &#039;lb&#039;;\n\u002F\u002F Length units for the store (&#039;in&#039; or &#039;cm&#039;)\nlet length_unit = &#039;in&#039;;\n\u002F\u002F Parcel dimensions\nlet parcel_width = 20,\n    parcel_height = 10,\n    parcel_depth = 10;\n\n\n\nconst shipment = cart[&#039;_embedded&#039;][&#039;fx:shipment&#039;];\n\nlet payload = {\n    &#039;async&#039;: false,\n    &#039;shipper_accounts&#039;: shipper_accounts,\n    &#039;shipment&#039;: {\n        &#039;parcels&#039;: [\n            {\n                &#039;box_type&#039;: &#039;custom&#039;,\n                &#039;weight&#039;: {\n                    &#039;value&#039;: shipment[&#039;total_weight&#039;],\n                    &#039;unit&#039;: weight_unit\n                },\n                &#039;dimension&#039;: {\n                    &#039;width&#039;: parcel_width,\n                    &#039;height&#039;: parcel_height,\n                    &#039;depth&#039;: parcel_depth,\n                    &#039;unit&#039;: length_unit\n                },\n                &#039;items&#039;: [\n                    \u002F\u002F Populated below\n                ]\n            }\n        ],\n        &#039;ship_from&#039;: {\n            &#039;state&#039;: shipment[&#039;origin_region&#039;],\n            &#039;postal_code&#039;: shipment[&#039;origin_postal_code&#039;],\n            &#039;country&#039;: country_to_3(shipment[&#039;origin_country&#039;]),\n        },\n        &#039;ship_to&#039;: {\n            \u002F\u002F Populated below\n            &#039;country&#039;: country_to_3(shipment[&#039;country&#039;]),\n            &#039;type&#039;: shipment[&#039;is_residential&#039;] ? &#039;residential&#039; : &#039;business&#039;\n        }\n    },\n    &#039;is_document&#039;: false\n};\n\n\u002F\u002F Ship to address\nif (shipment[&#039;first_name&#039;]) {\n    payload.shipment.ship_to[&#039;contact_name&#039;] = shipment[&#039;first_name&#039;] + &quot; &quot; + shipment[&#039;last_name&#039;];\n}\nif (shipment[&#039;address1&#039;]) {\n    payload.shipment.ship_to[&#039;street1&#039;] = shipment[&#039;address1&#039;];\n}\nif (shipment[&#039;city&#039;]) {\n    payload.shipment.ship_to[&#039;city&#039;] = shipment[&#039;city&#039;];\n}\nif (shipment[&#039;region&#039;]) {\n    payload.shipment.ship_to[&#039;state&#039;] = shipment[&#039;region&#039;];\n}\nif (shipment[&#039;postal_code&#039;]) {\n    payload.shipment.ship_to[&#039;postal_code&#039;] = shipment[&#039;postal_code&#039;];\n}\n\n\u002F\u002F Items\nfor (let p in cart[&#039;_embedded&#039;][&#039;fx:items&#039;]) {\n    let item = cart[&#039;_embedded&#039;][&#039;fx:items&#039;][p];\n\n    let item_details = {\n        &#039;description&#039;: item.name,\n        &#039;quantity&#039;: item.quantity,\n        &#039;price&#039;: {\n            &#039;amount&#039;: item.price,\n            &#039;currency&#039;: cart.currency_code\n        },\n        &#039;weight&#039;: {\n            &#039;value&#039;: item.weight,\n            &#039;unit&#039;: weight_unit\n        }\n    }\n\n    if (item.sku) {\n        item_details[&#039;sku&#039;] = item.code\n    }\n\n    payload.shipment.parcels[0].items.push(item_details);\n}\n\ntry {\n    const endpoint = is_production ? &#039;https:\u002F\u002Fproduction-api.postmen.com\u002Fv3&#039; : &#039;https:\u002F\u002Fsandbox-api.postmen.com\u002Fv3&#039;\n    const response = await fetch(endpoint + &#039;\u002Frates&#039;, {\n        method: &#039;POST&#039;,\n        body: JSON.stringify(payload),\n        headers: {\n            &quot;postmen-api-key&quot;: api_key,\n            &quot;Content-Type&quot;: &quot;application\u002Fjson&quot;\n        }\n    });\n    const data = await response.json();\n\n    if (data.meta.code != 200) {\n        console.log(data.meta)\n    }\n\n    for (let r = 0; r &lt; data.data.rates.length; r++) {\n        const rate = data.data.rates[r];\n\n        if (rate.service_name) {\n            rates.add(10000+r, rate.total_charge.amount, &#039;&#039;, rate.service_name);\n        } else if (rate.error_message) {\n            console.log(rate.error_message);\n        }\n    }\n} catch(err) {\n  console.log(err);\n}\n\nfunction country_to_3(country) {\n    const iso3166_3 = {\n        AF: &#039;AFG&#039;, AX: &#039;ALA&#039;, AL: &#039;ALB&#039;, DZ: &#039;DZA&#039;, AS: &#039;ASM&#039;, AD: &#039;AND&#039;, AO: &#039;AGO&#039;, AI: &#039;AIA&#039;, AQ: &#039;ATA&#039;, AG: &#039;ATG&#039;, AR: &#039;ARG&#039;, AM: &#039;ARM&#039;, AW: &#039;ABW&#039;, AU: &#039;AUS&#039;, AT: &#039;AUT&#039;, AZ: &#039;AZE&#039;, BS: &#039;BHS&#039;, BH: &#039;BHR&#039;, BD: &#039;BGD&#039;, BB: &#039;BRB&#039;, BY: &#039;BLR&#039;, BE: &#039;BEL&#039;, BZ: &#039;BLZ&#039;, BJ: &#039;BEN&#039;, BM: &#039;BMU&#039;, BT: &#039;BTN&#039;, BO: &#039;BOL&#039;, BA: &#039;BIH&#039;, BW: &#039;BWA&#039;, BV: &#039;BVT&#039;, BR: &#039;BRA&#039;, VG: &#039;VGB&#039;, IO: &#039;IOT&#039;, BN: &#039;BRN&#039;, BG: &#039;BGR&#039;, BF: &#039;BFA&#039;, BI: &#039;BDI&#039;, KH: &#039;KHM&#039;, CM: &#039;CMR&#039;, CA: &#039;CAN&#039;, CV: &#039;CPV&#039;, KY: &#039;CYM&#039;, CF: &#039;CAF&#039;, TD: &#039;TCD&#039;, CL: &#039;CHL&#039;, CN: &#039;CHN&#039;, HK: &#039;HKG&#039;, MO: &#039;MAC&#039;, CX: &#039;CXR&#039;, CC: &#039;CCK&#039;, CO: &#039;COL&#039;, KM: &#039;COM&#039;, CG: &#039;COG&#039;, CD: &#039;COD&#039;, CK: &#039;COK&#039;, CR: &#039;CRI&#039;, CI: &#039;CIV&#039;, HR: &#039;HRV&#039;, CU: &#039;CUB&#039;, CY: &#039;CYP&#039;, CZ: &#039;CZE&#039;, DK: &#039;DNK&#039;, DJ: &#039;DJI&#039;, DM: &#039;DMA&#039;, DO: &#039;DOM&#039;, EC: &#039;ECU&#039;, EG: &#039;EGY&#039;, SV: &#039;SLV&#039;, GQ: &#039;GNQ&#039;, ER: &#039;ERI&#039;, EE: &#039;EST&#039;, ET: &#039;ETH&#039;, FK: &#039;FLK&#039;, FO: &#039;FRO&#039;, FJ: &#039;FJI&#039;, FI: &#039;FIN&#039;, FR: &#039;FRA&#039;, GF: &#039;GUF&#039;, PF: &#039;PYF&#039;, TF: &#039;ATF&#039;, GA: &#039;GAB&#039;, GM: &#039;GMB&#039;, GE: &#039;GEO&#039;, DE: &#039;DEU&#039;, GH: &#039;GHA&#039;, GI: &#039;GIB&#039;, GR: &#039;GRC&#039;, GL: &#039;GRL&#039;, GD: &#039;GRD&#039;, GP: &#039;GLP&#039;, GU: &#039;GUM&#039;, GT: &#039;GTM&#039;, GG: &#039;GGY&#039;, GN: &#039;GIN&#039;, GW: &#039;GNB&#039;, GY: &#039;GUY&#039;, HT: &#039;HTI&#039;, HM: &#039;HMD&#039;, VA: &#039;VAT&#039;, HN: &#039;HND&#039;, HU: &#039;HUN&#039;, IS: &#039;ISL&#039;, IN: &#039;IND&#039;, ID: &#039;IDN&#039;, IR: &#039;IRN&#039;, IQ: &#039;IRQ&#039;, IE: &#039;IRL&#039;, IM: &#039;IMN&#039;, IL: &#039;ISR&#039;, IT: &#039;ITA&#039;, JM: &#039;JAM&#039;, JP: &#039;JPN&#039;, JE: &#039;JEY&#039;, JO: &#039;JOR&#039;, KZ: &#039;KAZ&#039;, KE: &#039;KEN&#039;, KI: &#039;KIR&#039;, KP: &#039;PRK&#039;, KR: &#039;KOR&#039;, KW: &#039;KWT&#039;, KG: &#039;KGZ&#039;, LA: &#039;LAO&#039;, LV: &#039;LVA&#039;, LB: &#039;LBN&#039;, LS: &#039;LSO&#039;, LR: &#039;LBR&#039;, LY: &#039;LBY&#039;, LI: &#039;LIE&#039;, LT: &#039;LTU&#039;, LU: &#039;LUX&#039;, MK: &#039;MKD&#039;, MG: &#039;MDG&#039;, MW: &#039;MWI&#039;, MY: &#039;MYS&#039;, MV: &#039;MDV&#039;, ML: &#039;MLI&#039;, MT: &#039;MLT&#039;, MH: &#039;MHL&#039;, MQ: &#039;MTQ&#039;, MR: &#039;MRT&#039;, MU: &#039;MUS&#039;, YT: &#039;MYT&#039;, MX: &#039;MEX&#039;, FM: &#039;FSM&#039;, MD: &#039;MDA&#039;, MC: &#039;MCO&#039;, MN: &#039;MNG&#039;, ME: &#039;MNE&#039;, MS: &#039;MSR&#039;, MA: &#039;MAR&#039;, MZ: &#039;MOZ&#039;, MM: &#039;MMR&#039;, NA: &#039;NAM&#039;, NR: &#039;NRU&#039;, NP: &#039;NPL&#039;, NL: &#039;NLD&#039;, AN: &#039;ANT&#039;, NC: &#039;NCL&#039;, NZ: &#039;NZL&#039;, NI: &#039;NIC&#039;, NE: &#039;NER&#039;, NG: &#039;NGA&#039;, NU: &#039;NIU&#039;, NF: &#039;NFK&#039;, MP: &#039;MNP&#039;, NO: &#039;NOR&#039;, OM: &#039;OMN&#039;, PK: &#039;PAK&#039;, PW: &#039;PLW&#039;, PS: &#039;PSE&#039;, PA: &#039;PAN&#039;, PG: &#039;PNG&#039;, PY: &#039;PRY&#039;, PE: &#039;PER&#039;, PH: &#039;PHL&#039;, PN: &#039;PCN&#039;, PL: &#039;POL&#039;, PT: &#039;PRT&#039;, PR: &#039;PRI&#039;, QA: &#039;QAT&#039;, RE: &#039;REU&#039;, RO: &#039;ROU&#039;, RU: &#039;RUS&#039;, RW: &#039;RWA&#039;, BL: &#039;BLM&#039;, SH: &#039;SHN&#039;, KN: &#039;KNA&#039;, LC: &#039;LCA&#039;, MF: &#039;MAF&#039;, PM: &#039;SPM&#039;, VC: &#039;VCT&#039;, WS: &#039;WSM&#039;, SM: &#039;SMR&#039;, ST: &#039;STP&#039;, SA: &#039;SAU&#039;, SN: &#039;SEN&#039;, RS: &#039;SRB&#039;, SC: &#039;SYC&#039;, SL: &#039;SLE&#039;, SG: &#039;SGP&#039;, SK: &#039;SVK&#039;, SI: &#039;SVN&#039;, SB: &#039;SLB&#039;, SO: &#039;SOM&#039;, ZA: &#039;ZAF&#039;, GS: &#039;SGS&#039;, SS: &#039;SSD&#039;, ES: &#039;ESP&#039;, LK: &#039;LKA&#039;, SD: &#039;SDN&#039;, SR: &#039;SUR&#039;, SJ: &#039;SJM&#039;, SZ: &#039;SWZ&#039;, SE: &#039;SWE&#039;, CH: &#039;CHE&#039;, SY: &#039;SYR&#039;, TW: &#039;TWN&#039;, TJ: &#039;TJK&#039;, TZ: &#039;TZA&#039;, TH: &#039;THA&#039;, TL: &#039;TLS&#039;, TG: &#039;TGO&#039;, TK: &#039;TKL&#039;, TO: &#039;TON&#039;, TT: &#039;TTO&#039;, TN: &#039;TUN&#039;, TR: &#039;TUR&#039;, TM: &#039;TKM&#039;, TC: &#039;TCA&#039;, TV: &#039;TUV&#039;, UG: &#039;UGA&#039;, UA: &#039;UKR&#039;, AE: &#039;ARE&#039;, GB: &#039;GBR&#039;, US: &#039;USA&#039;, UM: &#039;UMI&#039;, UY: &#039;URY&#039;, UZ: &#039;UZB&#039;, VU: &#039;VUT&#039;, VE: &#039;VEN&#039;, VN: &#039;VNM&#039;, VI: &#039;VIR&#039;, WF: &#039;WLF&#039;, EH: &#039;ESH&#039;, YE: &#039;YEM&#039;, ZM: &#039;ZMB&#039;, ZW: &#039;ZWE&#039;, XK: &#039;XKX&#039;\n    };\n\n    return iso3166_3[country];\n}\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Install the Integration\u003C\u002Fh2>\u003Col order=\"1\">\u003Cli>\u003Cp>In the Foxy admin (admin.foxy.io), open the shipping settings for your store, scroll to Custom Shipping Code, and enable &quot;use custom code&quot;.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>In the code editor that appears, paste the code above. Do not save it yet.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>In a new tab, log in to your Postmen account and go to the API keys section. Under Tokens, click &quot;Add new api key&quot; and complete the form.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>Copy the generated API key from the Production or Testing tab (depending which type you created), then replace \u003Ccode class=\"badge bg-soft-danger text-danger\">YOUR-POSTMEN-API-KEY\u003C\u002Fcode> in the code with it.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>If you are using a Testing key, set \u003Ccode class=\"badge bg-soft-danger text-danger\">is_production\u003C\u002Fcode> to \u003Ccode class=\"badge bg-soft-danger text-danger\">false\u003C\u002Fcode>.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>Update the \u003Ccode class=\"badge bg-soft-danger text-danger\">shipper_accounts\u003C\u002Fcode> array to list every shipper account you want to request rates from. Shipper accounts are created in Postmen under Shipper Accounts. Make sure they match the environment (Production or Testing) of your key.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>Configure the weight unit, length unit, and parcel dimensions to match your shipments.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>Save your settings. Wait roughly 10 to 15 seconds, then refresh the page. If the save was successful, you will see your code again after refreshing.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>Test it. Add a product from a live rate shippable category to your cart, then enter a shipping address on the cart or checkout. You should see rates returning from your Postmen account.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Fol>\u003Ch2>Customize the Integration\u003C\u002Fh2>\u003Cp>This is a basic setup. It returns every rate from Postmen and passes default values for the parcel. See the Postmen documentation on rate requests to customize the request further, and the \u003Ca href=\"\u002Fhelp\u002Farticles\u002Fcustom-shipping-code-api-reference\" target=\"_self\">Custom Shipping Code API Reference\u003C\u002Fa> to output only specific rates or work with them further.\u003C\u002Fp>\u003Cp>Rates from custom shipping code are not currency converted by Foxy. For non USD stores, set the rate values in the cart&#039;s currency yourself. See \u003Ca href=\"\u002Fhelp\u002Farticles\u002Fshipping-currency-conversion\" target=\"_self\">Shipping Currency Conversion\u003C\u002Fa>.\u003C\u002Fp>",{"name":583,"created_at":584,"published_at":585,"updated_at":586,"id":587,"uuid":47,"content":588,"slug":48,"full_slug":48,"sort_by_date":59,"position":767,"tag_list":768,"is_startpage":24,"parent_id":59,"meta_data":59,"group_id":769,"first_published_at":770,"release_id":59,"lang":65,"path":59,"alternates":771,"default_full_slug":59,"translated_slugs":59},"Contact","2022-09-23T19:56:58.957Z","2025-05-08T18:24:40.382Z","2025-05-08T18:24:40.392Z",3138,{"seo":589,"_uid":592,"title":593,"action":594,"fields":595,"method":743,"columns":744,"subtitle":758,"component":48,"button_text":764,"submit_title":765,"submit_subtitle":766},{"_uid":590,"title":583,"plugin":591,"description":13},"24ff7574-3bcc-48d2-85b5-e529dfea1cc4","meta-fields","8f54f1da-9d8f-49b2-89e7-840e886491cb","We're here to help.","https:\u002F\u002Fusebasin.com\u002Ff\u002F029f48d65402",[596,601,605,714,717,722,737],{"_uid":597,"name":598,"type":333,"label":599,"options":13,"required":33,"component":600,"placeholder":13},"9a70b226-2036-4f90-a052-b3efa61c5896","name","Name","form___field",{"_uid":602,"name":603,"type":603,"label":604,"options":13,"required":33,"component":600,"placeholder":13},"86ba35be-ff43-4a28-8633-14052a8f6622","email","Email Address",{"_uid":606,"name":607,"type":608,"label":609,"options":610,"required":33,"component":600,"conditions":611,"placeholder":13},"3f827475-492c-4f97-aa1e-2386ac263b6c","topic","select","Topic","Presales, Support, Billing, Partnerships, Order Enquiry, Other",[612,668,678,685,693,701,707],{"_uid":613,"equals":614,"fields":615,"component":667},"e21d97dd-e68e-4fa6-ba97-bc40f3041dde","Order Enquiry",[616],{"_uid":617,"body":618,"type":665,"title":13,"component":666},"b64992bc-6d53-48b8-b7a0-d81e5a062e50",{"type":324,"content":619},[620],{"type":335,"content":621},[622,624,631,633,635,636,641,643,648,656,658,663],{"text":623,"type":333},"We are ",{"text":625,"type":333,"marks":626},"Foxy.io",[627],{"type":379,"attrs":628},{"href":629,"uuid":59,"anchor":59,"custom":630,"target":59,"linktype":31},"http:\u002F\u002FFoxy.io",{},{"text":632,"type":333},", an ecommerce platform powering ecommerce for other merchants. We do not sell products, and are unable to assist with questions about order statuses or refunds for any merchants using our platform. Please contact the merchant you ordered from for assistance. If you’d like to report a store using Foxy for fraudulent practices, please select ‘other’ in the subject.",{"type":634},"hard_break",{"type":634},{"text":637,"type":333,"marks":638},"NOTE:",[639],{"type":640},"bold",{"text":642,"type":333}," We are ",{"text":644,"type":333,"marks":645},"not ",[646],{"type":647},"italic",{"text":649,"type":333,"marks":650},"Foxy.in",[651,655],{"type":379,"attrs":652},{"href":653,"uuid":59,"anchor":59,"custom":654,"target":59,"linktype":31},"http:\u002F\u002FFoxy.in",{},{"type":647},{"text":657,"type":333},". We are not in any way affiliated with ",{"text":649,"type":333,"marks":659},[660],{"type":379,"attrs":661},{"href":653,"uuid":59,"anchor":59,"custom":662,"target":59,"linktype":31},{},{"text":664,"type":333},", and cannot help in any way with your order from that website.","danger","global___alert","form___condition",{"_uid":669,"equals":670,"fields":671,"component":667},"8765c3e1-25cf-44aa-b8ea-fc6094acf9c3","Presales",[672],{"_uid":673,"name":674,"type":675,"label":13,"options":13,"required":24,"component":600,"conditions":676,"placeholder":13,"default_value":677},"cf464f8e-d643-4f6e-af29-d3abffaf7380","department_email_address","hidden",[],"hello@foxy.io",{"_uid":679,"equals":208,"fields":680,"component":667},"4007b6d8-77e5-421d-bd1e-6f336dd853fb",[681],{"_uid":682,"name":674,"type":675,"label":13,"options":13,"required":24,"component":600,"conditions":683,"placeholder":13,"default_value":684},"7b4c6aa5-a68c-45e0-9ce1-0a36af10c0c2",[],"help@foxy.io",{"_uid":686,"equals":687,"fields":688,"component":667},"1dbb8f11-613d-43cd-9e09-1b94f6e19219","Billing",[689],{"_uid":690,"name":674,"type":675,"label":13,"options":13,"required":24,"component":600,"conditions":691,"placeholder":13,"default_value":692},"a0ac0d1b-bc4f-4a6c-a682-581d450b0b73",[],"help+billing@foxy.io",{"_uid":694,"equals":695,"fields":696,"component":667},"a0a53a50-7172-4a29-ba58-181e38874e12","Partnerships",[697],{"_uid":698,"name":674,"type":675,"label":13,"options":13,"required":24,"component":600,"conditions":699,"placeholder":13,"default_value":700},"7aa011d9-f374-4aed-b5a5-929b54aaf152",[],"partners@foxy.io",{"_uid":702,"equals":614,"fields":703,"component":667},"a4cd431f-25d5-41c7-bfdc-02c908c8fb47",[704],{"_uid":705,"name":674,"type":675,"label":13,"options":13,"required":24,"component":600,"conditions":706,"placeholder":13,"default_value":677},"f5d52168-d6ae-451b-94ee-2ced1cbd28ad",[],{"_uid":708,"equals":709,"fields":710,"component":667},"25aba1ed-eb41-4bbc-aa89-f7a7167ea86e","Other",[711],{"_uid":712,"name":674,"type":675,"label":13,"options":13,"required":24,"component":600,"conditions":713,"placeholder":13,"default_value":677},"f40dfaef-c203-4b71-bf4e-e1b43cef192b",[],{"_uid":715,"component":716},"e9c53a05-f40a-4510-aaf8-bc072a235a0c","form___subject",{"_uid":718,"name":719,"type":720,"label":721,"options":13,"required":33,"component":600,"placeholder":13},"a4c4d385-fff4-4978-99fb-b68cfea623d6","message","textarea","Message",{"_uid":723,"name":724,"type":608,"label":725,"options":726,"required":33,"component":600,"conditions":727,"placeholder":13},"8a3c9f85-f438-427d-9c7a-d7b295a14b5b","existing_user","Are you an existing user?","No, Yes",[728],{"_uid":729,"equals":730,"fields":731,"component":667},"115933d6-262a-4b59-8fa8-579c5ad73de1","Yes",[732],{"_uid":733,"name":734,"type":333,"label":735,"options":13,"required":33,"component":600,"conditions":736,"placeholder":13},"44b6ff23-98f0-4e95-b7f5-c23e06415c2d","subdomain","Store Subdomain",[],{"_uid":738,"name":739,"type":608,"label":740,"options":741,"required":33,"component":600,"conditions":742,"placeholder":13},"922a5cef-3af2-4113-8855-36c7910e3ee3","user_type","What type of user are you?","Developer, Designer, Merchant",[],"POST",[745],{"_uid":746,"text":747,"title":756,"component":757},"7323b90d-a93a-4bf1-baa9-20d0b7ead61b",{"type":324,"content":748},[749],{"type":335,"content":750},[751,753,754],{"text":752,"type":333},"855.369.9227",{"type":634},{"text":755,"type":333},"9:30am-6pm Central M-F","Pre-sales, Sales, & Partnerships","contact___footer_column",{"type":324,"content":759},[760],{"type":335,"content":761},[762],{"text":763,"type":333},"Get in touch to get help from our friendly support team.","Submit","Success!","Your email has been received. We'll get back to you as soon as we can, but it might take a business day. If you don't hear back from us in a timely manner, please check your spam folder to ensure our reply didn't go there.",-80,[],"2fd9fb7d-a48a-4184-acfd-30022d8d6f08","2022-09-23T20:10:45.360Z",[],[288,773,800],{"name":774,"created_at":775,"published_at":776,"updated_at":777,"id":778,"uuid":779,"content":780,"slug":794,"full_slug":795,"sort_by_date":59,"position":796,"tag_list":797,"is_startpage":24,"parent_id":310,"meta_data":59,"group_id":798,"first_published_at":776,"release_id":59,"lang":65,"path":59,"alternates":799,"default_full_slug":59,"translated_slugs":59},"Shipping","2023-01-19T16:28:43.170Z","2023-01-19T17:25:33.503Z","2026-05-19T18:05:41.768Z",28245,"d92c1375-75ba-48e1-bb02-a3ae35187e0b",{"_uid":781,"icon":782,"name":774,"guides":783,"summary":784,"category":13,"component":297,"blog_posts":785,"content_hub":24,"icon_custom":786,"case_studies":787,"faq_sections":788,"help_articles":789,"featured_guides":790,"mailbox_category":13,"featured_articles":791,"featured_blog_posts":792,"featured_case_studies":793},"ea45a64b-f203-4c73-8645-325761de650e","fa-truck",[],"How to configure shipping rules for your store.",[],{"id":59,"alt":59,"name":13,"focus":59,"title":59,"filename":13,"copyright":59,"fieldtype":81},[],[],[],[],[],[],[],"shipping","help\u002Fcategories\u002Fshipping",90,[],"2e7778d1-fab7-4b53-ae55-f3382610fa56",[],{"name":801,"created_at":802,"published_at":803,"updated_at":804,"id":805,"uuid":555,"content":806,"slug":819,"full_slug":820,"sort_by_date":59,"position":821,"tag_list":822,"is_startpage":24,"parent_id":310,"meta_data":59,"group_id":823,"first_published_at":824,"release_id":59,"lang":65,"path":59,"alternates":825,"default_full_slug":59,"translated_slugs":59},"Custom Shipping Code","2026-05-27T16:30:46.528Z","2026-06-24T21:24:10.404Z","2026-06-24T21:24:10.422Z",181083531435477,{"_uid":807,"icon":13,"name":801,"type":808,"pinned":24,"summary":809,"category":779,"component":297,"blog_posts":810,"icon_custom":811,"case_studies":813,"faq_sections":814,"featured_guides":815,"mailbox_category":13,"featured_articles":816,"featured_blog_posts":817,"featured_case_studies":818},"31421cb4-545f-42da-a2f6-c34d68e7f11f","simple","How to add, modify, or remove shipping rates with JavaScript in the Foxy admin.",[],{"id":59,"alt":59,"name":13,"focus":59,"title":59,"source":59,"filename":13,"copyright":59,"fieldtype":81,"meta_data":812},{},[],[],[],[],[],[],"custom-shipping-code","help\u002Fcategories\u002Fcustom-shipping-code",-290,[],"d9babca5-97b7-4d3f-b3d4-3f2de363a7b9","2026-05-28T20:17:53.353Z",[],{},1784562227159]