Skip to content

Runtime_InitiateCheckout#


Description#

This function allows you to initiate a Checkout Session in Miva without validating bill to or ship to fields. This function is intended to be called prior to calling Runtime_UpdateShipping or Runtime_UpdateBilling.

Request Body Parameters#

Parameter
Type Description
Session_Type String This will always be “runtime”
Session_ID String The Session ID of the basket

Response Parameters#

Parameter
Type Description
success boolean Boolean value for if the request was successful
total Number Basket total
subtotal Number Basket Subtotal
formatted_total String Currency formatted total
formatted_subtotal String Currency formatted subtotal
ready_for_checkout Number Returns 0 or 1. If 0, a ready_for_checkout_reason will be provided
ready_for_checkout_reason String Reason session is not ready for checkout. Possible reasons include:
1. Missing shipping
2. Missing Tax
3. Missing shipping and tax
charges Object Object containing the basket charges array (added in Version 10.10.01)

charges Object#

Parameter
Type Description
type String Specifies the type of charge, such as “Shipping”, “Handling”, or “Tax”.
descrip String Provides a short description or label for the charge.
amount Number The raw amount of the charge
disp_amt Number The amount to be displayed to the user, often identical to amount unless modified for display.
tax_exempt Boolean Indicates whether the charge is tax-exempt (true) or taxable (false).
tax Number The tax amount associated with the charge, if applicable.
formatted_amount String The formatted version of amount as a string.
formatted_disp_amt String The formatted version of disp_amt.
formatted_tax String The formatted version of the tax field as a string.

Note

Content-Type for the request must be ‘application/json’

Example Request#

{
    "Store_Code": "{{Store_Code}}",
    "Miva_Request_Timestamp": "{{$timestamp}}",
    "Function": "Runtime_InitiateCheckout",
    "Session_Type": "runtime",
    "Session_ID": "5bd2d2eca80b00dc79e44883a6dbbbb7"
}

Example Response#

{
    "success": 1,
    "data": {
        "total": 10.0,
        "subtotal": 10.0,
        "formatted_total": "$10.00",
        "formatted_subtotal": "$10.00",
        "ready_for_checkout": false,
        "ready_for_checkout_reason": "Missing shipping",
        "charges":
        [
            {
                "type":               "TAX",
                "descrip":            "Tax",
                "amount":             12.34,
                "disp_amt":           12.34,
                "tax_exempt":         true,
                "tax":                0.00,
                "formatted_amount":   "$12.34",
                "formatted_disp_amt": "$12.34",
                "formatted_tax":      "$0.00"
            }
        ]
    }
}