Jump to content

Create Product API error "product_sales_price_type_id is invalid"


 Share

Recommended Posts

Hello, I'm trying to create product in the Sage Accounting using the API (https://developer.sage.com/accounting/reference/products-services/#tag/Products/operation/postProducts)
I'm getting error "The product_sales_price_type_id is invalid." There is no field named "product_sales_price_type_id" in the create product docs.

Where should I add "product_sales_price_type_id"?
Is the developer docs up to date?


My request is:

{
   "product": {
      "active": true,
      "cost_price": 84,
      "description": "Test Product Description",
      "purchase_ledger_account_id": null,
      "sales_ledger_account_id": null,
      "purchase_tax_rate_id": "GB_STANDARD",
      "sales_tax_rate_id": "GB_STANDARD",
      "sales_prices": [
         {
            "price": 100,
            "price_includes_tax": false,
         }
      ],
   }
}

 

Link to comment
Share on other sites

Hi,

Thank you for your question.
 

The sales_prices need to include a valid product_sales_type_id as per the below example.

The product_sales_price_type_id's can be returned via GET https://api.accounting.sage.com/v3.1/product_sales_price_types
 

{
	"product": {
		"description": "22\" Monitor",
		"sales_ledger_account_id": "e37adfa38e6311ecbccd06255bbcbb57",
		"purchase_ledger_account_id": "e37c57448e6311ecbccd06255bbcbb57",
		"item_code": "MON004",
		"sales_tax_rate_id": "GB_STANDARD",
		"usual_supplier_id": "9d4fd4da8949435fa6e11a2c40536983",
		"purchase_tax_rate_id": "GB_STANDARD",
		"cost_price": "45",
		"sales_prices": [{
			"price_name": "Sales Price",
			"price": "80",
			"price_includes_tax": false,
			"product_sales_price_type_id": "ba1045fbfdbc45d5a6c591a1a4baeebd"
		}]
	}
}

Thanks

Mark

Link to comment
Share on other sites

  • 1 month later...

Hello,

I'm encountering the same issue while trying to create a product in Sage Accounting using the API. It appears that the error message mentions a field called "product_sales_price_type_id," but there's no such field documented in the create product section. https://capcutproapk.org/I've reviewed the API documentation, and indeed, there's no mention of "product_sales_price_type_id." It seems there might be a discrepancy between the error message and the actual fields required for creating a product.  Thank you for bringing this to our attention, and I hope we can resolve this issue soon.

Edited by Joe Brian
Link to comment
Share on other sites

Hi Joe,

I'm not sure why you referenced https://capcutproapk.org/?

The API reference for  https://developer.sage.com/accounting/reference/products-services/#tag/Products/operation/postProducts provides the ability to expand the sales_prices array which references the product_sales_price_type_id as per the example json body above. It doesn't highlight it as a required field however so we do need to update that aspect of the swagger/open API spec. 

https://developer.sage.com/accounting/reference/products-services/#tag/Product-Sales-Price-Types - Details how to obtain and create product_sales_prices.

Thanks

Mark

Screenshot 2024-02-09 at 08.38.50.png

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...