Create sell

Requires authentication

HTTP Request

POST connector/api/sell

Body Parameters

Parameter Type Status Description
sells.*.location_id integer required id of the business location
sells.*.contact_id integer required id of the customer
sells.*.transaction_date string optional transaction date format:Y-m-d H:i:s,
sells.*.invoice_no string optional Invoice number
sells.*.status string optional sale status (final, draft)
sells.*.tax_rate_id integer optional id of the tax rate applicable to the sale
sells.*.discount_amount float optional discount amount applicable to the sale
sells.*.discount_type string optional type of the discount amount (fixed, percentage)
sells.*.sale_note string optional
sells.*.staff_note string optional
sells.*.commission_agent integer optional commission agent id
sells.*.shipping_details string optional shipping details
sells.*.shipping_address string optional shipping address
sells.*.shipping_status string optional ('ordered', 'packed', 'shipped', 'delivered', 'cancelled')
sells.*.delivered_to string optional Name of the person recieved the consignment
sells.*.shipping_charges float optional shipping amount
sells.*.packing_charge float optional packing charge
sells.*.exchange_rate float optional exchange rate for the currency used
sells.*.selling_price_group_id integer optional id of the selling price group
sells.*.pay_term_number integer optional pay term value
sells.*.pay_term_type string optional type of the pay term value ('days', 'months')
sells.*.is_recurring integer optional whether the invoice is recurring (0, 1)
sells.*.recur_interval integer optional value of the interval invoice will be regenerated
sells.*.recur_interval_type string optional type of the recur interval ('days', 'months', 'years')
sells.*.subscription_repeat_on integer optional day of the month on which invoice will be generated if recur interval type is months (1-30)
sells.*.subscription_no string optional subscription number
sells.*.recur_repetitions integer optional total number of invoices to be generated
sells.*.rp_redeemed integer optional reward points redeemed
sells.*.rp_redeemed_amount float optional reward point redeemed amount after conversion
sells.*.types_of_service_id integer optional types of service id
sells.*.service_custom_field_1 string optional types of service custom field 1
sells.*.service_custom_field_2 string optional types of service custom field 2
sells.*.service_custom_field_3 string optional types of service custom field 3
sells.*.service_custom_field_4 string optional types of service custom field 4
sells.*.round_off_amount float optional round off amount on total payable
sells.*.table_id integer optional id of the table
sells.*.service_staff_id integer optional id of the service staff assigned to the sale
sells.*.change_return float optional Excess paid amount
sells.*.products array required array of the products for the sale
sells.*.payments array optional payment lines for the sale
sells.*.products.*.product_id integer required product id
sells.*.products.*.variation_id integer required variation id
sells.*.products.*.quantity float required quantity
sells.*.products.*.unit_price float optional unit selling price
sells.*.products.*.tax_rate_id integer optional tax rate id applicable on the product
sells.*.products.*.discount_amount float optional discount amount applicable on the product
sells.*.products.*.discount_type string optional type of discount amount ('fixed', 'percentage')
sells.*.products.*.sub_unit_id integer optional sub unit id
sells.*.products.*.note string optional note for the product
sells.*.payments.*.amount float required amount of the payment
sells.*.payments.*.method string optional payment methods ('cash', 'card', 'cheque', 'bank_transfer', 'other', 'custom_pay_1', 'custom_pay_2', 'custom_pay_3')
sells.*.payments.*.account_id integer optional account id
sells.*.payments.*.card_number string optional
sells.*.payments.*.card_holder_name string optional
sells.*.payments.*.card_transaction_number string optional
sells.*.payments.*.card_type string optional
sells.*.payments.*.card_month string optional
sells.*.payments.*.card_year string optional
sells.*.payments.*.card_security string optional
sells.*.payments.*.transaction_no_1 string optional
sells.*.payments.*.transaction_no_2 string optional
sells.*.payments.*.transaction_no_3 string optional
sells.*.payments.*.bank_account_number string optional
sells.*.payments.*.note string optional payment note
sells.*.payments.*.cheque_number string optional

Example request:

