Start a free trial or a subscription paid by invoice
/api/v1/subscriptionsWith trialDays, starts a free trial: the subscription is trialing and grants its features until the trial ends, and nothing is charged. With collectionMethod send_invoice and daysUntilDue, starts a subscription paid by invoice, for any amount: it is active at once and grants its features for the first period, which starts now. Its first invoice, of kind START, opens at once, is due daysUntilDue days later and is emailed to the customer with its pay link. The customer can pay through the pay link, or you record a payment made another way. If the invoice is still unpaid at its dueAt, the subscription becomes past_due, and it expires after your daysToPay. When your invoiceStartAccess billing setting is after_payment, the subscription starts incomplete instead and grants no features: paying the first invoice in full makes it active, with its first period starting at that payment, and if it is not paid in full by its dueAt plus your daysToPay the subscription expires. A part payment changes nothing. Each renewal invoice of a subscription paid by invoice opens when its period ends and is due daysUntilDue days later. The subscription is past_due from the period end until the invoice is paid, and expires at the due date if it is still unpaid. With trialDays and send_invoice together, the trial runs as above and the invoice that follows it opens when the trial ends, is due daysUntilDue days later and is emailed to the customer with its pay link. The customer must have an email address. A subscription paid through checkout without a trial starts with a payment: create a checkout session with mode subscription for it. Send a unique Idempotency-Key. Repeating the request with the same key and body returns the original.
Authorization
bearerAuth An access token from POST /api/v1/oauth/token, sent as Authorization: Bearer <token>.
In: header
Header Parameters
A unique key you choose for this request: 1 to 255 visible ASCII characters, no spaces. A UUID works well. Never put personal data in it. Send the same key again to retry safely.
The API version to use for this request, a date such as 2026-11-06. Without it the request uses your default version for the mode of your key. An unknown version answers 400 api_version_invalid.
Value in
- "2026-11-06"
Request Body
application/json
A free trial, or a subscription collected by invoice, to start for a customer.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api-malipo.flex.co.tz/api/v1/subscriptions" \ -H "Authorization: Bearer <token>" \ -H "Idempotency-Key: 5f1c1e0a-3b7e-4c8e-9d1a-2f6b8a4c7e11" \ -H "FlexMalipo-Version: 2026-11-06" \ -H "Content-Type: application/json" \ -d '{ "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac", "items": [ { "price": "296c3962-8fad-4bbf-a476-e2a5d4fe62a6" } ] }'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "customerId": "87d8e330-2878-4742-a86f-dbbb3bf522ac", "customer": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "name": "Amina Juma", "email": "amina@example.com", "phone": 255744553111, "externalId": "user_8841", "locale": "en", "metadata": { "property1": "string", "property2": "string" }, "zeroUsageInvoice": "follow", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }, "status": "active", "items": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "priceId": "b245ceea-4bc7-4619-ae4c-559a1faf418e", "price": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "productId": "dcd53ddb-8104-4e48-8cc0-5df1088c6113", "product": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "name": "Pro plan", "description": "Everything in Basic, plus reports.", "active": true, "metadata": { "property1": "string", "property2": "string" }, "features": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "livemode": true, "lookupKey": "queues", "name": "Queues", "description": "string", "limit": 15, "limitPerSeat": true, "createdAt": "2019-08-24T14:15:22Z" } ], "defaultPriceId": "c79663b6-9012-4d9a-bc6f-db5a00400fac", "defaultPrice": {}, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "brandId": "0e9bcbb3-096e-49f9-aeea-7a13a201eff5" }, "type": "RECURRING", "unitAmount": 15000, "unitAmountDecimal": 15000, "currency": "TZS", "interval": "MONTH", "intervalCount": 1, "maxPeriods": 12, "active": true, "lookupKey": "pro_monthly", "metadata": { "property1": "string", "property2": "string" }, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "usageType": "FLAT", "meter": "08cfef1f-f291-40f5-b1b8-05ac0989f419", "pricingModel": "PER_UNIT", "tiers": [ { "upTo": 1000, "unitAmount": 3, "unitAmountDecimal": 0.5, "flatAmount": 2000 } ], "rates": [ { "dimensions": { "network": "vodacom" }, "unitAmount": 3, "unitAmountDecimal": 3 } ], "subscriptionCount": 3 }, "usageType": "FLAT", "quantity": 1, "meterId": "e6fc0364-7430-4b9c-ab62-413ce7e2f3ee", "nextPriceId": "93df8cb9-3a06-41a4-b6a9-9ff93f3029ef", "nextQuantity": 0, "pendingAdd": true, "pendingRemove": true, "startsAt": "2019-08-24T14:15:22Z", "endsAt": "2019-08-24T14:15:22Z" } ], "billingAnchor": "2019-08-24T14:15:22Z", "paidThrough": "2019-08-24T14:15:22Z", "trialEnd": "2019-08-24T14:15:22Z", "canceledAt": "2019-08-24T14:15:22Z", "accessEndsAt": "2019-08-24T14:15:22Z", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "collectionMethod": "checkout", "daysUntilDue": 30, "cancelAtPeriodEnd": false, "cancelAt": "2019-08-24T14:15:22Z", "endedAt": "2019-08-24T14:15:22Z", "cancellationDetails": { "reason": "cancellation_requested", "feedback": "too_expensive", "comment": "string" }, "metadata": { "property1": "string", "property2": "string" }, "brandId": "0e9bcbb3-096e-49f9-aeea-7a13a201eff5", "trialUsage": { "mode": "free_up_to", "amount": 5000, "currency": "TZS" }}