question

richa avatar image
richa asked David Marginian edited

Issue with create order api



Hello,

I am trying to place an order using create order api. Following is my curl request :

curl --request POST \

--url 'https://sandbox.dev.clover.com/v3/merchants/*****/orders?access_token=******' \

--header 'content-type: application/json' \

--data '{"orderType":{"taxable":"false","isDefault":"false","filterCategories":"false","isHidden":"false","isDeleted":"false","id":"1","labelKey":"test","label":"test"},"taxRemoved":"false","lineItems":[{"item":{"id":"HNY6YV530YVJ4"},"printed":"false","exchangedLineItem":{},"exchanged":"false","refunded":"false","refund":{"orderRef":{},"device":{},"payment":{},"employee":{},"overrideMerchantTender":{},"serviceChargeAmount":{},"germanInfo":{},"appTracking":{},"cardTransaction":{"extra":{},"vaultedCard":{}},"transactionInfo":{"identityDocument":{"payment":{}},"isTokenBasedTx":"false","emergencyFlag":"false","promotionalMessage":{},"eCommTransactionInfo":{"storedCredentials":{"installment_info":{}}},"sepaElvTransactionInfo":{}},"merchant":{}},"isRevenue":"false","printGroup":{},"id":"*****","name":"Test","price":18}],"currency":"USD","title":"test","note":"test"}'



It is giving following error :

{

"message":

"Referenced order type does not exist"

}


Can you please elaborate on what is missing or because of which I am getting this error



Ordersinaccurate_api_docs
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian answered

orderType must reference an existing orderType by Clover id:

 "orderType": {
    "id": "cloverIdOfExistingOrderType"
 },

If the orderType doesn't exist first create it by posting to { {url}}/v3/merchants/{ {mid}}/order_types

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

richa avatar image
richa answered David Marginian edited

I can place order but line items are not added in order. Following is my request api :

curl --request POST \ --url 'https://sandbox.dev.clover.com/v3/merchants/****/orders?access_token=****' \ --header 'content-type: application/json' \ --data '{"employee":{"id":"7GNPP36Q0C0W2"},"orderType":{"taxable":"false","isDefault":"false","filterCategories":"false","isHidden":"false","isDeleted":"false","id":"3BVWVY1YZNWJT"},"taxRemoved":"false","lineItems":[{"item":{"id":"HNY6YV530YVJ4"},"printed":"false","exchangedLineItem":{},"exchanged":"false","refunded":"false","refund":{"orderRef":{},"device":{},"payment":{},"employee":{},"overrideMerchantTender":{},"serviceChargeAmount":{},"germanInfo":{},"appTracking":{},"cardTransaction":{"extra":{},"vaultedCard":{}},"transactionInfo":{"identityDocument":{"payment":{}},"isTokenBasedTx":"false","emergencyFlag":"false","promotionalMessage":{},"eCommTransactionInfo":{"storedCredentials":{"installment_info":{}}},"sepaElvTransactionInfo":{}},"merchant":{}},"isRevenue":"false","printGroup":{},"id":"HNY6YV530YVJ4","name":"100 PIPERS SCOTCH","alternateName":"100 PIPERS SCOTCH","price":18,"itemCode":"09674980085","unitName":"oz","priceWithModifiers":19,"priceWithModifiersAndItemAndOrderDiscounts":19}],"title":"Test","total":1800,"currency":"USD"}'



Can you please help me with why line items are not getting added along with order details ?

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

That's not the way it works, line items must be added separately (either 1 at a time or more than 1 at a time via the bulk endpoint). I do realize the REST API documentation is misleading. Please see https://docs.clover.com/docs/working-with-orders.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community