We probably can change the code in client.js with

    if (!purchase_arguments_t || typeof purchase_arguments_t !== "object") {
        throw new Error("Purchase argument is not provided or is not a object.");
    }
    else
    {
        if (purchase_arguments_t.digitalGoodID)
        {
        	if (typeof purchase_arguments_t.digitalGoodID !== "string") {
                throw new Error("Purchase argument digitalGoodID is not provided or is not a string.");
            }
        }
        // all string validation
        if (purchase_arguments_t.extraParameters)
        {
           if (typeof purchase_arguments_t.digitalGoodID !== "object") {
           throw new Error("Purchase argument extraParameters is not provided or is not a object.");
        }
    }

That probably will work for you.