(click to copy to clipboard)",tokenText=n,jsoneditor){const e=jsoneditor.getValue();e.token=n,jsoneditor.mySetValue(e)}const s=JSON.stringify({token:n}),r=JSON.stringify({customerId:e.customerId,token:n}),i=JSON.stringify({customerId:e.customerId,token:n,type:type}),c=JSON.stringify({token:n,placeName:"Nice",latitude:"43.7102",longitude:"7.262",chartWidth:"650",chartHeight:"350"}),a="test"==env?env+"/":"";let l=t?"You already had an existing subscription, with the above token already active.":"You did not have an existing subscription, so one has been created.";l+=' You can manage your subscription (and add or remove payment cards) by clicking on this link.',l+=' Check usage and charges incurred in the current period by clicking on this link.',l+=' You can cancel the subscription at any time by clicking on this link (warning: no confirmation will be requested after clicking the link).',l+=' An example request using your token is here. Also see the dynamic link in the Live Preview section.',document.getElementById("post-checkout-message").innerHTML=l,stripeButton.removeEventListener("click",buttonListenerBefore),stripeButton.addEventListener("click",buttonListenerAfter),stripeButton.addEventListener("mouseup",(function(){this.blur()}))},checkoutSessionHandlerApi=async function(e){if(e.sessionId){const t=await stripe.redirectToCheckout({sessionId:e.sessionId});t.error&&(stripeErrorDiv.textContent=t.error.message)}else e.sessionUrl?window.location.href=e.sessionUrl:e.token&&subscriptionInfoHandler(e,!0)},captchaFailedApi=function(e){stripeErrorDiv.textContent="Failed reCAPTCHA test"},captchaPassedApi=function(e){const t=document.getElementById("api_email").value;if(!t)return void(stripeErrorDiv.textContent="Please provide an email address to proceed");localStorage.setItem("email",t);const n=new XMLHttpRequest,o="https://"+tokensServer+"/createCheckoutSession";n.open("POST",o),n.setRequestHeader("Content-Type","text/plain"),n.onload=function(){if(200===n.status){const e=JSON.parse(n.responseText);e.error?stripeErrorDiv.textContent=e.error.message:checkoutSessionHandlerApi(e)}else console.log("Request failed. Returned status of "+n.status)};const s={env:env,mode:"subscription",type:type,currency:getCurrencyShort(),successUrl:success_url,cancelUrl:cancel_url,email:t};n.send(encodeURI(JSON.stringify(s))),e.preventDefault()},stripeButton=document.getElementById("stripe-button"),buttonListenerBefore=function(e){runCaptchaCheckThen(e,captchaPassedApi,captchaFailedApi)};let tokenText="token is not yet known";const buttonListenerAfter=function(e){const t=navigator.clipboard;null==t?console.log("clipboard is undefined"):t.writeText(tokenText).then((function(){console.log("Copied to clipboard successfully!")}),(function(){console.error("Unable to write to clipboard. :-(")})),e.preventDefault()};stripeButton.addEventListener("click",buttonListenerBefore),stripeButton.addEventListener("mouseup",(function(){this.blur()}));const paramsApi={sessionId:getFromUrl("sessionId"),checkoutType:getFromUrl("checkoutType")};if("subscription"==paramsApi.checkoutType&¶msApi.sessionId&&"cancel"!=paramsApi.sessionId){let e=0;const t=function(){const n=new XMLHttpRequest,o="test"==env?env+"/":"";n.open("GET","https://"+tokensServer+"/getSubscriptionInfo/"+o+paramsApi.sessionId),n.onload=function(){if(200===n.status){const o=JSON.parse(n.responseText);if("NOK"==o.status&&e<2)return e++,void setTimeout(t,2500);subscriptionInfoHandler(o,!1)}else console.log("Request failed. Returned status of "+n.status)},n.send()};setTimeout(t,2500)}
To manage your subscription, including adding or removing payment cards, please refer to the Subscription Management section.
Choose your preferred currency:
The customer portal allows you to review or cancel your subscription, view your billing history, and update your card details.
Enter your API token below and click the button to open the customer portal:
You can also check on your current and recent usage via the following button.
All available options are presented below (click on the arrow icon to expand). Each time a change is made to an option, a new API call is sent and the fetched data is presented in the Results panel below.
If you require an API token, see the separate panel on this page to obtain one. The demo API token only works for the default location.
Use the direct URL to make the API call. The result of this call is presented below.
You can also make changes to the options here by editing the values in the editor below and then clicking
If you want to save the options you've set on this page, so that you can return to it later with the options preserved, use the direct link and bookmark that.
You might also be interested in the Meteogram API for fetching a fully-featured meteogram graphic for use on your own website or even in a widget on your mobile device.
This will update whenever the form changes to show validation errors if there are any.
You can change the schema by pasting a new version below and then clicking
// Set default options
JSONEditor.defaults.options.theme = 'bootstrap2';
// Initialize the editor
const editor = new JSONEditor(document.getElementById('editor_holder'),{
schema: {
type: 'object',
properties: {
name: { 'type': 'string' }
}
}
});
// Set the value
editor.setValue({
name: 'John Smith'
});
// Get the value
const data = editor.getValue();
console.log(data.name); // 'John Smith'
// Validate
const errors = editor.validate();
if(errors.length) {
// Not valid
}
// Listen for changes
editor.on('change', function() {
// Do something...
});