curl -X POST \
"http://erp.dstadvertising.com/connector/api/sell" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-d '{"sells":[{"location_id":6,"contact_id":12,"transaction_date":"2020-07-22 15:48:29","invoice_no":"eligendi","status":"final","tax_rate_id":11,"discount_amount":10,"discount_type":"fixed","sale_note":"minus","staff_note":"et","commission_agent":6,"shipping_details":"Express Delivery","shipping_address":"labore","shipping_status":"ordered","delivered_to":"'Mr robin'","shipping_charges":10,"packing_charge":10,"exchange_rate":1,"selling_price_group_id":20,"pay_term_number":3,"pay_term_type":"months","is_recurring":0,"recur_interval":18,"recur_interval_type":"months","subscription_repeat_on":15,"subscription_no":"sed","recur_repetitions":17,"rp_redeemed":16,"rp_redeemed_amount":13.5,"types_of_service_id":2,"service_custom_field_1":"est","service_custom_field_2":"vitae","service_custom_field_3":"sed","service_custom_field_4":"fugiat","round_off_amount":69.18898323,"table_id":13,"service_staff_id":8,"change_return":0,"products":[{"product_id":17,"variation_id":58,"quantity":1,"unit_price":437.5,"tax_rate_id":0,"discount_amount":0,"discount_type":"percentage","sub_unit_id":19,"note":"est"}],"payments":[{"amount":453.13,"method":"cash","account_id":6,"card_number":"ea","card_holder_name":"esse","card_transaction_number":"libero","card_type":"sunt","card_month":"expedita","card_year":"incidunt","card_security":"dolores","transaction_no_1":"quasi","transaction_no_2":"animi","transaction_no_3":"libero","bank_account_number":"vel","note":"quis","cheque_number":"maiores"}]}]}'

Example response (200):

{
"data": [
{
"id": 6,
"business_id": 1,
"location_id": 1,
"res_table_id": null,
"res_waiter_id": null,
"res_order_status": null,
"type": "sell",
"sub_type": null,
"status": "final",
"is_quotation": 0,
"payment_status": "paid",
"adjustment_type": null,
"contact_id": 4,
"customer_group_id": null,
"invoice_no": "AS0001",
"ref_no": "",
"subscription_no": null,
"subscription_repeat_on": null,
"transaction_date": "2018-04-10 13:23:21",
"total_before_tax": "770.0000",
"tax_id": null,
"tax_amount": "0.0000",
"discount_type": "percentage",
"discount_amount": "0.0000",
"rp_redeemed": 0,
"rp_redeemed_amount": "0.0000",
"shipping_details": null,
"shipping_address": null,
"shipping_status": null,
"delivered_to": null,
"shipping_charges": "0.0000",
"additional_notes": null,
"staff_note": null,
"round_off_amount": "0.0000",
"final_total": "770.0000",
"expense_category_id": null,
"expense_for": null,
"commission_agent": null,
"document": null,
"is_direct_sale": 0,
"is_suspend": 0,
"exchange_rate": "1.000",
"total_amount_recovered": null,
"transfer_parent_id": null,
"return_parent_id": null,
"opening_stock_product_id": null,
"created_by": 1,
"import_batch": null,
"import_time": null,
"types_of_service_id": null,
"packing_charge": null,
"packing_charge_type": null,
"service_custom_field_1": null,
"service_custom_field_2": null,
"service_custom_field_3": null,
"service_custom_field_4": null,
"mfg_parent_production_purchase_id": null,
"mfg_wasted_units": null,
"mfg_production_cost": "0.0000",
"mfg_is_final": 0,
"is_created_from_api": 0,
"essentials_duration": "0.00",
"essentials_duration_unit": null,
"essentials_amount_per_unit_duration": "0.0000",
"essentials_allowances": null,
"essentials_deductions": null,
"rp_earned": 0,
"repair_completed_on": null,
"repair_warranty_id": null,
"repair_brand_id": null,
"repair_status_id": null,
"repair_model_id": null,
"repair_defects": null,
"repair_serial_no": null,
"repair_updates_email": 0,
"repair_updates_sms": 0,
"repair_checklist": null,
"repair_security_pwd": null,
"repair_security_pattern": null,
"repair_due_date": null,
"repair_device_id": null,
"order_addresses": null,
"is_recurring": 0,
"recur_interval": null,
"recur_interval_type": null,
"recur_repetitions": null,
"recur_stopped_on": null,
"recur_parent_id": null,
"invoice_token": null,
"pay_term_number": null,
"pay_term_type": null,
"pjt_project_id": null,
"pjt_title": null,
"woocommerce_order_id": null,
"selling_price_group_id": null,
"created_at": "2018-01-06 07:06:11",
"updated_at": "2018-01-06 07:06:11",
"sell_lines": [
{
"id": 1,
"transaction_id": 6,
"product_id": 2,
"variation_id": 3,
"quantity": 10,
"mfg_waste_percent": "0.0000",
"quantity_returned": "0.0000",
"unit_price_before_discount": "70.0000",
"unit_price": "70.0000",
"line_discount_type": null,
"line_discount_amount": "0.0000",
"unit_price_inc_tax": "77.0000",
"item_tax": "7.0000",
"tax_id": 1,
"discount_id": null,
"lot_no_line_id": null,
"sell_line_note": null,
"res_service_staff_id": null,
"res_line_order_status": null,
"woocommerce_line_items_id": null,
"parent_sell_line_id": null,
"children_type": "",
"sub_unit_id": null,
"created_at": "2018-01-06 07:06:11",
"updated_at": "2018-01-06 07:06:11"
}
],
"payment_lines": [
{
"id": 1,
"transaction_id": 6,
"business_id": null,
"is_return": 0,
"amount": "770.0000",
"method": "cash",
"transaction_no": null,
"card_transaction_number": null,
"card_number": null,
"card_type": "visa",
"card_holder_name": null,
"card_month": null,
"card_year": null,
"card_security": null,
"cheque_number": null,
"bank_account_number": null,
"paid_on": "2018-01-09 17:30:35",
"created_by": 1,
"payment_for": null,
"parent_id": null,
"note": null,
"document": null,
"payment_ref_no": null,
"account_id": null,
"created_at": "2018-01-06 01:36:11",
"updated_at": "2018-01-06 01:36:11"
}
]
}
]
}

