Desktop software
Perpetual license
Section titled “Perpetual license”import { Access, Billing, Licensing, Offer, Purchase } from "@byfungsi/sapa";import { Effect } from "effect";
export const perpetualDesktop = Effect.gen(function* () { const access = yield* Access.entitlements({ entitlements: ["desktop.use"], duration: "perpetual", }); const licensing = yield* Licensing.eligibility({ entitlement: "desktop.use", activationLimit: 3, }); const purchase = yield* Purchase.parse({ key: "desktop.perpetual.access", revision: 1, provides: [access, licensing], }); const billing = yield* Billing.oneTime({ price: { currency: "IDR", amount: 1_499_000n }, }); return yield* Offer.parse({ key: "desktop.perpetual", revision: 1, purchase, billing, });});Perpetual app with one year of updates
Section titled “Perpetual app with one year of updates”import { Credits } from "@byfungsi/sapa";
export const desktopBundle = Effect.gen(function* () { const appAccess = yield* Access.entitlements({ entitlements: ["desktop.use"], duration: "perpetual", }); const updateAccess = yield* Access.entitlements({ entitlements: ["desktop.updates"], duration: { type: "fixed", months: 12, anchor: "settlement", calendar: "utc_clamped", }, }); const credits = yield* Credits.pack({ unit: "desktop.processing", quantity: 1_000n, }); const purchase = yield* Purchase.parse({ key: "desktop.bundle.benefits", revision: 1, provides: [appAccess, updateAccess, credits], }); const billing = yield* Billing.oneTime({ price: { currency: "IDR", amount: 1_999_000n }, }); return yield* Offer.parse({ key: "desktop.bundle", revision: 1, purchase, billing, });});Each benefit expires independently. After twelve months the customer keeps app access and unused processing credits but loses update access.
For subscription licensing, change the entitlement duration to
purchased_period and billing to subscription. Online validation then follows
settled subscription periods.