List coupons

View as Markdown
## List coupons for a payment request Returns the coupons associated with the payment request identified by `:id`. Internally the payment request's id is injected as `forPaymentLinkId` into the coupon query, so only coupons that apply to this request are returned. The request must belong to the store resolved from the API key (a 404/validation error is raised otherwise). ### Authentication Send the merchant API key in `x-api-key` (alias `x-account-api-key`). Requires scope `Merchant.payment_link.read`. Optionally scope to a store with `x-application-account-id`. ### Path parameters - `id` — the payment request id. ### Query parameters (coupon filter) - `page`, `per_page` — pagination (defaults 1 / 10). - `discountType` — `ONE_TIME`, `REPEATING`, `UNLIMITED`. - `discountKind` — `FIXED`, `PERCENTAGE`. - `status` — `ACTIVE`, `INACTIVE`, `EXPIRED`, `MAXED_OUT`. - `paymentRequestApplicability` — `ALL`, `SPECIFIC`, `NONE`. - `filter` — free-text search across coupon `code`, `name`, `description`. - `sort` / `sorter` — order by allowed fields `code`, `createdAt`, `name`. There is **no request body**. --- **Notas:** Handler: paymentLinksService.getCoupons -> couponService.findMany with forPaymentLinkId injected from the path id. Accepts deprecated alias paths GET /v1/payment-links/:id/coupons and GET /v1/payment-link/:id/coupons. Coupon record shape is inferred from the Coupons model.

Authentication

x-api-keystring
API Key authentication via header

Path parameters

idstringRequired
Id of the payment request whose coupons are listed.

Headers

x-application-account-idstringOptional

Scope the request to a specific store / account instead of the one resolved from the API key. Aliases: the x-account-id header, or the application_account_id / account_id query parameter.

Query parameters

pageintegerOptionalDefaults to 1
Page number to return.
per_pageintegerOptionalDefaults to 10
Number of records per page.
discountTypeenumOptional
Filter by how often the coupon can be redeemed.
Allowed values:
discountKindenumOptional
Filter by how the discount is calculated.
Allowed values:
statusenumOptional
Filter by coupon status.
Allowed values:
paymentRequestApplicabilityenumOptional
Filter by which payment requests the coupon applies to.
Allowed values:
filterstringOptional
Filter with the query language. Accepts a string expression or a URL-encoded JSON object following Prisma's `where` clause. **Allowed fields:** `code`, `name`, `description` **Allowed operators:** `equals`, `not`, `in`, `notIn`, `lt`, `lte`, `gt`, `gte`, `contains`, `startsWith`, `endsWith`, `like` **String format:** `field:operator:value`, comma-separated. The operator defaults to `equals` (`field:value`), and `|` works as a separator. Group with `AND(...)` or `OR(...)` — `AND` is the default. **JSON format:** `{"OR":[{"name":{"contains":"Jane"}}]}`
sortstringOptional
Sort by one or more fields, comma-separated. **Allowed fields:** `code`, `createdAt`, `name` **Formats:** `field` (ascending by default), `+field`, `-field`, `field:asc`, `field:desc` (`|` also works as the separator).
sorterstringOptional

Alternative to sort: a JSON string mapping a field to a direction (asc / desc).

Allowed fields: createdAt, name, code