javascript

const url = new URL(
"http://erp.dstadvertising.com/connector/api/sell"
);
let headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer {token}",
};
let body = {
"sells": [
{
"location_id": 6,
"contact_id": 12,
"transaction_date": "2020-07-22 15:48:29",
"invoice_no": "eligendi",
"status": "final",
"tax_rate_id": 11,
"discount_amount": 10,
"discount_type": "fixed",
"sale_note": "minus",
"staff_note": "et",
"commission_agent": 6,
"shipping_details": "Express Delivery",
"shipping_address": "labore",
"shipping_status": "ordered",
"delivered_to": "'Mr robin'",
"shipping_charges": 10,
"packing_charge": 10,
"exchange_rate": 1,
"selling_price_group_id": 20,
"pay_term_number": 3,
"pay_term_type": "months",
"is_recurring": 0,
"recur_interval": 18,
"recur_interval_type": "months",
"subscription_repeat_on": 15,
"subscription_no": "sed",
"recur_repetitions": 17,
"rp_redeemed": 16,
"rp_redeemed_amount": 13.5,
"types_of_service_id": 2,
"service_custom_field_1": "est",
"service_custom_field_2": "vitae",
"service_custom_field_3": "sed",
"service_custom_field_4": "fugiat",
"round_off_amount": 69.18898323,
"table_id": 13,
"service_staff_id": 8,
"change_return": 0,
"products": [
{
"product_id": 17,
"variation_id": 58,
"quantity": 1,
"unit_price": 437.5,
"tax_rate_id": 0,
"discount_amount": 0,
"discount_type": "percentage",
"sub_unit_id": 19,
"note": "est"
}
],
"payments": [
{
"amount": 453.13,
"method": "cash",
"account_id": 6,
"card_number": "ea",
"card_holder_name": "esse",
"card_transaction_number": "libero",
"card_type": "sunt",
"card_month": "expedita",
"card_year": "incidunt",
"card_security": "dolores",
"transaction_no_1": "quasi",
"transaction_no_2": "animi",
"transaction_no_3": "libero",
"bank_account_number": "vel",
"note": "quis",
"cheque_number": "maiores"
}
]
}
]
} fetch(url, { method: "POST", headers: headers, body: body }) .then(response => response.json()) .then(json => console.log(json));