/* * Author : subscriptionslabs * Generated on : 30-Jul-2018 02:02:21 PDT * Version : 1.0 */ application "Custom Checkout Demo" { date format = "dd-MMM-yyyy" time zone = "Asia/Kolkata" section Untitled_Form { displayname= "Untitled Form" form Untitled_Form { displayname = "Untitled Form" success message = "Data Added Successfully!" field alignment = left actions { on add { submit ( type = submit displayname = "Submit" ) reset ( type = reset displayname = "Reset" ) } on edit { update ( type = submit displayname = "Update" ) cancel ( type = cancel displayname = "Cancel" ) } } } list Untitled_Form_View { displayName = "Untitled Form View" show all rows from Untitled_Form } } section Custom_Checkout { htmlpage Custom_Checkout(plan_code,amount) displayname = "Custom Checkout" content <%{ /* App variable declaration starts */ /* * Change {{authtoken}} with your authtoken * Change {{organization_id}} with your organization ID * Change {{plan_code}} with yout plan code */ authtoken = "{authtoken}"; organizationId = "{organization_id}"; planCode = plan_code; /* App variable declaration ends */ /* Style Properties*/ backgroundColor = "#fcf8e3"; borderColor = "#fbeed5"; textColor = "#c09853"; borderStyle = "1px solid transparent"; borderRadius = "4px"; loadingTextFontSize = "15px"; loadingText = "Loading..."; errorMessageHeader = "Sorry, you don't have required access"; errorMessageDescription = "Invalid URL Passed"; /* Style properties ends */ showLoading = true; hpUrl = "https://subscriptions.zoho.com/api/v1/hostedpages/newsubscription"; headerMap = Map(); headerMap.put("Authorization",authtoken); headerMap.put("X-com-zoho-subscriptions-organizationid",organizationId); planMap = Map(); planMap.put("plan_code",planCode); if(amount != null) { planMap.put("price",amount); } params = Map(); params.put("plan",planMap); hpResponse = postUrl(hpUrl,params.toString(),headerMap,false); hpResponseText = hpResponse.get("responseText"); if(hpResponse.get("responseCode").equalsIgnoreCase("201")) { hp = hpResponseText.get("hostedpage"); if(hp.contains("url")) { openUrl(hp.get("url"),"parent window"); } } else { showLoading = false; %>

<%=errorMessageHeader%>

<%=errorMessageDescription%>
<% } if(showLoading) { %>



""><%=loadingText%>


<% } }%> } share_settings { "Read" { name = "Read" type = Users_Permissions permissions = {Chat:true, Predefined:true} description = "This profile will have read permission for all components\n" } "Write" { name = "Write" type = Users_Permissions permissions = {Chat:true, Predefined:true} description = "This profile will have write permission for all components\n" } "Administrator" { name = "Administrator" type = Users_Permissions permissions = {Chat:true, Predefined:true} description = "This profile will have all the permissions.\n" } } customize { layout = "tab" color = "black" base theme = "professional" new theme = 1 } }