{"id":2014,"date":"2020-06-01T02:00:00","date_gmt":"2020-06-01T02:00:00","guid":{"rendered":"http:\/\/www.olivercromwell.org\/wordpress\/?page_id=2014"},"modified":"2024-10-10T16:25:15","modified_gmt":"2024-10-10T16:25:15","slug":"join","status":"publish","type":"page","link":"https:\/\/www.olivercromwell.org\/wordpress\/join\/","title":{"rendered":"Join the Cromwell Association"},"content":{"rendered":"<h3>Becoming a member<\/h3>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-2011\" src=\"https:\/\/www.olivercromwell.org\/wordpress\/wp-content\/uploads\/2020\/05\/book cover.jpg\" alt=\"\" width=\"173\" height=\"247\" \/>Join the Cromwell Association today and receive as a gift a copy of <strong>Oliver Cromwell &#8211; England\u2019s Protector<\/strong> by <em>David Horspool<\/em>, published in paperback by Penguin at \u00a34.99. This brief, but comprehensive, biography is an excellent introduction to Cromwell. It was reviewed in The Protector\u2019s Pen by Dr Jonathan Fitzgibbons,<\/p>\r\n<blockquote>\r\n<p>&#8220;&#8230;a very readable survey of Cromwell\u2019s life replete with thought-provoking passages and memorable phrases \u2026\u2026\u2026\u2026..This is a portrayal of Cromwell \u2018warts and all\u2019 \u2026..This book packs a great deal into just one hundred and eleven pages\u2026\u2026\u2026\u2026\u2026.I would probably recommend this book to anyone wanting to get up to speed quickly with Cromwell and his times&#8230;&#8221;<\/p>\r\n<\/blockquote>\r\n<p>As well as the book you will receive the latest copy of our newsletter, The Protector\u2019s Pen, and in July our annual journal Cromwelliana.<\/p>\r\n<p>Membership also gives you access to the Member\u2019s Area of the web site which has the most recent copies of the journal and the back-file of The Protector\u2019s Pen.<\/p>\r\n<p>Members are also able to purchase our merchandise at preferential rates, book places at events and participate in all our meetings.<\/p>\r\n<p>For further details of what The Association does see <a href=\"https:\/\/www.olivercromwell.org\/wordpress\/?page_id=1570\">About Us<\/a><\/p>\r\n<p>Membership costs <strong>\u00a327.00<\/strong> for UK based members but with regret, due to significant rises in postal charges we have had to increase costs to members outside the UK, so that membership elsewhere in Europe is now \u00a340, and outside Europe in the Rest of the World, <strong>\u00a345.00<\/strong>. For members outside the UK, who are happy to receive mailings as digital only copy, this is available for the same price as a UK membership, <strong>\u00a327.00<\/strong>.<\/p>\r\n<h4 id=\"join\" style=\"font-size: 1.4em; color: #004466; text-align: center;\">Join today and get the full benefits of membership.<\/h4>\r\n<!--<p><strong>Due to technical issues the facility to pay for new memberships or for renewing memberships using PayPal is currently suspended. Until the issue is resolved, if you wish to pay for a new membership or to renew your membership, please email <a href=\"mailto:finance@olivercromwell.org\" target=\"_blank\" rel=\"noopener\">finance@olivercromwell.org<\/a>.<\/strong><\/p>-->\r\n<p>If you would like to become a member please select the correct new membership subscription from either the UK or non-UK drop-down menu then click the respective Paypal button<\/strong>. For <strong>membership renewals<\/strong> please click <a href=\"#renewals\">here<\/a>. All payments are in pounds sterling (\u00a3).<\/p>\r\n\r\n<p><span style=\"color: red;\"><strong>Important message for new members: <\/strong><\/span>We aim to despatch a new members pack within 21 days of your joining, and hopefully quicker.\u00a0 If you have not received your pack within that period please email <a href=\"mailto:membership@olivercromwell.org\">membership@olivercromwell.org<\/a> quoting the day that you joined and paid via PayPal. Please note that there is no automatic confirmation of the receipt of payment.<\/p>\r\n<div class=\"wpapp_widget\"><div id=\"elements_wrapper_wpapp_paypal_button_0\"><div class=\"wpapp_payment_subject\"><span class=\"payment_subject\"><strong>Cromwell Association new UK only membership<\/strong><\/span><\/div><select id=\"select_wpapp_paypal_button_0\" name=\"select_wpapp_paypal_button_0\" class=\"\"><option value=\"new-membership-uk-only-adult-27-00\">\r\nNew membership, UK only, Adult - 27.00<\/option><option value=\"new-membership-uk-only-adult-1-household-member-32-00\">\r\nNew membership, UK only, Adult + 1 household member - 32.00<\/option><option value=\"new-membership-uk-only-institutional-corporate-member-40-00\">\r\nNew membership, UK only, Institutional\/Corporate member - 40.00<\/option><option value=\"new-membership-uk-only-hard-copy-mailings-for-schools-member-15-00\">\r\nNew membership, UK only, Hard-copy mailings for schools member - 15.00<\/option><option value=\"test-0-01\">Test - 0.01<\/option><\/select><div class=\"wpapp_ref_title_label\"><strong>Payment Reference (Email):<\/strong><\/div><div class=\"wpapp_ref_value\"><input type=\"text\" name=\"wpapp_button_reference\" maxlength=\"60\" value=\"\" placeholder=\"Payment reference\" class=\"wp_pp_button_reference\" \/><\/div><div style=\"margin-bottom:10px;\"><\/div><\/div>    <div class=\"wpapp-ppcp-button-wrapper\">\n\n    <!-- PayPal button container where the button will be rendered -->\n    <div id=\"wpapp_paypal_button_0\" style=\"width: 250px;\"><\/div>\n\n    <script type=\"text\/javascript\">\n        document.addEventListener( \"wpapp_paypal_sdk_loaded\", function() { \n            \/\/Anything that goes here will only be executed after the PayPal SDK is loaded.\n            console.log('PayPal JS SDK is loaded for WPAPP.');\n\n            \/**\n             * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/\n             *\/\n            paypal.Buttons({\n                \/**\n                 * Optional styling for buttons.\n                 * \n                 * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/#link-style\n                 *\/\n                style: {\n                    color: 'blue',\n                    shape: 'rect',\n                    height: 35,\n                    label: 'subscribe',\n                    layout: 'vertical',\n                },\n\n                \/\/ Triggers when the button first renders.\n                onInit: onInitHandler,\n\n                \/\/ Triggers when the button is clicked.\n                onClick: onClickHandler,\n\n                \/\/ Setup the transaction.\n                createOrder: createOrderHandler,\n\n                \/\/ Handle the onApprove event.\n                onApprove: onApproveHandler,\n\n                \/\/ Handle unrecoverable errors.\n                onError: onErrorHandler,\n\n                \/\/ Handles onCancel event.\n                onCancel: onCancelHandler,\n\n            })\n            .render('#wpapp_paypal_button_0')\n            .catch((err) => {\n                console.error('PayPal Buttons failed to render');\n            });\n\n            function onInitHandler(data, actions) {\n                \/\/This function is called when the button first renders.\n            }\n\n            function onClickHandler(data, actions) {\n                \/\/This function is called when the button is clicked.\n            }\n\n            \n            \/**\n             * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/#link-createorder\n             *\/\n            async function createOrderHandler() {\n                \/\/ Create the order in PayPal using the PayPal API.\n                \/\/ https:\/\/developer.paypal.com\/docs\/checkout\/standard\/integrate\/\n                \/\/ The server-side Create Order API is used to generate the Order. Then the Order-ID is returned.                    \n                console.log('Setting up the AJAX request for create-order call.');\n\n                \/\/ First, select the interacted button's wrapper div by its ID (so  we can target various elements within it)\n                const wrapper_div_interacted_button = document.getElementById('elements_wrapper_wpapp_paypal_button_0');\n                \/\/console.log(wrapper_div_interacted_button);\n\n                \/\/ Read the select element and get the selected option's value and text.\n                js_on_page_embed_button_id = 'wpapp_paypal_button_0';\n                var selectId = 'select_' + js_on_page_embed_button_id; \/\/ Construct the select ID\n                var selectElement = document.getElementById(selectId);\n                \/\/console.log(\"Select Element: \", selectElement);\n\n                \/\/Get the other amount field value.\n                var other_amount_input = wrapper_div_interacted_button.querySelector('.wpapp_other_amt_input');\n\n                \/\/Get the reference field value.\n                var pp_reference_field = wrapper_div_interacted_button.querySelector('.wp_pp_button_reference');\n\n                let pp_bn_data = {};\n                pp_bn_data.transient_name = '69cffe4674fc7_wpapp_paypal_button_0';\n                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_0';\n                pp_bn_data.selected_val = selectElement.value;\/\/value of the selected option. (we can use it get the item name from the transient).\n                pp_bn_data.other_amount_val = other_amount_input ? other_amount_input.value : '';\n                pp_bn_data.pp_reference_field = pp_reference_field ? pp_reference_field.value : '';\n                console.log('WPAPP Button Data Below');\n                console.log(pp_bn_data);\n\n                \/\/Ajax action: <prefix>_pp_create_order \n                let post_data = 'action=wpapp_pp_create_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=4979f00d85';\n                \/\/console.log('Post Data: ', post_data);\/\/Debugging purposes only.\n\n                try {\n                    \/\/ Using fetch for AJAX request. This is supported in all modern browsers.\n                    const response = await fetch(\"https:\/\/www.olivercromwell.org\/wordpress\/wp-admin\/admin-ajax.php\", {\n                        method: \"post\",\n                        headers: {\n                            'Content-Type': 'application\/x-www-form-urlencoded'\n                        },\n                        body: post_data\n                    });\n\n                    const response_data = await response.json();\n\n                    if (response_data.order_id) {\n                        console.log('Create-order API call to PayPal completed successfully.');\n                        \/\/If we need to see the order details, uncomment the following line.\n                        \/\/const order_data = response_data.order_data;\n                        \/\/console.log('Order data: ' + JSON.stringify(order_data));\n                        return response_data.order_id;\n                    } else {\n                        const error_message = JSON.stringify(response_data);\n                        console.error('Error occurred during create-order call to PayPal. ' + error_message);\n                        throw new Error(error_message);\n                    }\n                } catch (error) {\n                    console.error(error);\n                    alert('Could not initiate PayPal Checkout...\\n\\n' + JSON.stringify(error));\n                }\n            }\n\n            async function onApproveHandler(data, actions) {\n                console.log('Successfully created a transaction.');\n\n                \/\/ Show the spinner while we process this transaction.\n                \/\/ First, select the button container by its ID.\n                const pp_button_container = document.getElementById('wpapp_paypal_button_0');\n                \/\/ Then, navigate to the parent element of the PPCP button container.\n                const parent_wrapper = pp_button_container.parentElement;\n                \/\/ Finally, within the parent wrapper, select the spinner container\n                const pp_button_spinner_container = parent_wrapper.querySelector('.wpapp-pp-button-spinner-container');\n                \/\/console.log('Button spinner container: ', pp_button_spinner_container);\n\n                pp_button_container.style.display = 'none'; \/\/Hide the buttons\n                pp_button_spinner_container.style.display = 'inline-block'; \/\/Show the spinner.\n\n                \/\/ Capture the order in PayPal using the PayPal API.\n                \/\/ https:\/\/developer.paypal.com\/docs\/checkout\/standard\/integrate\/\n                \/\/ The server-side capture-order API is used. Then the Capture-ID is returned.\n                console.log('Setting up the AJAX request for capture-order call.');\n                let pp_bn_data = {};\n                pp_bn_data.order_id = data.orderID;\n                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_0';\n                pp_bn_data.transient_name = '69cffe4674fc7_wpapp_paypal_button_0';\n                \/\/pp_bn_data.custom_field = encodeURIComponent(custom_data);\/\/If you have any custom data to send to the server (it needs to be URI encoded so special characters are not lost.)\n\n                \/\/Ajax action: <prefix>_pp_capture_order\n                let post_data = 'action=wpapp_pp_capture_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=4979f00d85';\n                try {\n                    const response = await fetch(\"https:\/\/www.olivercromwell.org\/wordpress\/wp-admin\/admin-ajax.php\", {\n                        method: \"post\",\n                        headers: {\n                            'Content-Type': 'application\/x-www-form-urlencoded'\n                        },\n                        body: post_data\n                    });\n\n                    const response_data = await response.json();\n                    const txn_data = response_data.txn_data;\n                    const error_detail = txn_data?.details?.[0];\n                    const error_msg = response_data.error_msg;\/\/Our custom error message.\n                    \/\/ Three cases to handle:\n                    \/\/ (1) Recoverable INSTRUMENT_DECLINED -> call actions.restart()\n                    \/\/ (2) Other non-recoverable errors -> Show a failure message\n                    \/\/ (3) Successful transaction -> Show confirmation or thank you message\n\n                    if (response_data.capture_id) {\n                        \/\/ Successful transaction -> Show confirmation or thank you message\n                        console.log('Capture-order API call to PayPal completed successfully.');\n\n                        \/\/Redirect to the Thank you page URL if it is set.\n                        return_url = 'https:\/\/www.olivercromwell.org\/wordpress\/?page_id=2680';\n                        if( return_url ){\n                            \/\/redirect to the Thank you page URL.\n                            console.log('Redirecting to the Thank you page URL: ' + return_url);\n                            window.location.href = return_url;\n                            return;\n                        } else {\n                            \/\/No return URL is set. Just show a success message.\n                            console.log('No return URL is set in the settings. Showing a success message.');\n\n                            \/\/We are going to show the success message in the wpapp-ppcp-button-wrapper's container.\n                            txn_success_msg = 'Transaction completed successfully! Feel free to browse our site for another checkout.';\n                            \/\/ Select all elements with the class 'wpapp-ppcp-button-wrapper'\n                            var button_divs = document.querySelectorAll('.wpapp-ppcp-button-wrapper');\n\n                            \/\/ Loop through the NodeList and update each element\n                            button_divs.forEach(function(div, index) {\n                                div.innerHTML = '<div id=\"wpapp-btn-txn-success-msg-' + index + '\" class=\"wpapp-btn-txn-success-msg\">' + txn_success_msg + '<\/div>';\n                            });\n\n                            \/\/ Scroll to the success message container of the button we are interacting with.\n                            const interacted_button_container_element = document.getElementById(elements_wrapper_wpapp_paypal_button_0);\n                            if (interacted_button_container_element) {\n                                interacted_button_container_element.scrollIntoView({ behavior: 'smooth', block: 'start' });\n                            }\n                            return;\n                        }\n\n                    } else if (error_detail?.issue === \"INSTRUMENT_DECLINED\") {\n                        \/\/ Recoverable INSTRUMENT_DECLINED -> call actions.restart()\n                        console.log('Recoverable INSTRUMENT_DECLINED error. Calling actions.restart()');\n                        return actions.restart();\n                    } else if ( error_msg && error_msg.trim() !== '' ) {\n                        \/\/Our custom error message from the server.\n                        console.error('Error occurred during PayPal checkout process.');\n                        console.error( error_msg );\n                        alert( error_msg );\n                    } else {\n                        \/\/ Other non-recoverable errors -> Show a failure message\n                        console.error('Non-recoverable error occurred during PayPal checkout process.');\n                        console.error( error_detail );\n                        \/\/alert('Unexpected error occurred with the transaction. Enable debug logging to get more details.\\n\\n' + JSON.stringify(error_detail));\n                    }\n\n                    \/\/Return the button and the spinner back to their orignal display state.\n                    pp_button_container.style.display = 'block'; \/\/ Show the buttons\n                    pp_button_spinner_container.style.display = 'none'; \/\/ Hide the spinner\n\n                } catch (error) {\n                    console.error(error);\n                    alert('PayPal returned an error! Transaction could not be processed. Enable the debug logging feature to get more details...\\n\\n' + JSON.stringify(error));\n                }\n            }\n\n            function onErrorHandler(err) {\n                console.error('An error prevented the user from checking out with PayPal. ' + JSON.stringify(err));\n                alert( 'Error occurred during PayPal checkout process.\\n\\n' + JSON.stringify(err) );\n            }\n            \n            function onCancelHandler (data) {\n                console.log('Checkout operation cancelled by the customer.');\n                \/\/Return to the parent page which the button does by default.\n            }            \n\n        });\n    <\/script>\n\n    <style>\n        @keyframes wpapp-pp-button-spinner {\n            to {transform: rotate(360deg);}\n        }\n        .wpapp-pp-button-spinner {\n            margin: 0 auto;\n            text-indent: -9999px;\n            vertical-align: middle;\n            box-sizing: border-box;\n            position: relative;\n            width: 60px;\n            height: 60px;\n            border-radius: 50%;\n            border: 5px solid #ccc;\n            border-top-color: #0070ba;\n            animation: wpapp-pp-button-spinner .6s linear infinite;\n        }\n        .wpapp-pp-button-spinner-container {\n            width: 100%;\n            text-align: center;\n            margin-top:10px;\n            display: none;\n        }\n    <\/style>\n    <div class=\"wpapp-pp-button-spinner-container\">\n        <div class=\"wpapp-pp-button-spinner\"><\/div>\n    <\/div>    \n    <\/div><!-- end of button-wrapper -->\n    <\/div>\r\n<div class=\"wpapp_widget\"><div id=\"elements_wrapper_wpapp_paypal_button_1\"><div class=\"wpapp_payment_subject\"><span class=\"payment_subject\"><strong>Cromwell Association new non-UK membership<\/strong><\/span><\/div><select id=\"select_wpapp_paypal_button_1\" name=\"select_wpapp_paypal_button_1\" class=\"\"><option value=\"new-membership-non-uk-europe-adult-40-00\">\r\nNew membership, non UK, Europe, Adult - 40.00<\/option><option value=\"new-membership-non-uk-rest-of-world-adult-45-00\">\r\nNew membership, non UK, Rest of World, Adult - 45.00<\/option><option value=\"new-membership-non-uk-institutional-corporate-60-00\">\r\nNew membership, non UK, Institutional\/Corporate - 60.00<\/option><option value=\"new-membership-non-uk-digital-only-27-00\">\r\nNew membership, non UK, Digital only - 27.00<\/option><\/select><div class=\"wpapp_ref_title_label\"><strong>Payment Reference (Email):<\/strong><\/div><div class=\"wpapp_ref_value\"><input type=\"text\" name=\"wpapp_button_reference\" maxlength=\"60\" value=\"\" placeholder=\"Payment reference\" class=\"wp_pp_button_reference\" \/><\/div><div style=\"margin-bottom:10px;\"><\/div><\/div>    <div class=\"wpapp-ppcp-button-wrapper\">\n\n    <!-- PayPal button container where the button will be rendered -->\n    <div id=\"wpapp_paypal_button_1\" style=\"width: 250px;\"><\/div>\n\n    <script type=\"text\/javascript\">\n        document.addEventListener( \"wpapp_paypal_sdk_loaded\", function() { \n            \/\/Anything that goes here will only be executed after the PayPal SDK is loaded.\n            console.log('PayPal JS SDK is loaded for WPAPP.');\n\n            \/**\n             * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/\n             *\/\n            paypal.Buttons({\n                \/**\n                 * Optional styling for buttons.\n                 * \n                 * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/#link-style\n                 *\/\n                style: {\n                    color: 'blue',\n                    shape: 'rect',\n                    height: 35,\n                    label: 'subscribe',\n                    layout: 'vertical',\n                },\n\n                \/\/ Triggers when the button first renders.\n                onInit: onInitHandler,\n\n                \/\/ Triggers when the button is clicked.\n                onClick: onClickHandler,\n\n                \/\/ Setup the transaction.\n                createOrder: createOrderHandler,\n\n                \/\/ Handle the onApprove event.\n                onApprove: onApproveHandler,\n\n                \/\/ Handle unrecoverable errors.\n                onError: onErrorHandler,\n\n                \/\/ Handles onCancel event.\n                onCancel: onCancelHandler,\n\n            })\n            .render('#wpapp_paypal_button_1')\n            .catch((err) => {\n                console.error('PayPal Buttons failed to render');\n            });\n\n            function onInitHandler(data, actions) {\n                \/\/This function is called when the button first renders.\n            }\n\n            function onClickHandler(data, actions) {\n                \/\/This function is called when the button is clicked.\n            }\n\n            \n            \/**\n             * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/#link-createorder\n             *\/\n            async function createOrderHandler() {\n                \/\/ Create the order in PayPal using the PayPal API.\n                \/\/ https:\/\/developer.paypal.com\/docs\/checkout\/standard\/integrate\/\n                \/\/ The server-side Create Order API is used to generate the Order. Then the Order-ID is returned.                    \n                console.log('Setting up the AJAX request for create-order call.');\n\n                \/\/ First, select the interacted button's wrapper div by its ID (so  we can target various elements within it)\n                const wrapper_div_interacted_button = document.getElementById('elements_wrapper_wpapp_paypal_button_1');\n                \/\/console.log(wrapper_div_interacted_button);\n\n                \/\/ Read the select element and get the selected option's value and text.\n                js_on_page_embed_button_id = 'wpapp_paypal_button_1';\n                var selectId = 'select_' + js_on_page_embed_button_id; \/\/ Construct the select ID\n                var selectElement = document.getElementById(selectId);\n                \/\/console.log(\"Select Element: \", selectElement);\n\n                \/\/Get the other amount field value.\n                var other_amount_input = wrapper_div_interacted_button.querySelector('.wpapp_other_amt_input');\n\n                \/\/Get the reference field value.\n                var pp_reference_field = wrapper_div_interacted_button.querySelector('.wp_pp_button_reference');\n\n                let pp_bn_data = {};\n                pp_bn_data.transient_name = '69cffe4674fc7_wpapp_paypal_button_1';\n                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_1';\n                pp_bn_data.selected_val = selectElement.value;\/\/value of the selected option. (we can use it get the item name from the transient).\n                pp_bn_data.other_amount_val = other_amount_input ? other_amount_input.value : '';\n                pp_bn_data.pp_reference_field = pp_reference_field ? pp_reference_field.value : '';\n                console.log('WPAPP Button Data Below');\n                console.log(pp_bn_data);\n\n                \/\/Ajax action: <prefix>_pp_create_order \n                let post_data = 'action=wpapp_pp_create_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=9baf3fdc3d';\n                \/\/console.log('Post Data: ', post_data);\/\/Debugging purposes only.\n\n                try {\n                    \/\/ Using fetch for AJAX request. This is supported in all modern browsers.\n                    const response = await fetch(\"https:\/\/www.olivercromwell.org\/wordpress\/wp-admin\/admin-ajax.php\", {\n                        method: \"post\",\n                        headers: {\n                            'Content-Type': 'application\/x-www-form-urlencoded'\n                        },\n                        body: post_data\n                    });\n\n                    const response_data = await response.json();\n\n                    if (response_data.order_id) {\n                        console.log('Create-order API call to PayPal completed successfully.');\n                        \/\/If we need to see the order details, uncomment the following line.\n                        \/\/const order_data = response_data.order_data;\n                        \/\/console.log('Order data: ' + JSON.stringify(order_data));\n                        return response_data.order_id;\n                    } else {\n                        const error_message = JSON.stringify(response_data);\n                        console.error('Error occurred during create-order call to PayPal. ' + error_message);\n                        throw new Error(error_message);\n                    }\n                } catch (error) {\n                    console.error(error);\n                    alert('Could not initiate PayPal Checkout...\\n\\n' + JSON.stringify(error));\n                }\n            }\n\n            async function onApproveHandler(data, actions) {\n                console.log('Successfully created a transaction.');\n\n                \/\/ Show the spinner while we process this transaction.\n                \/\/ First, select the button container by its ID.\n                const pp_button_container = document.getElementById('wpapp_paypal_button_1');\n                \/\/ Then, navigate to the parent element of the PPCP button container.\n                const parent_wrapper = pp_button_container.parentElement;\n                \/\/ Finally, within the parent wrapper, select the spinner container\n                const pp_button_spinner_container = parent_wrapper.querySelector('.wpapp-pp-button-spinner-container');\n                \/\/console.log('Button spinner container: ', pp_button_spinner_container);\n\n                pp_button_container.style.display = 'none'; \/\/Hide the buttons\n                pp_button_spinner_container.style.display = 'inline-block'; \/\/Show the spinner.\n\n                \/\/ Capture the order in PayPal using the PayPal API.\n                \/\/ https:\/\/developer.paypal.com\/docs\/checkout\/standard\/integrate\/\n                \/\/ The server-side capture-order API is used. Then the Capture-ID is returned.\n                console.log('Setting up the AJAX request for capture-order call.');\n                let pp_bn_data = {};\n                pp_bn_data.order_id = data.orderID;\n                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_1';\n                pp_bn_data.transient_name = '69cffe4674fc7_wpapp_paypal_button_1';\n                \/\/pp_bn_data.custom_field = encodeURIComponent(custom_data);\/\/If you have any custom data to send to the server (it needs to be URI encoded so special characters are not lost.)\n\n                \/\/Ajax action: <prefix>_pp_capture_order\n                let post_data = 'action=wpapp_pp_capture_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=9baf3fdc3d';\n                try {\n                    const response = await fetch(\"https:\/\/www.olivercromwell.org\/wordpress\/wp-admin\/admin-ajax.php\", {\n                        method: \"post\",\n                        headers: {\n                            'Content-Type': 'application\/x-www-form-urlencoded'\n                        },\n                        body: post_data\n                    });\n\n                    const response_data = await response.json();\n                    const txn_data = response_data.txn_data;\n                    const error_detail = txn_data?.details?.[0];\n                    const error_msg = response_data.error_msg;\/\/Our custom error message.\n                    \/\/ Three cases to handle:\n                    \/\/ (1) Recoverable INSTRUMENT_DECLINED -> call actions.restart()\n                    \/\/ (2) Other non-recoverable errors -> Show a failure message\n                    \/\/ (3) Successful transaction -> Show confirmation or thank you message\n\n                    if (response_data.capture_id) {\n                        \/\/ Successful transaction -> Show confirmation or thank you message\n                        console.log('Capture-order API call to PayPal completed successfully.');\n\n                        \/\/Redirect to the Thank you page URL if it is set.\n                        return_url = 'https:\/\/www.olivercromwell.org\/wordpress\/?page_id=2680';\n                        if( return_url ){\n                            \/\/redirect to the Thank you page URL.\n                            console.log('Redirecting to the Thank you page URL: ' + return_url);\n                            window.location.href = return_url;\n                            return;\n                        } else {\n                            \/\/No return URL is set. Just show a success message.\n                            console.log('No return URL is set in the settings. Showing a success message.');\n\n                            \/\/We are going to show the success message in the wpapp-ppcp-button-wrapper's container.\n                            txn_success_msg = 'Transaction completed successfully! Feel free to browse our site for another checkout.';\n                            \/\/ Select all elements with the class 'wpapp-ppcp-button-wrapper'\n                            var button_divs = document.querySelectorAll('.wpapp-ppcp-button-wrapper');\n\n                            \/\/ Loop through the NodeList and update each element\n                            button_divs.forEach(function(div, index) {\n                                div.innerHTML = '<div id=\"wpapp-btn-txn-success-msg-' + index + '\" class=\"wpapp-btn-txn-success-msg\">' + txn_success_msg + '<\/div>';\n                            });\n\n                            \/\/ Scroll to the success message container of the button we are interacting with.\n                            const interacted_button_container_element = document.getElementById(elements_wrapper_wpapp_paypal_button_1);\n                            if (interacted_button_container_element) {\n                                interacted_button_container_element.scrollIntoView({ behavior: 'smooth', block: 'start' });\n                            }\n                            return;\n                        }\n\n                    } else if (error_detail?.issue === \"INSTRUMENT_DECLINED\") {\n                        \/\/ Recoverable INSTRUMENT_DECLINED -> call actions.restart()\n                        console.log('Recoverable INSTRUMENT_DECLINED error. Calling actions.restart()');\n                        return actions.restart();\n                    } else if ( error_msg && error_msg.trim() !== '' ) {\n                        \/\/Our custom error message from the server.\n                        console.error('Error occurred during PayPal checkout process.');\n                        console.error( error_msg );\n                        alert( error_msg );\n                    } else {\n                        \/\/ Other non-recoverable errors -> Show a failure message\n                        console.error('Non-recoverable error occurred during PayPal checkout process.');\n                        console.error( error_detail );\n                        \/\/alert('Unexpected error occurred with the transaction. Enable debug logging to get more details.\\n\\n' + JSON.stringify(error_detail));\n                    }\n\n                    \/\/Return the button and the spinner back to their orignal display state.\n                    pp_button_container.style.display = 'block'; \/\/ Show the buttons\n                    pp_button_spinner_container.style.display = 'none'; \/\/ Hide the spinner\n\n                } catch (error) {\n                    console.error(error);\n                    alert('PayPal returned an error! Transaction could not be processed. Enable the debug logging feature to get more details...\\n\\n' + JSON.stringify(error));\n                }\n            }\n\n            function onErrorHandler(err) {\n                console.error('An error prevented the user from checking out with PayPal. ' + JSON.stringify(err));\n                alert( 'Error occurred during PayPal checkout process.\\n\\n' + JSON.stringify(err) );\n            }\n            \n            function onCancelHandler (data) {\n                console.log('Checkout operation cancelled by the customer.');\n                \/\/Return to the parent page which the button does by default.\n            }            \n\n        });\n    <\/script>\n\n    <style>\n        @keyframes wpapp-pp-button-spinner {\n            to {transform: rotate(360deg);}\n        }\n        .wpapp-pp-button-spinner {\n            margin: 0 auto;\n            text-indent: -9999px;\n            vertical-align: middle;\n            box-sizing: border-box;\n            position: relative;\n            width: 60px;\n            height: 60px;\n            border-radius: 50%;\n            border: 5px solid #ccc;\n            border-top-color: #0070ba;\n            animation: wpapp-pp-button-spinner .6s linear infinite;\n        }\n        .wpapp-pp-button-spinner-container {\n            width: 100%;\n            text-align: center;\n            margin-top:10px;\n            display: none;\n        }\n    <\/style>\n    <div class=\"wpapp-pp-button-spinner-container\">\n        <div class=\"wpapp-pp-button-spinner\"><\/div>\n    <\/div>    \n    <\/div><!-- end of button-wrapper -->\n    <\/div>\r\n<hr \/>\r\n<p id=\"renewals\"><span style=\"color: red;\"><strong>Important message for existing members: <\/strong><\/span>If you are <strong><span style=\"text-decoration-line: underline;\">renewing<\/span><\/strong> your membership please select the correct renewal subscription from either the UK or non-UK drop-down menu then click the respective Paypal button.<\/p>\r\n<div class=\"wpapp_widget\"><div id=\"elements_wrapper_wpapp_paypal_button_2\"><div class=\"wpapp_payment_subject\"><span class=\"payment_subject\"><strong>Cromwell Association UK only membership renewal<\/strong><\/span><\/div><select id=\"select_wpapp_paypal_button_2\" name=\"select_wpapp_paypal_button_2\" class=\"\"><option value=\"membership-renewal-uk-onlyadult-27-00\">Membership renewal, UK only,Adult - 27.00<\/option><option value=\"membership-renewal-uk-only-adult-1-household-member-32-00\">\r\nMembership renewal, UK only, Adult + 1 household member - 32.00<\/option><option value=\"membership-renewal-uk-only-institutional-corporate-member-40-00\">\r\nMembership renewal, UK only, Institutional\/Corporate member - 40.00<\/option><option value=\"membership-renewal-uk-only-hard-copy-mailings-for-schools-15-00\">\r\nMembership renewal, UK only, Hard-copy mailings for schools - 15.00<\/option><\/select><div class=\"wpapp_ref_title_label\"><strong>Payment Reference (Email):<\/strong><\/div><div class=\"wpapp_ref_value\"><input type=\"text\" name=\"wpapp_button_reference\" maxlength=\"60\" value=\"\" placeholder=\"Payment reference\" class=\"wp_pp_button_reference\" \/><\/div><div style=\"margin-bottom:10px;\"><\/div><\/div>    <div class=\"wpapp-ppcp-button-wrapper\">\n\n    <!-- PayPal button container where the button will be rendered -->\n    <div id=\"wpapp_paypal_button_2\" style=\"width: 250px;\"><\/div>\n\n    <script type=\"text\/javascript\">\n        document.addEventListener( \"wpapp_paypal_sdk_loaded\", function() { \n            \/\/Anything that goes here will only be executed after the PayPal SDK is loaded.\n            console.log('PayPal JS SDK is loaded for WPAPP.');\n\n            \/**\n             * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/\n             *\/\n            paypal.Buttons({\n                \/**\n                 * Optional styling for buttons.\n                 * \n                 * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/#link-style\n                 *\/\n                style: {\n                    color: 'blue',\n                    shape: 'rect',\n                    height: 35,\n                    label: 'subscribe',\n                    layout: 'vertical',\n                },\n\n                \/\/ Triggers when the button first renders.\n                onInit: onInitHandler,\n\n                \/\/ Triggers when the button is clicked.\n                onClick: onClickHandler,\n\n                \/\/ Setup the transaction.\n                createOrder: createOrderHandler,\n\n                \/\/ Handle the onApprove event.\n                onApprove: onApproveHandler,\n\n                \/\/ Handle unrecoverable errors.\n                onError: onErrorHandler,\n\n                \/\/ Handles onCancel event.\n                onCancel: onCancelHandler,\n\n            })\n            .render('#wpapp_paypal_button_2')\n            .catch((err) => {\n                console.error('PayPal Buttons failed to render');\n            });\n\n            function onInitHandler(data, actions) {\n                \/\/This function is called when the button first renders.\n            }\n\n            function onClickHandler(data, actions) {\n                \/\/This function is called when the button is clicked.\n            }\n\n            \n            \/**\n             * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/#link-createorder\n             *\/\n            async function createOrderHandler() {\n                \/\/ Create the order in PayPal using the PayPal API.\n                \/\/ https:\/\/developer.paypal.com\/docs\/checkout\/standard\/integrate\/\n                \/\/ The server-side Create Order API is used to generate the Order. Then the Order-ID is returned.                    \n                console.log('Setting up the AJAX request for create-order call.');\n\n                \/\/ First, select the interacted button's wrapper div by its ID (so  we can target various elements within it)\n                const wrapper_div_interacted_button = document.getElementById('elements_wrapper_wpapp_paypal_button_2');\n                \/\/console.log(wrapper_div_interacted_button);\n\n                \/\/ Read the select element and get the selected option's value and text.\n                js_on_page_embed_button_id = 'wpapp_paypal_button_2';\n                var selectId = 'select_' + js_on_page_embed_button_id; \/\/ Construct the select ID\n                var selectElement = document.getElementById(selectId);\n                \/\/console.log(\"Select Element: \", selectElement);\n\n                \/\/Get the other amount field value.\n                var other_amount_input = wrapper_div_interacted_button.querySelector('.wpapp_other_amt_input');\n\n                \/\/Get the reference field value.\n                var pp_reference_field = wrapper_div_interacted_button.querySelector('.wp_pp_button_reference');\n\n                let pp_bn_data = {};\n                pp_bn_data.transient_name = '69cffe4674fc7_wpapp_paypal_button_2';\n                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_2';\n                pp_bn_data.selected_val = selectElement.value;\/\/value of the selected option. (we can use it get the item name from the transient).\n                pp_bn_data.other_amount_val = other_amount_input ? other_amount_input.value : '';\n                pp_bn_data.pp_reference_field = pp_reference_field ? pp_reference_field.value : '';\n                console.log('WPAPP Button Data Below');\n                console.log(pp_bn_data);\n\n                \/\/Ajax action: <prefix>_pp_create_order \n                let post_data = 'action=wpapp_pp_create_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=5045387580';\n                \/\/console.log('Post Data: ', post_data);\/\/Debugging purposes only.\n\n                try {\n                    \/\/ Using fetch for AJAX request. This is supported in all modern browsers.\n                    const response = await fetch(\"https:\/\/www.olivercromwell.org\/wordpress\/wp-admin\/admin-ajax.php\", {\n                        method: \"post\",\n                        headers: {\n                            'Content-Type': 'application\/x-www-form-urlencoded'\n                        },\n                        body: post_data\n                    });\n\n                    const response_data = await response.json();\n\n                    if (response_data.order_id) {\n                        console.log('Create-order API call to PayPal completed successfully.');\n                        \/\/If we need to see the order details, uncomment the following line.\n                        \/\/const order_data = response_data.order_data;\n                        \/\/console.log('Order data: ' + JSON.stringify(order_data));\n                        return response_data.order_id;\n                    } else {\n                        const error_message = JSON.stringify(response_data);\n                        console.error('Error occurred during create-order call to PayPal. ' + error_message);\n                        throw new Error(error_message);\n                    }\n                } catch (error) {\n                    console.error(error);\n                    alert('Could not initiate PayPal Checkout...\\n\\n' + JSON.stringify(error));\n                }\n            }\n\n            async function onApproveHandler(data, actions) {\n                console.log('Successfully created a transaction.');\n\n                \/\/ Show the spinner while we process this transaction.\n                \/\/ First, select the button container by its ID.\n                const pp_button_container = document.getElementById('wpapp_paypal_button_2');\n                \/\/ Then, navigate to the parent element of the PPCP button container.\n                const parent_wrapper = pp_button_container.parentElement;\n                \/\/ Finally, within the parent wrapper, select the spinner container\n                const pp_button_spinner_container = parent_wrapper.querySelector('.wpapp-pp-button-spinner-container');\n                \/\/console.log('Button spinner container: ', pp_button_spinner_container);\n\n                pp_button_container.style.display = 'none'; \/\/Hide the buttons\n                pp_button_spinner_container.style.display = 'inline-block'; \/\/Show the spinner.\n\n                \/\/ Capture the order in PayPal using the PayPal API.\n                \/\/ https:\/\/developer.paypal.com\/docs\/checkout\/standard\/integrate\/\n                \/\/ The server-side capture-order API is used. Then the Capture-ID is returned.\n                console.log('Setting up the AJAX request for capture-order call.');\n                let pp_bn_data = {};\n                pp_bn_data.order_id = data.orderID;\n                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_2';\n                pp_bn_data.transient_name = '69cffe4674fc7_wpapp_paypal_button_2';\n                \/\/pp_bn_data.custom_field = encodeURIComponent(custom_data);\/\/If you have any custom data to send to the server (it needs to be URI encoded so special characters are not lost.)\n\n                \/\/Ajax action: <prefix>_pp_capture_order\n                let post_data = 'action=wpapp_pp_capture_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=5045387580';\n                try {\n                    const response = await fetch(\"https:\/\/www.olivercromwell.org\/wordpress\/wp-admin\/admin-ajax.php\", {\n                        method: \"post\",\n                        headers: {\n                            'Content-Type': 'application\/x-www-form-urlencoded'\n                        },\n                        body: post_data\n                    });\n\n                    const response_data = await response.json();\n                    const txn_data = response_data.txn_data;\n                    const error_detail = txn_data?.details?.[0];\n                    const error_msg = response_data.error_msg;\/\/Our custom error message.\n                    \/\/ Three cases to handle:\n                    \/\/ (1) Recoverable INSTRUMENT_DECLINED -> call actions.restart()\n                    \/\/ (2) Other non-recoverable errors -> Show a failure message\n                    \/\/ (3) Successful transaction -> Show confirmation or thank you message\n\n                    if (response_data.capture_id) {\n                        \/\/ Successful transaction -> Show confirmation or thank you message\n                        console.log('Capture-order API call to PayPal completed successfully.');\n\n                        \/\/Redirect to the Thank you page URL if it is set.\n                        return_url = 'https:\/\/www.olivercromwell.org\/wordpress\/?page_id=2680';\n                        if( return_url ){\n                            \/\/redirect to the Thank you page URL.\n                            console.log('Redirecting to the Thank you page URL: ' + return_url);\n                            window.location.href = return_url;\n                            return;\n                        } else {\n                            \/\/No return URL is set. Just show a success message.\n                            console.log('No return URL is set in the settings. Showing a success message.');\n\n                            \/\/We are going to show the success message in the wpapp-ppcp-button-wrapper's container.\n                            txn_success_msg = 'Transaction completed successfully! Feel free to browse our site for another checkout.';\n                            \/\/ Select all elements with the class 'wpapp-ppcp-button-wrapper'\n                            var button_divs = document.querySelectorAll('.wpapp-ppcp-button-wrapper');\n\n                            \/\/ Loop through the NodeList and update each element\n                            button_divs.forEach(function(div, index) {\n                                div.innerHTML = '<div id=\"wpapp-btn-txn-success-msg-' + index + '\" class=\"wpapp-btn-txn-success-msg\">' + txn_success_msg + '<\/div>';\n                            });\n\n                            \/\/ Scroll to the success message container of the button we are interacting with.\n                            const interacted_button_container_element = document.getElementById(elements_wrapper_wpapp_paypal_button_2);\n                            if (interacted_button_container_element) {\n                                interacted_button_container_element.scrollIntoView({ behavior: 'smooth', block: 'start' });\n                            }\n                            return;\n                        }\n\n                    } else if (error_detail?.issue === \"INSTRUMENT_DECLINED\") {\n                        \/\/ Recoverable INSTRUMENT_DECLINED -> call actions.restart()\n                        console.log('Recoverable INSTRUMENT_DECLINED error. Calling actions.restart()');\n                        return actions.restart();\n                    } else if ( error_msg && error_msg.trim() !== '' ) {\n                        \/\/Our custom error message from the server.\n                        console.error('Error occurred during PayPal checkout process.');\n                        console.error( error_msg );\n                        alert( error_msg );\n                    } else {\n                        \/\/ Other non-recoverable errors -> Show a failure message\n                        console.error('Non-recoverable error occurred during PayPal checkout process.');\n                        console.error( error_detail );\n                        \/\/alert('Unexpected error occurred with the transaction. Enable debug logging to get more details.\\n\\n' + JSON.stringify(error_detail));\n                    }\n\n                    \/\/Return the button and the spinner back to their orignal display state.\n                    pp_button_container.style.display = 'block'; \/\/ Show the buttons\n                    pp_button_spinner_container.style.display = 'none'; \/\/ Hide the spinner\n\n                } catch (error) {\n                    console.error(error);\n                    alert('PayPal returned an error! Transaction could not be processed. Enable the debug logging feature to get more details...\\n\\n' + JSON.stringify(error));\n                }\n            }\n\n            function onErrorHandler(err) {\n                console.error('An error prevented the user from checking out with PayPal. ' + JSON.stringify(err));\n                alert( 'Error occurred during PayPal checkout process.\\n\\n' + JSON.stringify(err) );\n            }\n            \n            function onCancelHandler (data) {\n                console.log('Checkout operation cancelled by the customer.');\n                \/\/Return to the parent page which the button does by default.\n            }            \n\n        });\n    <\/script>\n\n    <style>\n        @keyframes wpapp-pp-button-spinner {\n            to {transform: rotate(360deg);}\n        }\n        .wpapp-pp-button-spinner {\n            margin: 0 auto;\n            text-indent: -9999px;\n            vertical-align: middle;\n            box-sizing: border-box;\n            position: relative;\n            width: 60px;\n            height: 60px;\n            border-radius: 50%;\n            border: 5px solid #ccc;\n            border-top-color: #0070ba;\n            animation: wpapp-pp-button-spinner .6s linear infinite;\n        }\n        .wpapp-pp-button-spinner-container {\n            width: 100%;\n            text-align: center;\n            margin-top:10px;\n            display: none;\n        }\n    <\/style>\n    <div class=\"wpapp-pp-button-spinner-container\">\n        <div class=\"wpapp-pp-button-spinner\"><\/div>\n    <\/div>    \n    <\/div><!-- end of button-wrapper -->\n    <\/div>\r\n<div class=\"wpapp_widget\"><div id=\"elements_wrapper_wpapp_paypal_button_3\"><div class=\"wpapp_payment_subject\"><span class=\"payment_subject\"><strong>Cromwell Association non-UK membership renewal<\/strong><\/span><\/div><select id=\"select_wpapp_paypal_button_3\" name=\"select_wpapp_paypal_button_3\" class=\"\"><option value=\"membership-renewal-non-uk-europe-adult-40-00\">\r\nMembership renewal, non UK, Europe, Adult - 40.00<\/option><option value=\"membership-renewal-non-uk-rest-of-world-adult-45-00\">\r\nMembership renewal, non UK, Rest of World, Adult - 45.00<\/option><option value=\"membership-renewal-non-uk-institutional-corporate-60-00\">\r\nMembership renewal, non UK, Institutional\/Corporate - 60.00<\/option><option value=\"membership-renewal-non-uk-digital-only-27-00\">\r\nMembership renewal, non UK, Digital only - 27.00<\/option><\/select><div class=\"wpapp_ref_title_label\"><strong>Payment Reference (Email):<\/strong><\/div><div class=\"wpapp_ref_value\"><input type=\"text\" name=\"wpapp_button_reference\" maxlength=\"60\" value=\"\" placeholder=\"Payment reference\" class=\"wp_pp_button_reference\" \/><\/div><div style=\"margin-bottom:10px;\"><\/div><\/div>    <div class=\"wpapp-ppcp-button-wrapper\">\n\n    <!-- PayPal button container where the button will be rendered -->\n    <div id=\"wpapp_paypal_button_3\" style=\"width: 250px;\"><\/div>\n\n    <script type=\"text\/javascript\">\n        document.addEventListener( \"wpapp_paypal_sdk_loaded\", function() { \n            \/\/Anything that goes here will only be executed after the PayPal SDK is loaded.\n            console.log('PayPal JS SDK is loaded for WPAPP.');\n\n            \/**\n             * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/\n             *\/\n            paypal.Buttons({\n                \/**\n                 * Optional styling for buttons.\n                 * \n                 * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/#link-style\n                 *\/\n                style: {\n                    color: 'blue',\n                    shape: 'rect',\n                    height: 35,\n                    label: 'subscribe',\n                    layout: 'vertical',\n                },\n\n                \/\/ Triggers when the button first renders.\n                onInit: onInitHandler,\n\n                \/\/ Triggers when the button is clicked.\n                onClick: onClickHandler,\n\n                \/\/ Setup the transaction.\n                createOrder: createOrderHandler,\n\n                \/\/ Handle the onApprove event.\n                onApprove: onApproveHandler,\n\n                \/\/ Handle unrecoverable errors.\n                onError: onErrorHandler,\n\n                \/\/ Handles onCancel event.\n                onCancel: onCancelHandler,\n\n            })\n            .render('#wpapp_paypal_button_3')\n            .catch((err) => {\n                console.error('PayPal Buttons failed to render');\n            });\n\n            function onInitHandler(data, actions) {\n                \/\/This function is called when the button first renders.\n            }\n\n            function onClickHandler(data, actions) {\n                \/\/This function is called when the button is clicked.\n            }\n\n            \n            \/**\n             * See documentation: https:\/\/developer.paypal.com\/sdk\/js\/reference\/#link-createorder\n             *\/\n            async function createOrderHandler() {\n                \/\/ Create the order in PayPal using the PayPal API.\n                \/\/ https:\/\/developer.paypal.com\/docs\/checkout\/standard\/integrate\/\n                \/\/ The server-side Create Order API is used to generate the Order. Then the Order-ID is returned.                    \n                console.log('Setting up the AJAX request for create-order call.');\n\n                \/\/ First, select the interacted button's wrapper div by its ID (so  we can target various elements within it)\n                const wrapper_div_interacted_button = document.getElementById('elements_wrapper_wpapp_paypal_button_3');\n                \/\/console.log(wrapper_div_interacted_button);\n\n                \/\/ Read the select element and get the selected option's value and text.\n                js_on_page_embed_button_id = 'wpapp_paypal_button_3';\n                var selectId = 'select_' + js_on_page_embed_button_id; \/\/ Construct the select ID\n                var selectElement = document.getElementById(selectId);\n                \/\/console.log(\"Select Element: \", selectElement);\n\n                \/\/Get the other amount field value.\n                var other_amount_input = wrapper_div_interacted_button.querySelector('.wpapp_other_amt_input');\n\n                \/\/Get the reference field value.\n                var pp_reference_field = wrapper_div_interacted_button.querySelector('.wp_pp_button_reference');\n\n                let pp_bn_data = {};\n                pp_bn_data.transient_name = '69cffe4674fc7_wpapp_paypal_button_3';\n                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_3';\n                pp_bn_data.selected_val = selectElement.value;\/\/value of the selected option. (we can use it get the item name from the transient).\n                pp_bn_data.other_amount_val = other_amount_input ? other_amount_input.value : '';\n                pp_bn_data.pp_reference_field = pp_reference_field ? pp_reference_field.value : '';\n                console.log('WPAPP Button Data Below');\n                console.log(pp_bn_data);\n\n                \/\/Ajax action: <prefix>_pp_create_order \n                let post_data = 'action=wpapp_pp_create_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=347027b627';\n                \/\/console.log('Post Data: ', post_data);\/\/Debugging purposes only.\n\n                try {\n                    \/\/ Using fetch for AJAX request. This is supported in all modern browsers.\n                    const response = await fetch(\"https:\/\/www.olivercromwell.org\/wordpress\/wp-admin\/admin-ajax.php\", {\n                        method: \"post\",\n                        headers: {\n                            'Content-Type': 'application\/x-www-form-urlencoded'\n                        },\n                        body: post_data\n                    });\n\n                    const response_data = await response.json();\n\n                    if (response_data.order_id) {\n                        console.log('Create-order API call to PayPal completed successfully.');\n                        \/\/If we need to see the order details, uncomment the following line.\n                        \/\/const order_data = response_data.order_data;\n                        \/\/console.log('Order data: ' + JSON.stringify(order_data));\n                        return response_data.order_id;\n                    } else {\n                        const error_message = JSON.stringify(response_data);\n                        console.error('Error occurred during create-order call to PayPal. ' + error_message);\n                        throw new Error(error_message);\n                    }\n                } catch (error) {\n                    console.error(error);\n                    alert('Could not initiate PayPal Checkout...\\n\\n' + JSON.stringify(error));\n                }\n            }\n\n            async function onApproveHandler(data, actions) {\n                console.log('Successfully created a transaction.');\n\n                \/\/ Show the spinner while we process this transaction.\n                \/\/ First, select the button container by its ID.\n                const pp_button_container = document.getElementById('wpapp_paypal_button_3');\n                \/\/ Then, navigate to the parent element of the PPCP button container.\n                const parent_wrapper = pp_button_container.parentElement;\n                \/\/ Finally, within the parent wrapper, select the spinner container\n                const pp_button_spinner_container = parent_wrapper.querySelector('.wpapp-pp-button-spinner-container');\n                \/\/console.log('Button spinner container: ', pp_button_spinner_container);\n\n                pp_button_container.style.display = 'none'; \/\/Hide the buttons\n                pp_button_spinner_container.style.display = 'inline-block'; \/\/Show the spinner.\n\n                \/\/ Capture the order in PayPal using the PayPal API.\n                \/\/ https:\/\/developer.paypal.com\/docs\/checkout\/standard\/integrate\/\n                \/\/ The server-side capture-order API is used. Then the Capture-ID is returned.\n                console.log('Setting up the AJAX request for capture-order call.');\n                let pp_bn_data = {};\n                pp_bn_data.order_id = data.orderID;\n                pp_bn_data.on_page_button_id = 'wpapp_paypal_button_3';\n                pp_bn_data.transient_name = '69cffe4674fc7_wpapp_paypal_button_3';\n                \/\/pp_bn_data.custom_field = encodeURIComponent(custom_data);\/\/If you have any custom data to send to the server (it needs to be URI encoded so special characters are not lost.)\n\n                \/\/Ajax action: <prefix>_pp_capture_order\n                let post_data = 'action=wpapp_pp_capture_order&data=' + JSON.stringify(pp_bn_data) + '&_wpnonce=347027b627';\n                try {\n                    const response = await fetch(\"https:\/\/www.olivercromwell.org\/wordpress\/wp-admin\/admin-ajax.php\", {\n                        method: \"post\",\n                        headers: {\n                            'Content-Type': 'application\/x-www-form-urlencoded'\n                        },\n                        body: post_data\n                    });\n\n                    const response_data = await response.json();\n                    const txn_data = response_data.txn_data;\n                    const error_detail = txn_data?.details?.[0];\n                    const error_msg = response_data.error_msg;\/\/Our custom error message.\n                    \/\/ Three cases to handle:\n                    \/\/ (1) Recoverable INSTRUMENT_DECLINED -> call actions.restart()\n                    \/\/ (2) Other non-recoverable errors -> Show a failure message\n                    \/\/ (3) Successful transaction -> Show confirmation or thank you message\n\n                    if (response_data.capture_id) {\n                        \/\/ Successful transaction -> Show confirmation or thank you message\n                        console.log('Capture-order API call to PayPal completed successfully.');\n\n                        \/\/Redirect to the Thank you page URL if it is set.\n                        return_url = 'https:\/\/www.olivercromwell.org\/wordpress\/?page_id=2680';\n                        if( return_url ){\n                            \/\/redirect to the Thank you page URL.\n                            console.log('Redirecting to the Thank you page URL: ' + return_url);\n                            window.location.href = return_url;\n                            return;\n                        } else {\n                            \/\/No return URL is set. Just show a success message.\n                            console.log('No return URL is set in the settings. Showing a success message.');\n\n                            \/\/We are going to show the success message in the wpapp-ppcp-button-wrapper's container.\n                            txn_success_msg = 'Transaction completed successfully! Feel free to browse our site for another checkout.';\n                            \/\/ Select all elements with the class 'wpapp-ppcp-button-wrapper'\n                            var button_divs = document.querySelectorAll('.wpapp-ppcp-button-wrapper');\n\n                            \/\/ Loop through the NodeList and update each element\n                            button_divs.forEach(function(div, index) {\n                                div.innerHTML = '<div id=\"wpapp-btn-txn-success-msg-' + index + '\" class=\"wpapp-btn-txn-success-msg\">' + txn_success_msg + '<\/div>';\n                            });\n\n                            \/\/ Scroll to the success message container of the button we are interacting with.\n                            const interacted_button_container_element = document.getElementById(elements_wrapper_wpapp_paypal_button_3);\n                            if (interacted_button_container_element) {\n                                interacted_button_container_element.scrollIntoView({ behavior: 'smooth', block: 'start' });\n                            }\n                            return;\n                        }\n\n                    } else if (error_detail?.issue === \"INSTRUMENT_DECLINED\") {\n                        \/\/ Recoverable INSTRUMENT_DECLINED -> call actions.restart()\n                        console.log('Recoverable INSTRUMENT_DECLINED error. Calling actions.restart()');\n                        return actions.restart();\n                    } else if ( error_msg && error_msg.trim() !== '' ) {\n                        \/\/Our custom error message from the server.\n                        console.error('Error occurred during PayPal checkout process.');\n                        console.error( error_msg );\n                        alert( error_msg );\n                    } else {\n                        \/\/ Other non-recoverable errors -> Show a failure message\n                        console.error('Non-recoverable error occurred during PayPal checkout process.');\n                        console.error( error_detail );\n                        \/\/alert('Unexpected error occurred with the transaction. Enable debug logging to get more details.\\n\\n' + JSON.stringify(error_detail));\n                    }\n\n                    \/\/Return the button and the spinner back to their orignal display state.\n                    pp_button_container.style.display = 'block'; \/\/ Show the buttons\n                    pp_button_spinner_container.style.display = 'none'; \/\/ Hide the spinner\n\n                } catch (error) {\n                    console.error(error);\n                    alert('PayPal returned an error! Transaction could not be processed. Enable the debug logging feature to get more details...\\n\\n' + JSON.stringify(error));\n                }\n            }\n\n            function onErrorHandler(err) {\n                console.error('An error prevented the user from checking out with PayPal. ' + JSON.stringify(err));\n                alert( 'Error occurred during PayPal checkout process.\\n\\n' + JSON.stringify(err) );\n            }\n            \n            function onCancelHandler (data) {\n                console.log('Checkout operation cancelled by the customer.');\n                \/\/Return to the parent page which the button does by default.\n            }            \n\n        });\n    <\/script>\n\n    <style>\n        @keyframes wpapp-pp-button-spinner {\n            to {transform: rotate(360deg);}\n        }\n        .wpapp-pp-button-spinner {\n            margin: 0 auto;\n            text-indent: -9999px;\n            vertical-align: middle;\n            box-sizing: border-box;\n            position: relative;\n            width: 60px;\n            height: 60px;\n            border-radius: 50%;\n            border: 5px solid #ccc;\n            border-top-color: #0070ba;\n            animation: wpapp-pp-button-spinner .6s linear infinite;\n        }\n        .wpapp-pp-button-spinner-container {\n            width: 100%;\n            text-align: center;\n            margin-top:10px;\n            display: none;\n        }\n    <\/style>\n    <div class=\"wpapp-pp-button-spinner-container\">\n        <div class=\"wpapp-pp-button-spinner\"><\/div>\n    <\/div>    \n    <\/div><!-- end of button-wrapper -->\n    <\/div>\r\n<p>If you prefer to download a hard copy (docx) application form please click <a href=\"https:\/\/www.olivercromwell.org\/wordpress\/wp-content\/uploads\/2020\/06\/Membership form 2020.docx\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\r\n<p>Members who are UK tax-payers are strongly encouraged to <strong>Gift-Aid<\/strong> their subscription. See page 2 of the application form for details.<\/p>\r\n<p>The subscription year starts on 3rd September. Members who join after 1st June will be in membership until 2nd September in the following year, and will receive the following year\u2019s Cromwelliana, but will not receive a hard copy of Cromwelliana in the year of joining. Access to the current year\u2019s journal in a digital format is via the Member\u2019s Area of the website. It may be possible to purchase a hard copy of the current year\u2019s issue at a special member\u2019s rate, dependent on availability, on request to <a href=\"mailto:membership@olivercromwell.org?\" target=\"_top\" rel=\"noopener noreferrer\">membership@olivercromwell.org<\/a>.<\/p>\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>Becoming a member Join the Cromwell Association today and receive as a gift a copy of Oliver Cromwell &#8211; England\u2019s Protector by David Horspool, published in paperback by Penguin at \u00a34.99. This brief, but comprehensive, biography is an excellent introduction to Cromwell. It was reviewed in The Protector\u2019s Pen by Dr Jonathan Fitzgibbons, &#8220;&#8230;a very [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2014","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/pages\/2014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/comments?post=2014"}],"version-history":[{"count":129,"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/pages\/2014\/revisions"}],"predecessor-version":[{"id":6414,"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/pages\/2014\/revisions\/6414"}],"wp:attachment":[{"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/media?parent=2014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/categories?post=2014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.olivercromwell.org\/wordpress\/wp-json\/wp\/v2\/tags?post=2014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}