Budget API

The Sublogin Budget API allows management of order limits and periodic budgets for both main customers and sublogins.

Base URL

https://yourstore.com/rest/V1/sublogin-budget

Endpoints

1. Get Budget by ID

GET /V1/sublogin-budget/:idACL: MageB2B_SubloginBudget::budget_manage

2. Search Budgets

GET /V1/sublogin-budget/searchACL: MageB2B_SubloginBudget::budget_manage

3. Create Budget

POST /V1/sublogin-budgetACL: MageB2B_SubloginBudget::budget_save

4. Update Budget

PUT /V1/sublogin-budget/:idACL: MageB2B_SubloginBudget::budget_save

5. Delete Budget

DELETE /V1/sublogin-budget/:idACL: MageB2B_SubloginBudget::budget_delete

Field Reference

FieldTypeRequiredDescription
budget_idintNo (auto)Primary key
sublogin_idintConditional*ID of the sublogin user (FK to customer_sublogin.id)
customer_idintConditional*Magento Customer Entity ID (FK to customer_entity.entity_id)
budget_type_idintYesBudget period type (see below)
per_orderfloatNoMaximum amount per single order
amountfloatNoTotal budget for the period
valid_from_datestringNoStart date (YYYY-MM-DD)
statusintNo1 = active, 0 = disabled

Important: Set either sublogin_id OR customer_id, never both!

Budget Type IDs (budget_type_id)

IDLabelDescription
1YearOne-time budget for a specific calendar year
2YearlyRecurring budget, resets every year
3MonthOne-time budget for a specific calendar month
4MonthlyRecurring budget, resets every month
5DayOne-time budget for a specific calendar day
6DailyRecurring budget, resets every day
7Per OrderLimit per single order (no time period)

Extension Attributes

is_one_time (int)

If set to 1, the budget is used once and automatically disabled after one order. All other budget types are ignored while a one-time budget is active.

Examples

Create Monthly Recurring Budget for Sublogin

curl -X POST "https://yourstore.com/rest/V1/sublogin-budget" -H "Authorization: Bearer " -H "Content-Type: application/json" -d '{ "subloginBudget": { "sublogin_id": 5, "budget_type_id": 4, "per_order": 500.00, "amount": 2000.00, "status": 1 } }'

Create One-Time Budget

curl -X POST "https://yourstore.com/rest/V1/sublogin-budget" -H "Authorization: Bearer " -H "Content-Type: application/json" -d '{ "subloginBudget": { "sublogin_id": 5, "budget_type_id": 7, "amount": 500.00, "status": 1, "extension_attributes": { "is_one_time": 1 } } }'

Found an issue with this documentation? Let us know