The currency and amount return parameters from the dynamic pricing callback can not be empty

180 Views Asked by At

I'm setting up facebook canvas payments and I'm using dynamic pricing so I have a callback setup to send the price to facebook. I'm following the instructions below and I will paste my code as well. Everything looks correct but I'm still getting the same error message about currency and amount return parameters can't be empty. I'm at the end of my rope here so any help is greatly appreciated!

An error occurred. Please try again later.
API Error Code: 1383148
API Error Description: The currency and amount return parameters from the dynamic pricing     callback can not be empty

public class Item
    {
        public string product { get; set; }
        public decimal amount { get; set; }
        public string currency { get; set; }
    }

    public class RootObject
    {
        public List<Item> content { get; set; }
        public string method { get; set; }
    }

                var objectToSerialize = new RootObject();
                objectToSerialize.content = new List<Item> 
                      {
                         new Item { product = "https://homeworkhelpers.azurewebsites.net/EssayFee.html", amount = 1.99M, currency = "USD" }
                      };
                objectToSerialize.method = "payments_get_item_price";
                var json = new JavaScriptSerializer().Serialize(objectToSerialize);
                response.Write(json);

Instructions I'm following:

At this point you should verify the purchase and respond to the HTTP request with a JSON array containing at a minimum: product, amount and currency in the format defined below.

{
  "content":
    {
      "product": "http://www.friendsmash.com/og/smashingpack.html",
      "amount": 1.99,
      "currency": "USD",
    },
  "method":"payments_get_item_price"
}

Here is my json that it returns:

{"content":[{"product":"https://mywebsite/product.html","amount":1.99,"currency":"USD"}],"method":"payments_get_item_price"}
1

There are 1 best solutions below

0
On BEST ANSWER

The fix was changing it to just an item instead of a list of items and that fixed the issue