These docs are for v20.3.44. Click to read the latest docs for v20.3.186.

Discussions

Ask a Question
Back to All

Issue with Create a Cart POST request

I am attempting to create a button on my webpage that leads users to a cart with a single specified product in it. This is such that the user can easily/quickly checkout said product without needing to search for the itme, add it to their cart, then checkout.

Currently, I am trying to test this out using Postman. I can get a status of 201 and an icon on the UI (user's page) which shows that the API call is successfully creating a cart, however, when clicking on the cart icon I am constantly met with an error 500 (I would then need to manually clear the cart). Here is the request body I am currently using for the "Creates a Cart" POST api request:

{
"$type": "Asi.Soa.Commerce.DataContracts.CartData, Asi.Contracts",
"ComboOrder": {
"$type": "Asi.Soa.Commerce.DataContracts.ComboOrderData, Asi.Contracts",
"ComboOrderId": "",
"Order": {
"$type": "Asi.Soa.Commerce.DataContracts.OrderData, Asi.Contracts",
"Lines": [
{
"$type": "Asi.Soa.Commerce.DataContracts.OrderLineData, Asi.Contracts",
"Item": {
"$type": "Asi.Soa.Commerce.DataContracts.ItemSummaryData, Asi.Contracts",
"ItemClass": {
"$type": "Asi.Soa.Commerce.DataContracts.ItemClassSummaryData, Asi.Contracts",
"ItemClassId": "MEETING"
},
"ItemCode": "TEST1/REG",
"ItemId": "TEST1/REG",
"Name": "Registration Fee"
},
"QuantityOrdered": {
"$type": "System.Nullable`1[[Asi.Soa.Commerce.DataContracts.QuantityData, Asi.Contracts]], mscorlib",
"Amount": 1
}
}
]
}
},
"UserId": "34231",
"UpdateInformation": {
"$type": "Asi.Soa.Core.DataContracts.EntityUpdateInformationData, Asi.Contracts",
"CreatedBy": "34231",
"CreatedOn": "2023-10-27T00:00:00Z",
"UpdatedBy": "34231",
"UpdatedOn": "2023-10-27T00:00:00Z"
}
}