Skip to content

Generate a purchase code

POST
/pcode
curl --request POST \
--url https://partner-pcode-dev.tsp.workers.dev/api/partner/v1/pcode \
--header 'Content-Type: application/json' \
--header 'x-gw: <x-gw>' \
--data '{ "productCode": "FV00", "external_reference_id": "example", "force_new": false }'

If external_reference_id is sent and a still-valid purchase code (unused, not blocked, within its 14-day window) already exists for that same reference, that SAME purchase code is returned (reused: true) instead of creating a new one — unless force_new: true is passed, which also voids any previous purchase code under that reference.

Media typeapplication/json
object
productCode
required

FV00=6 months, FV01=1 year, FV02=2 years, FV03=3 years.

string
Allowed values: FV00 FV01 FV02 FV03
external_reference_id

The partner’s own identifier, for idempotency.

string
force_new
boolean

Purchase code created (or reused — see data.reused).

Media typeapplication/json
object
success
boolean
data
object
pCode
string
productCode
string
status
string
reused
boolean
createdAt
string format: date-time
Example
{
"success": true,
"data": {
"status": "ACTIVE"
}
}

Invalid/missing productCode, or the partner doesn’t have that product enabled (partner_config.allowed_products — if that column is NULL or no config row exists, there’s no restriction and any valid productCode passes).

Media typeapplication/json
object
success
boolean
error
string
Example
{
"success": false
}

Invalid API Key.

Rate limit exceeded (60 requests/60s per partner).