If you wish to implement CAS for Panel with Web Presence Builder and a custom billing solution, you should also carry out the following operations:
When a customer clicks to purchase a site, Web Presence Builder sends an HTTP POST request to a billing entry point. This request contains information about the customer and the created site. Business Manager (billing engine) uses this information to associate the site with the customer's hosting account. To shift to a custom billing engine, you should change the billing entry point URL and extend your billing engine logic to save the POST parameters that come to the URL.
This solely depends on the billing system and is beyond the scope of the CAS integration.
This appendix explains how to complete operations 1, 3, and 4.
How to forward customers to a custom entry point
By default, the store entry point URL points to Business Manager. This URL is stored in two placeholders (billingSignUpEntryPoint and billingUpSellEntryPoint) in file tbbMessagesDefault.lng. The location of this file depends on a Panel installation directory (we assume that you use the default one), server OS and architecture. Find the file in one of the following directories:
C:\Program Files\Parallels\sb\resources\locale\en_US or C:\Program Files (x86)\Parallels\sb\resources\locale\en_US depending on the server architecture./usr/local/sb/resources/locale/en_US/opt/sb/resources/locale/en_USTo customize the entry point URL, you should create a copy of the tbbMessagesDefault.lng. file, name it tbbMessagesCustom.lng, and modify the settings in the latter file.
Note: We assume that you change the entry point for a store in the en_US locale. To change the entry point for other locales, create and modify the tbbMessagesCustom.lng file in the respective directories that are on the same level with en_US.
To change the entry point URL, substitute all occurrences of the placeholders billingSignUpEntryPoint and billingUpSellEntryPoint with the URL you need and remove leading and trailing "@" and "%" symbols in all occurrences of the placeholders in the file. For example, if the new entry point URL is http://www.example.com, you should change, say, @billingUpSellEntryPoint@ to http://www.example.com.
What parameters to save
The billing entry point receives POST requests that contain information about customers and trial sites they have created. Although the requests contain a number of parameters, you need to save only one - sbSiteUuid. This is the unique identifier of the created site. To move the site to the customer's hosting account, you should associate the parameter with an appropriate site in Panel.
How to create a customer account, a subscription, and a site
To create these three objects, use API RPC - the protocol to create and manage Panel objects remotely. First, you should create a customer account and save the resulting ID. Then, create a subscription with the owner-id (in add/gen_setup) set to the customer ID. Finally, create a site with the webspace-id (in add/gen_setup) set to the subscription ID. Each of these three operations is presented by a packet you send to Panel.
If you wish to quickly get started with sending API RPC packets, read API RPC Developer's Guide. It contains chapter Client Code Samples that describes how you can implement your own packet sender by using samples of client applications (PHP, C#, VB.NET).
Find samples of the packets to send in a separate document - API RPC 1.6.3.1 Reference, sections:
How to associate a site created in Web Presence Builder with a Panel site
An association between a Web Presence Builder site and Panel site is also achieved through API RPC. One of the protocol calls turns a trial site into a regular site and associates it with a Panel site. This association means that when a customer clicks Edit in Web Presence Builder, their previously created site is displayed. This operation requires two parameters - the GUID of a Panel site and sbSiteUuid that you previously received.
The protocol call (or packet) to associate Web Presence Builder and Panel sites is found in API RPC 1.6.3.1 Reference, section Supported Operations > Managing Integration With Web Presence Builder > Assigning a Trial Site > Request Samples. This section contains call samples that you can reuse with your own values. Details on how to find a site GUID are also included in the reference document, section Supported Operations > Managing Sites (Domains) > Getting Information About Sites > Request Samples.
What to do next
After you have successfully achieved the basic integration, you can extend your application to work with existing customers as well. This involves you showing them the options of upgrading their current subscription with Web Presence Builder support (existing customers are forwarded to billingUpSellEntryPoint, while new customers go to billingSignUpEntryPoint) rather than creating new subscriptions.
You can also personalize the store interface by using parameters received from Web Presence Builder. For example, you can adjust the store locale based on customers' personal data, or use the data in messages displayed to customers.