Manual to Implementing the Init API

The Init API is primarily used to initialize a new Order from Arrow and generating a new Order token.

Before doing a POST request to Init API, one must pass the required data following a few Steps.

Steps to passing data in Init API:

Essentially the parameters are passed in the Init API are:

Variable

Type

Description

data

String

Encrypted json data. Encoded with base64

username

username

Merchant username

📘

'username' is provided at the Seller Portal

Creating 'data' parameter JSON

The components that needs to be passed in JSON for 'data' are

Example JSON

{
            "items": [
                {
                    "name": "Arrow Ruby Vertical Hoodie",
                    "quantity": "1",
                    "image": "https://cdn.shopify.com/s/files/1/0589/5615/3026/products/Tamplate-hoodie-ruby-front-vertical.jpg?v=1628061618",
                    "description": "<div class=\"inspect_panels--contentProperty--2Z1QI text--fontPos11--RSei3 text--_fontBase--YWDo0 ellipsis--ellipsisAfter8Lines--2rn32 ellipsis--_ellipsisAfterNLines--26JkZ\" data-mce-fragment=\"1\">Everyone needs a basic Ruby Hoodie that goes with anything, and can do anything. It's understated while being bold. It's loud if you want it to be loud, or it's subtle if you need it to be subtle. The high quality means it will look just as good today as it does in five years.</div>\n<div class=\"inspect_panels--contentProperty--2Z1QI text--fontPos11--RSei3 text--_fontBase--YWDo0 ellipsis--ellipsisAfter8Lines--2rn32 ellipsis--_ellipsisAfterNLines--26JkZ\" data-mce-fragment=\"1\"><br data-mce-fragment=\"1\"></div>\n<div class=\"inspect_panels--contentProperty--2Z1QI text--fontPos11--RSei3 text--_fontBase--YWDo0 ellipsis--ellipsisAfter8Lines--2rn32 ellipsis--_ellipsisAfterNLines--26JkZ\" data-mce-fragment=\"1\"><strong data-mce-fragment=\"1\">Details</strong></div>\n<div class=\"inspect_panels--contentProperty--2Z1QI text--fontPos11--RSei3 text--_fontBase--YWDo0 ellipsis--ellipsisAfter8Lines--2rn32 ellipsis--_ellipsisAfterNLines--26JkZ\" data-mce-fragment=\"1\">\n<ul data-mce-fragment=\"1\">\n<li data-mce-fragment=\"1\">Premium print on authentic Lululemon 5 Year Basic Tee</li>\n<li data-mce-fragment=\"1\">Designed for people on the move</li>\n<li data-mce-fragment=\"1\">Pima cotton blended with Lyocell for optimal softness</li>\n<li data-mce-fragment=\"1\">A comfortable fit that hangs on your body</li>\n<li data-mce-fragment=\"1\">70% Pima cotton, 24% Lyocell, 6% Lycra® elastane\ufeff</li>\n</ul>\n</div>",
                    "option": "S",
                    "extraData": {
                        "variant_id": "40569979699394",
                        "shopify": {
                            "variant": {
                                "id": 40569979699394,
                                "product_id": 6903699538114,
                                "title": "S",
                                "price": "86.00",
                                "sku": "",
                                "position": 1,
                                "inventory_policy": "deny",
                                "compare_at_price": null,
                                "fulfillment_service": "manual",
                                "inventory_management": "shopify",
                                "option1": "S",
                                "option2": null,
                                "option3": null,
                                "created_at": "2021-08-04T14:20:00+07:00",
                                "updated_at": "2021-09-22T14:07:40+07:00",
                                "taxable": true,
                                "barcode": "",
                                "grams": 0,
                                "image_id": null,
                                "weight": 0,
                                "weight_unit": "kg",
                                "inventory_item_id": 42665082093762,
                                "inventory_quantity": 9,
                                "old_inventory_quantity": 9,
                                "requires_shipping": true,
                                "admin_graphql_api_id": "gid://shopify/ProductVariant/40569979699394"
                            }
                        }
                    },
                    "price": "86.00"
                }
            ],
            "extraData": {
                "cart_id": "1"
            },
            "shipping": [
                {
                    "title": "Standard Shipping",
                    "short_text": null,
                    "fee": "8.5"
                }
            ],
            "currency": {
                "base_currency": "SGD",
                  "currency_symbol": "$"
                },
            "redirect": {
                "success": "https://arrow-spt.myshopify.com/pages/order-successful",
                "fail": "https://arrow-spt.myshopify.com/products/arrow-ruby-vertical-hoodie",
                "cancel": "https://arrow-spt.myshopify.com/products/arrow-ruby-vertical-hoodie"
            },
            "merchant_client_key": "ac41b16b21f83a40d07d34c94fa5cb1f",
            "channel": "E-Store"
        }

📘

Once you are done with creating the file. Generate a Base64 encoded token.

👍

Note that this token is what you need to pass in 'data' parameter.

Now that you have passed 'data' and 'username', you should be able to create a new order token! which would look something like as shown below

{
    "success": 1,
    "message": "temporary order successfully created",
    "data": {
        "token": "4f0fe6860806e43c936e633936c902de052ee19ef10a46fae4cebe55a6b83da25b92ac4b6652692679c211acb72ee5b360f9b60526415bc8138bb3746c111566"
    }
}

User this token in the URL https://stg-hi.projectarrow.co/order/check/%7Border_token%7D to search and check on your browser that the order has been initialized!

For example:

19001900 782782