Saltar para o conteúdo principal
PATCH
/
public
/
api
/
v1
/
billing
/
coupons
/
{couponPublicId}
Update coupon
curl --request PATCH \
  --url https://api.gennia.ai/public/api/v1/billing/coupons/{couponPublicId} \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "active": true,
  "maxUses": 200,
  "name": "Welcome 10% off",
  "validUntil": "2026-12-31T23:59:59Z"
}
'
{
  "active": true,
  "applicablePlans": [
    {
      "billingIntervalMonths": 123,
      "creditsIncluded": 123,
      "currency": "<string>",
      "name": "<string>",
      "priceCents": 123,
      "publicId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  ],
  "code": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "currency": "<string>",
  "discountValue": 123,
  "durationMonths": 123,
  "isExhausted": true,
  "isExpired": true,
  "maxUses": 123,
  "name": "<string>",
  "publicId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "stripeCouponId": "<string>",
  "stripePromotionCodeId": "<string>",
  "timesUsed": 123,
  "updatedAt": "2023-11-07T05:31:56Z",
  "validFrom": "2023-11-07T05:31:56Z",
  "validUntil": "2023-11-07T05:31:56Z"
}

Autorizações

X-Api-Key
string
header
obrigatório

Parâmetros de caminho

couponPublicId
string<uuid>
obrigatório

Corpo

application/json

Body for updating an existing coupon. Coupons are largely immutable post-creation; only name, active, maxUses and validUntil can change.

active
boolean

Activate or deactivate the coupon. Synced with the Stripe promotion code.

Exemplo:

true

maxUses
integer<int32>

New maximum total redemptions. Must be >= current redemption count.

Intervalo necessário: x >= 1
Exemplo:

200

name
string

New internal display name for the coupon.

Maximum string length: 100
Exemplo:

"Welcome 10% off"

validUntil
string<date-time>

New end of the validity window.

Exemplo:

"2026-12-31T23:59:59Z"

Resposta

OK

active
boolean
applicablePlans
object[]
code
string
createdAt
string<date-time>
currency
string
discountType
enum<string>
Opções disponíveis:
percentage,
fixed_amount
discountValue
integer<int32>
duration
enum<string>
Opções disponíveis:
once,
repeating,
forever
durationMonths
integer<int32>
isExhausted
boolean
isExpired
boolean
maxUses
integer<int32>
name
string
publicId
string<uuid>
scope
enum<string>
Opções disponíveis:
hub,
plans
stripeCouponId
string
stripePromotionCodeId
string
timesUsed
integer<int32>
updatedAt
string<date-time>
validFrom
string<date-time>
validUntil
string<date-time>