Skip to content

REST API

All endpoints are registered under the WordPress REST API namespace renewal-discounts/v1.

Permission checks follow the base plugin's RestController: read requires the manage_woocommerce capability (or equivalent), write requires the same.

Discount Types

GET /renewal-discounts/v1/renewal-discount-types

Returns all registered discount types.

Response: Array of DataDiscountType objects (includes resolved scheme details).


Discounts

GET /renewal-discounts/v1/discounts

List discounts, optionally filtered.

Parameter Type Description
subscription int Filter by subscription ID
order int Filter by order ID

Response: Array of DataDiscount objects (includes resolved type and order_edit_url).


POST /renewal-discounts/v1/discounts

Create a new pending discount for a subscription.

Parameter Type Required Description
subscription int Yes WooCommerce Subscription ID
type int Yes DataDiscountType.id
amount numeric Yes Amount (currency or percentage depending on scheme)
created_via string No Source label (defaults to rest)

Response: The created DataDiscount object.

Errors: 400 on missing/invalid params; 500 on unexpected errors.


GET /renewal-discounts/v1/discounts/{id}

Retrieve a single discount by ID.

Response: Single DataDiscount object.