Skip to main content

Coupons

Discounts with validity rules and usage limits. redemptions shows where each coupon was actually applied.

CommandHTTPDescription
coupons listGET /v1/couponsList coupons
coupons createPOST /v1/couponsCreate a coupon
coupons getGET /v1/coupons/{id}Get a coupon
coupons updatePATCH /v1/coupons/{id}Update a coupon
coupons deleteDELETE /v1/coupons/{id}Delete a coupon
coupons deactivatePOST /v1/coupons/{id}/deactivateDeactivate a coupon
coupons redemptionsGET /v1/coupons/{id}/redemptionsList the coupon's redemptions

Examples​

--params carries query and path parameters (id, page, filters); --json carries the request body; --fields limits which fields come back — worth using on every list/get to save context. See Global flags for the full reference.

# List coupons
kobana billing coupons list --fields "id,public_id,external_id,code,name"

# Get a coupon
kobana billing coupons get --params '{"id": "COUPON_ID"}'

# Create a coupon
kobana billing coupons create \
--json '{"code": "CODE", "name": "NAME", "discount_type": "percentage", "discount_value": 0}'

# Update a coupon
kobana billing coupons update \
--params '{"id": "COUPON_ID"}' \
--json '{"name": "NAME", "external_id": "EXTERNAL_ID", "description": "DESCRIPTION"}'

# Deactivate a coupon
kobana billing coupons deactivate --params '{"id": "COUPON_ID"}'

# Delete a coupon
kobana billing coupons delete --params '{"id": "COUPON_ID"}' --dry-run

Next steps​