0

Currently when attempting a coupon (POST) at resource "/coupon.json" we are getting the following return JSON:

Response Code:

{"status":400,"message":"The field 'id' cannot be written to. Please remove it from your request before trying again."}

The "ID" field is obviously no where in our code but we are still receiving this error.

In to this addition we thought it might be from the "applies_to" as that object resource contains an "ids" element but we disabled that and still received the same effect.

At this time it is our best guess that this is a bug on the server side that is registering incoming JSON for the coupon resource with an "ID" point on it.

Question: Is creating a coupon currently possible?

Ransom
  • 23
  • 4

1 Answers1

1

It is possible to create coupons. I got it working both from a php script and using the developer playground at https://developer.bigcommerce.com/console

    $coupon = array('name' => 'FJKDJFKD', 'type' => 'percentage_discount', 'amount' => 50.0, 'code' => 'JFKDFE', 'enabled' => true, 'applies_to' => array('entity' => 'products', 'ids' => array(32)), 'shipping_methods' => array());
print_r($coupon);

Screenshots from the playground -

Post couponsPost response

Saran
  • 713
  • 6
  • 14
  • Thanks for your help on this Saranyan, after further review I found that our custom createCoupon function (built outside of the php wrapper) was double json_encoding the object. I am confirming that coupon creating is definitely possible. Details details /smackshead. Thanks again for the assistance. – Ransom May 07 '13 at 22:56
  • Notice that the response "type" is "per_item_discount" even though your request specified "percentage_discount". I used POSTMAN chrome plug-in and my own C# code and no matter what coupon type I specify, both methods always result in a per_item_discount. – Mike Stephenson May 12 '13 at 18:18
  • @MikeStephenson this is a bug. It will be fixed on the next release. – Saran May 17 '13 at 14:24