applied_coupon_code
Collection: applied_coupon_codes
This resource represents a coupon which has been applied to a shopping cart. It contains link relationships to the coupon, coupon code, and the cart it is applied to.
To apply a coupon to a cart, POST a code value to the applied_coupon_codes collection of the cart. Include a parameter for ignore_usage_limits set to true to allow the coupon to be added to the cart, even if it has expired or the number of uses per coupon, code or customer has reached their maximums.
If you want to apply an externally controlled coupon to a cart then first you should have externally_controlled_coupon_id which can be obtained by creating a coupon with coupon_discount_type parameter set to externally_controlled. Then make a POST request with data including externally_controlled_coupon_id, name, code, amount, and is_taxable.
Externally controlled coupons can be used for two use cases: giving a discount to the user (amount should be negative) or charging the user for fees or other price adjustments (amount should be positive).
Required Scopes
store_full_access When part of a completed transaction:
transactions_read transactions_write When part of a cart:
carts_read carts_write Actions
Properties (7)
code String · Read-only The coupon code applied to this cart.
name String · Read-only The name of this coupon. Returned only for externally_controlled coupons.
amount Number · Read-only The amount of discount applied by this coupon. Returned only for externally_controlled coupons.
is_taxable Boolean · Read-only Whether or not this coupon's discount is taxable. Returned only for externally_controlled coupons.
ignore_usage_limits Boolean · Optional When POSTing a coupon code, set this to true to allow the coupon to be applied even if it has expired or usage limits have been reached.
POST request only.
date_created String (nullable) · Read-only The date this resource was created.
date_modified String (nullable) · Read-only The date this resource was last modified.
Link Relations (5)
self Applied Coupon Code Example Representation
{
"_links": {
"curies": [
{
"name": "fx",
"href": "https://api.foxycart.com/rels/{rel}",
"templated": true
}
],
"self": {
"href": "https://api.foxycart.com/applied_coupon_codes/123",
"title": "Applied Coupon Code"
},
"fx:store": {
"href": "https://api.foxycart.com/stores/456",
"title": "This Store"
},
"fx:cart": {
"href": "https://api.foxycart.com/carts/999",
"title": "This Cart"
},
"fx:coupon": {
"href": "https://api.foxycart.com/coupons/999",
"title": "This Coupon"
},
"fx:coupon_code": {
"href": "https://api.foxycart.com/coupon_codes/456",
"title": "This Coupon Code"
}
},
"code": "test",
"date_created": "2015-04-27T13:42:55-0700",
"date_modified": "2015-04-27T13:42:55-0700"
}