Purchases

Record a product purchase for a trainee. Credits, expiration and membership dates are derived from the product when omitted: a punch card opens with the product credits and a one-year expiration, a membership starts immediately for the product duration.

post/api/public/purchases

Headers

Idempotency-Keystring

Optional. Send a unique key (e.g. a UUID) to make this POST safe to retry. The same key within 24h returns the original result instead of creating a duplicate.

Request body

traineeIdstring required

Trainee buying the product

productIdstring required

Product to purchase. Must be active.

purchaseAmountnumber

Amount actually charged. Defaults to the product price.

currency'ILS' | 'USD' | 'EUR' | 'GBP'

Defaults to ILS

status'ACTIVE' | 'EXPIRED' | 'CANCELLED' | 'PENDING' | 'WAITING_FOR_PAYMENT'

Defaults to ACTIVE. Use WAITING_FOR_PAYMENT to record a purchase before payment clears.

purchaseDatestring

Purchase date as YYYY-MM-DD or a full ISO-8601 date-time. Defaults to now. Use it to backdate an imported purchase.

expirationDatestring

Expiration as YYYY-MM-DD or a full ISO-8601 date-time, and never before purchaseDate. Defaults to one year from now for punch cards. A date in the past is accepted for history imports; the purchase flips to EXPIRED the first time its credits are used.

initialCreditsnumber

Punch card credits granted. PUNCH_CARD products only. Defaults to the product credits.

remainingCreditsnumber

Credits still available, and never more than initialCredits. PUNCH_CARD products only. Defaults to initialCredits; set it lower to import a partly used card.

Response

Created

Changes

No recorded changes to this endpoint across all 1 revision of this API.