Skip to content

Order_Create_FromOrder#

Description#

This function allows you to create a new order, using a previous order id as a reference. This function takes the reference order as request parameter and will return the new order in the response. This function behaves identical to clicking the “New Order” button on the order detail screen in the admin. It copies the following data: Customer Assignment, Bill To, Ship To, and saved card (if using MivaPay). Item, shipping, Tax, and Discount data are not copied.

Requirements#

Available in Version 9.13 or greater

Request Body Parameters#

Parameter
Type Description
Order_Id Number This is the reference Order Id to copy data from when creating the new order.

Response Parameters#

Parameter
Type Description
id Number Order Number for the Order
pay_id Number Id of Payment Module Used in transaction
batch_id Number Batch ID
status Number Order Status. 0 = Pending, 100 = Processing, 200 = Shipped, 201 = Partially Shipped, 300 = Cancelled, 400 = Backordered, 500 = RMA Issued, 600 = Returned
pay_status Number Payment Status. 0 = Pending, 100 = Authorized, 200 = Captured, 201 = Partially Captured
stk_status Number Stock Status. 0 = Pending, 100 = yes, 200 = no, 201 = partial
dt_instock Unix Timestamp Date/Time Instock (Unix timestamp). 0 if Not set
orderdate Unix Timestamp Order Date
cust_id Number Customer ID
ship_res Boolean Ship Residential Flag
ship_fname String Shipping First Name
ship_lname String Shipping Last Name
ship_email String Shipping Email Address
ship_comp String Shipping Company
ship_phone String Shipping Phone Number
ship_fax String Shipping Fax Number
ship_addr1 String Shipping Address Line 1
ship_addr2 String Shipping Address Line 2
ship_city String Shipping City
ship_state String Shipping State
ship_zip String Shipping Zip
ship_cntry String Shipping Country
bill_fname String Billing First Name
bill_lname String Billing Last Name
bill_email String Billing Email Address
bill_comp String Billing Company
bill_phone String Billing Phone Number
bill_fax String Billing Fax Number
bill_addr1 String Billing Address Line 1
bill_addr2 String Billing Address Line 2
bill_city String Billing City
bill_state String Billing State
bill_zip String Billing Zip
bill_cntry String Billing Country
ship_id Number Shipping Module Used in Shipping Calculations
ship_data String Shipping Data - Typically Shipping Method Name
ship_method String Shipping Method Name
cust_login String Customer Login
cust_pw_email String Customer Email Password
business_title String Business Title
payment_module String Payment Module Name
source String Source of how the order was placed. Possible Values include “Shopper”, “Subscription”, “User”
source_id Number The id of the customer, id of Admin user or id of subscription based on how order was placed
total Number Total
formatted_total String Formatted Total
total_ship Number Total Shipping
formatted_total_ship String Formatted Total Shipping
total_tax Number Total Tax
formatted_total_tax String Formatted Total Tax
total_auth Number Total Authorized
formatted_total_auth String Formatted Total Authorized
total_capt Number Total Captured
formatted_total_capt String Formatted Total Captured
total_rfnd Number Total Amount Refunded
formatted_total_rfnd String Formatted Total Amount Refunded
net_capt Number Net Amount Captured
formatted_net_capt String Formatted Net Amount Captured
pend_count Number Pending Item Count
bord_count Number Backordered Item Count
note_count Number Note Count

Example Request#

{
    "Store_code": "beta",
    "Function": "Order_Create_FromOrder",
    "Order_ID": 1017
}

Example Response#

{
    "success": 1,
    "data": {
        "id": 1034,
        "pay_id": 0,
        "batch_id": 0,
        "status": 0,
        "pay_status": 0,
        "stk_status": 0,
        "dt_instock": 0,
        "orderdate": 1551813654,
        "cust_id": 0,
        "ship_res": false,
        "ship_fname": "Brennan",
        "ship_lname": "Heyde",
        "ship_email": "bheyde@miva.com",
        "ship_comp": "MIva, Inc",
        "ship_phone": "8587314220",
        "ship_fax": "",
        "ship_addr1": "16745 W. Bernardo Dr, Fourth Floor",
        "ship_addr2": "",
        "ship_city": "San Diego",
        "ship_state": "CA",
        "ship_zip": "92127",
        "ship_cntry": "US",
        "bill_fname": "Brennan",
        "bill_lname": "Heyde",
        "bill_email": "bheyde@miva.com",
        "bill_comp": "MIva, Inc",
        "bill_phone": "8587314220",
        "bill_fax": "",
        "bill_addr1": "16745 W. Bernardo Dr, Fourth Floor",
        "bill_addr2": "",
        "bill_city": "San Diego",
        "bill_state": "CA",
        "bill_zip": "92127",
        "bill_cntry": "US",
        "ship_id": 0,
        "ship_data": "",
        "ship_method": "None",
        "source": "",
        "source_id": 0,
        "total": 0.0,
        "formatted_total": "$0.00",
        "total_ship": 0.0,
        "formatted_total_ship": "$0.00",
        "total_tax": 0.0,
        "formatted_total_tax": "$0.00",
        "total_auth": 0.0,
        "formatted_total_auth": "$0.00",
        "total_capt": 0.0,
        "formatted_total_capt": "$0.00",
        "total_rfnd": 0.0,
        "formatted_total_rfnd": "$0.00",
        "net_capt": 0.0,
        "formatted_net_capt": "$0.00",
        "pend_count": 0,
        "bord_count": 0,
        "note_count": 0
    }
}