If you wish to offer the Try and Buy mode for Plesk with Presence Builder and a custom billing solution, you should also carry out the following operations:

  1. Forward customers from Presence Builder to a custom store and save details about created sites.

    When a customer clicks to purchase a site, 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.

  2. Ensure that customers purchase a hosting plan or add-on.

    This solely depends on the billing system and is beyond the scope of the CAS integration.

  3. (For new customers only) Create a customer account, a subscription, and a site in Plesk.

  4. Associate the site created in Presence Builder with an appropriate site in Plesk.

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 Plesk installation directory (we assume that you use the default one), server OS and architecture. Find the file in one of the following directories:

  • (On Microsoft Windows) 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.
  • (On RPM and DEB package-based Linux) /usr/local/sb/resources/locale/en_US

To 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 billingSignUpEntryPoint and billingUpSellEntryPoint placeholders with the URL of your custom billing solution. Take care to 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://example.com, you should change @billingUpSellEntryPoint@ to http://example.com.
  • Remove the “@sbHttpHost@” part before the custom billing solution URL in the post methods.

To illustrate, if your custom billing solution’s URL is http://example.com, the original entry of the following form:

form method='post' action='@sbHttpHost@@billingSignUpEntryPoint@?@queryString@'

needs to be rewritten so that it looks like this:

form method='post' action='http://example.com?@queryString@'

Do this for every entry containing either the @billingSignUpEntryPoint@ or the @billingUpSellEntryPoint@ placeholder.

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 Plesk.

How to Create a Customer Account, a Subscription, and a Site

To create these three objects, use XML API - the protocol to create and manage Plesk 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 Plesk.

If you wish to quickly get started with sending XML API packets, read XML API Manual. It contains the 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 in XML API Manual, sections:

  • Supported Operations > Managing Customer Accounts > Creating Customer Accounts > Request Samples
  • Supported Operations > Managing Subscriptions > Creating a Subscription > Request Samples
  • Supported Operations > Managing Sites (Domains) > Creating a Site > Request Samples

How to Associate a Site Created in Presence Builder with a Plesk Site

An association between a Presence Builder site and Plesk site is also achieved through XML API. One of the protocol calls turns a trial site into a regular site and associates it with a Plesk site. This association means that when a customer clicks Edit in Presence Builder, their previously created site is displayed. This operation requires two parameters - the GUID of a Plesk site and sbSiteUuid that you previously received.

The protocol call (or packet) to associate Presence Builder and Plesk sites is found in XML API Manual, section Supported Operations > Managing Integration With 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 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 Presence Builder. For example, you can adjust the store locale based on customers’ personal data, or use the data in messages displayed to customers.