2

I just wanted to test this API for understanding order flow

{  "addressInformation": {
      "shipping_address": {
       "region": "New York",
       "region_id": 43,
       "region_code": "NY",
       "country_id": "US",
       "street": [
      "123 Oak Ave"
    ],
    "postcode": "10577",
    "city": "Purchase",
    "firstname": "Jane",
    "lastname": "Doe",
    "email": "jdoe@example.com",
    "telephone": "512-555-1111"
  },
  "billing_address": {
    "region": "New York",
    "region_id": 43,
    "region_code": "NY",
    "country_id": "US",
    "street": [
      "123 Oak Ave"
    ],
    "postcode": "10577",
    "city": "Purchase",
    "firstname": "Jane",
    "lastname": "Doe",
    "email": "jdoe@example.com",
    "telephone": "512-555-1111"
  },
  "shipping_carrier_code": "tablerate",
  "shipping_method_code": "bestway"
  }
}

but with above payload given in devdocs it show error:

"message": "Carrier with such method not found: %1, %2",
"parameters": [ "tablerate", "bestway" ],

how can it be tested ?

1
  • Try to add this shipping method in your methods from admin page – Tigran Kuchatyan Jan 26 '20 at 20:42
0

First of all you have to check available shipping methods by making this call:

POST /rest/default/V1/carts/mine/estimate-shipping-methods

with following body (example):

{
"address": {
    "country_id": "PL",
    "street": [
      "..."
    ],
    "postcode": "...",
    "city": "..."
  }    
}

Don't forget to add header:

Authorization: Bearer [customer token]

And sample response:

[
  {
    "carrier_code": "flatrate",
    "method_code": "flatrate",
    "carrier_title": "Flat Rate",
    "method_title": "Fixed",
    "amount": 50,
    "base_amount": 50,
    "available": true,
    "error_message": "",
    "price_excl_tax": 50,
    "price_incl_tax": 50
  }
]

Then you have to just put method_code and carrier_code

Full flow:

  1. Get customer token POST /rest/default/V1/integration/customer/token
  2. Create shopping-card POST /rest/default/V1/carts/mine
  3. Add item to shopping-card POST /rest/default/V1/carts/mine/items
  4. Get shipping information
  5. Set up shipping
  6. Set up payment method

PS. I've stucked on setting up payments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.