AgroPulse subscriptions let buyers arrange recurring produce orders from a specific farmer at a chosen frequency — daily, weekly, or monthly. Once a subscription is active, the platform automatically generatesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/OluwagbeminiyiA/agro_pulse-API/llms.txt
Use this file to discover all available pages before exploring further.
SubscriptionOrder records on each cycle and tracks payment status for every order through the SubscriptionPayment model.
Subscription model fields
| Field | Type | Description |
|---|---|---|
id | UUID | Primary key, auto-generated |
buyer | FK | The BuyerProfile that owns this subscription |
farmer | FK | The FarmerProfile supplying the produce |
produce | FK | The Produce item being ordered |
frequency | string | Delivery cadence: DAILY, WEEKLY, or MONTHLY |
expected_quantity | integer | Number of units expected per order cycle |
next_expected_order_date | date | Date the next SubscriptionOrder is scheduled for |
status | string | Lifecycle state: ACTIVE, PAUSED, or CANCELLED |
active | boolean | True when the subscription is actively generating orders |
subscription_start_date | date | Date the subscription was created (auto-set) |
subscription_end_date | date | Date the subscription was cancelled; null while active |
Create a subscription
Send aPOST request to /api/subscriptions/ with the buyer’s farmer, produce, and schedule details.
The
unique_together constraint on (buyer, farmer, produce) means each buyer can hold only one subscription per farmer-produce combination. Attempting to create a duplicate returns a 400 validation error.View your subscriptions
List all subscriptions visible to the authenticated user:status, frequency, or active:
Pause a subscription
Pausing a subscription setsstatus to PAUSED and active to false. No new SubscriptionOrder records are generated while paused.
Resume a subscription
Resuming a paused subscription setsstatus back to ACTIVE and active to true. Order generation resumes from the next scheduled date.
Cancel a subscription
Cancelling a subscription setsstatus to CANCELLED, active to false, and records subscription_end_date as today. A cancelled subscription cannot be resumed.
Subscription orders
SubscriptionOrder records are created automatically each time an active subscription fires. Each order captures the quantity, unit price, total amount, and scheduled date for that cycle.
| Field | Type | Description |
|---|---|---|
id | UUID | Primary key, auto-generated |
subscription | FK | The parent Subscription |
order_id | UUID | Optional link to a corresponding Order record |
quantity | integer | Units ordered for this cycle |
unit_price | decimal | Price per unit at the time the order was generated |
total_amount | decimal | quantity × unit_price |
order_status | string | PENDING, CONFIRMED, DELIVERED, FAILED, or SKIPPED |
scheduled_date | date | The date this order was due |
Subscription payments
EachSubscriptionOrder has a corresponding SubscriptionPayment record that tracks whether the buyer has paid for that cycle.
| Field | Type | Description |
|---|---|---|
id | UUID | Primary key, auto-generated |
subscription_order | FK | One-to-one link to the SubscriptionOrder |
amount | decimal | Amount charged for this payment |
payment_status | string | PENDING, COMPLETED, FAILED, or REFUNDED |
payment_method | string | Payment method used (default: auto) |
payment_date | datetime | Timestamp of successful payment; null while pending |