Posting an Order
Posting an Order
POST Endpoint:
https://strapi-3apoh.ondigitalocean.app/api/live-ordersRequest Body:
amount: number;considerationPrice: number;description: string;firstPartyAddress: string;firstPartyMobileNumber: string;firstPartyName: string;firstPartyPan: string;paidBy: string; # "First Party" | "Second Party"purpose: string;secondPartyAddress: string;secondPartyName: string;secondPartyPan: string;state: string;purchasedBy: string;Example Response:
{ "message": "Successfully created the order!", "orderId": "<order-id>"}Validation rules (what the API checks):
Section titled “Validation rules (what the API checks):”- Purpose and state must exist: We look up the combination of
purposeandstate. If not found, the request fails. - When the purpose follows consideration price (
toFollowConsiderationPrice):considerationPricemust be > 0.amountis calculated by the server as:considerationPrice * amountPercentConsideration, then clamped to the allowed range. If the purpose has afixedamount, that fixed value is used as both min and max.
- When the purpose does NOT follow consideration price:
- If the purpose has a
fixedamount, youramountmust equal that fixed value. - If the purpose has a range (min/max), your
amountmust be within that range (inclusive).
- If the purpose has a
- Type validation: All fields are type-checked. Invalid types or missing required fields will result in a
400 Bad Requestwith details.
For more details on available purposes and their configuration (fixed/min/max, percentage), see the Organization portal: Article List.
If any validation fails, the API returns an appropriate error message with a status code of 4xx.
Error Responses
Section titled “Error Responses”| Status | When it happens | Example message |
|---|---|---|
| 200 | Order created successfully | Successfully created the order! |
| 400 | Invalid input schema or types | Invalid data. plus details per field |
| 400 | Purpose follows consideration price but considerationPrice <= 0 | Consideration price is required to be greater than 0 for the selected purpose. Please provide a valid consideration price. |
| 400 | Purpose has fixed amount and provided amount differs | The purpose have a fixed amount of: <fixed>, while the amount passed is equal to: <amount> |
| 400 | Purpose has range and provided amount is out of bounds | The purpose can take an amount in the range of: <min>-<max>, while the amount passed is equal to: <amount> |
| 403 | User is not authenticated (Bearer token not provided) | ForbiddenError |
| 404 | Purpose/state combination not found | Purpose with the name: <purpose> cannot be found. |
Sample Requests:
Section titled “Sample Requests:”curl -X POST https://strapi-3apoh.ondigitalocean.app/api/live-orders \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <your-token>" \ -d '{ "amount": 1000, "considerationPrice": 1200, "description": "Sample Order", "firstPartyAddress": "123 Street", "firstPartyMobileNumber": "9876543210", "firstPartyName": "John Doe", "firstPartyPan": "ABCDE1234F", "paidBy": "First Party", "purpose": "Loan Agreement [5(d)]", "secondPartyAddress": "456 Avenue", "secondPartyName": "Jane Smith", "secondPartyPan": "XYZAB9876P", "state": "Rajasthan", "purchasedBy": "John Doe" }'fetch("https://strapi-3apoh.ondigitalocean.app/api/live-orders", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Bearer <your-token>" }, body: JSON.stringify({ amount: 1000, considerationPrice: 1200, description: "Sample Order", firstPartyAddress: "123 Street", firstPartyMobileNumber: "9876543210", firstPartyName: "John Doe", firstPartyPan: "ABCDE1234F", paidBy: "First Party", purpose: "Loan Agreement [5(d)]", secondPartyAddress: "456 Avenue", secondPartyName: "Jane Smith", secondPartyPan: "XYZAB9876P", state: "Rajasthan", purchasedBy: "John Doe" })})import axios from 'axios';
const data = { amount: 1000, considerationPrice: 1200, description: "Sample Order", firstPartyAddress: "123 Street", firstPartyMobileNumber: "9876543210", firstPartyName: "John Doe", firstPartyPan: "ABCDE1234F", paidBy: "First Party", purpose: "Loan Agreement [5(d)]", secondPartyAddress: "456 Avenue", secondPartyName: "Jane Smith", secondPartyPan: "XYZAB9876P", state: "Rajasthan", purchasedBy: "John Doe"};
axios.post('https://strapi-3apoh.ondigitalocean.app/api/live-orders', data, { headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer <your-token>' }})import requests
url = "https://strapi-3apoh.ondigitalocean.app/api/live-orders"headers = { "Content-Type": "application/json", "Authorization": "Bearer <your-token>"}data = { "amount": 1000, "considerationPrice": 1200, "description": "Sample Order", "firstPartyAddress": "123 Street", "firstPartyMobileNumber": "9876543210", "firstPartyName": "John Doe", "firstPartyPan": "ABCDE1234F", "paidBy": "First Party", "purpose": "Loan Agreement [5(d)]", "secondPartyAddress": "456 Avenue", "secondPartyName": "Jane Smith", "secondPartyPan": "XYZAB9876P", "state": "Rajasthan", "purchasedBy": "John Doe"}
response = requests.post(url, json=data, headers=headers)