Skip to content

Add coupon / promo-code support #36

Description

@sandervanhooft

We're tracking this issue here as a reference point for downstream integrations.

Problem

There is no coupon / promo-code surface anywhere in api-php today:

  • No Coupon resource class.
  • No CouponEndpoint for listing / fetching codes.
  • No couponCode field on SubscriptionEndpoint::create() or CheckoutEndpoint::create() pre-fill payloads.

This blocks fluent from offering coupon helpers (see vatly/vatly-fluent-php#67). Consumers can't run promo campaigns through the SDK — they'd have to fall back to raw HTTP, assuming the API even exposes coupons (see open question).

Surface change

Minimum viable surface:

  • Vatly\API\Resources\Coupon — id, code, status, discount-type (percent / amount), discount-value, redemptions-used / -limit, expires-at.
  • Vatly\API\Resources\CouponCollection for paging.
  • Vatly\API\Endpoints\CouponEndpoint with get(string \$id), getByCode(string \$code) (or equivalent), page(...).
  • couponCode parameter (string) on subscription-create and checkout-create payloads.

Optionally a Vatly\API\Types\AppliedDiscount shape carried back on Subscription / Order resources to show what was actually applied.

Open question

Does Vatly's HTTP API support coupons / promo codes today? If not, this is upstream-blocked on the API itself. The shape above is the minimum needed once the API exposes it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions