Affiliates
Affiliate earnings enter your existing Oblien account balance. An optional namespace categorizes offers and earnings; it does not create a separate wallet. Open Dashboard → Billing → Affiliates to create a link and matching coupon code, revoke a link, or inspect customer renewals and payment history.
Oblien assigns the total allowance and reward duration. You choose the buyer's discount within that allowance. For example, on a $40 invoice, a 20% allowance provides $8: a 5% buyer discount saves $2, and you earn the remaining $6. This is an arithmetic example; your available policy determines the actual rate.
Create a link
import Oblien from 'oblien';
const client = new Oblien({ token: process.env.OBLIEN_TOKEN! });
const { policies } = await client.affiliates.catalog();
if (!policies.length) throw new Error('Ask Oblien to assign an affiliate policy.');
const { offer } = await client.affiliates.createOffer({
policyId: policies[0].id,
name: 'Launch offer',
namespace: 'openship', // Optional; must belong to your account.
discountBps: 500, // 5%, bounded by your policy's allowance.
idempotencyKey: 'launch-offer-v1',
});
console.log(offer.url, offer.code);Share offer.url. The buyer sees the terms, signs in or creates an account,
chooses an eligible monthly VM, and reviews the discounted Stripe payment.
Links can optionally restrict the initial VM plan or have an expiry date.
The approved rate and reward period follow that subscription through supported
VM size changes; proration adjustments do not earn an extra commission.
Customers, renewals and earnings
const customers = await client.affiliates.referrals({
namespace: 'openship', limit: 25, offset: 0,
});
for (const customer of customers.items) {
console.log(customer.customer, customer.status, customer.paidThrough);
console.log(customer.nextRenewalAt, customer.rewardsUntil, customer.earned);
const payments = await client.affiliates.payments(customer.id, {
namespace: 'openship', limit: 25,
});
console.log(payments.items);
}
await client.affiliates.revokeOffer(offer.id, { namespace: 'openship' });Customer emails are masked. Records include paid-through dates, renewal state, paid-invoice counts, commission expiry, and per-invoice credits and reversals. They provide no access to customer resources. Revoking a link stops new referrals; already-accepted checkouts and subscriptions keep their terms.
Only verified paid invoices earn commission. Refunds and disputes reverse the
corresponding earnings, including amounts already spent. Credited totals are
historical net credits, not your account's remaining balance. The existing webhook
service emits affiliate.commission_credited and affiliate.commission_reversed.
HTTP endpoints
All paths below begin with /billing/affiliates.
| Method | Path | Result |
|---|---|---|
| GET | /codes/:code | Public offer terms |
| GET | /catalog | Assigned policies and eligible products/plans |
| POST | /offers | New immutable offer; requires idempotencyKey |
| GET | /offers | Owned links/codes and status |
| POST | /offers/:id/revoke | Stop new referrals; send {} |
| GET | /summary | Account earnings and conversion totals |
| GET | /referrals | Owned customers and renewal state |
| GET | /referrals/:id/payments | Invoice-level earnings history |
Management requires account billing/admin authentication or a namespace key.
Namespace keys can access only their bound namespace; workspace keys are not
accepted. Lists accept limit (1–100), offset, and optional namespace.
Referrals also accept offerId. Amounts are integer USD cents; rates use basis
points (500 = 5%).
For a custom buyer flow, resolve the public code, use the existing
billing.previewCapacity monthly Stripe quote, then pass affiliateCode and
allowPromotionCodes: true to billing.capacityCheckout. The backend derives
the eligible price and commission. Codes cannot stack with other discounts.
The initial product is direct monthly VM capacity, including capacity bought for your own namespace. Wallet deposits, PAYG, account credit plans, and arbitrary reseller retail offers do not qualify. No live commission rate is enabled until Oblien explicitly assigns a policy.