Sign Up for Paid Subscription (Anonymous Customer)
Overview
This guide shows you how to implement an anonymous subscription purchase flow.
Create a checkout URL, protect it with the Generate User Session URL endpoint, redirect the customer to checkout, and process the order notification.
Diagram
flowchart LR
classDef mainColor fill:#ffffff,color:#555555,stroke:#96C34B,stroke-width:2px;
A([" <br/><b>Create Checkout URL</b><br/>Build the purchase URL <br/>with the required parameters <br/> "]):::mainColor
--> B([" <br/><b>Create Checkout URL</b><br/>Generate a secure URL<br/> using the URL Generator <br/> "]):::mainColor
--> C([" <br/><b>PaidOrderNotification</b><br/>Generate a secure URL <br/>using the URL Generator <br/> "]):::mainColor
Step 1: Create Checkout URL
Create a checkout URL and add any required x-parameters (for example, x-source) to support reporting and campaign tracking.
https://www.cleverbridge.com/864/?scope=checkout&cart=97771&language=en¤cy=USD&x-source=website-visit-07.2026Step 2: Generate Protected URL
Call the Generate User Session URL to generate a protected checkout URL from the checkout URL (TargetUrl).
curl --request POST \
--url 'https://rest.cleverbridge.com/urlgenerator/generateusersessionurl' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'Authorization: Basic YOUR_BASE64_ENCODED_CREDENTIALS' \
--data '{
"TargetUrl": "https%3A%2F%2Fwww.cleverbridge.com%2F864%2F%3Fscope%3Dcheckout%26cart%3D97771%26language%3Den%26currency%3DUSD%26x-source%3Dwebsite-visit-07.2026"
}'import http.client
import json
conn = http.client.HTTPSConnection("rest.cleverbridge.com")
payload = json.dumps({
"TargetUrl": "https%3A%2F%2Fwww.cleverbridge.com%2F864%2F%3Fscope%3Dcheckout%26cart%3D97771%26language%3Den%26currency%3DUSD%26x-source%3Dwebsite-visit-07.2026"
})
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Basic YOUR_BASE64_ENCODED_CREDENTIALS"
}
conn.request(
"POST",
"/urlgenerator/generateusersessionurl",
body=payload,
headers=headers
)
response = conn.getresponse()
print(response.status)
print(response.read().decode("utf-8"))const https = require("https");
const data = JSON.stringify({
TargetUrl: "https%3A%2F%2Fwww.cleverbridge.com%2F864%2F%3Fscope%3Dcheckout%26cart%3D97771%26language%3Den%26currency%3DUSD%26x-source%3Dwebsite-visit-07.2026",
});
const options = {
hostname: "rest.cleverbridge.com",
path: "/urlgenerator/generateusersessionurl",
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
Authorization: "Basic YOUR_BASE64_ENCODED_CREDENTIALS",
"Content-Length": Buffer.byteLength(data),
},
};
const req = https.request(options, (res) => {
let body = "";
res.on("data", (chunk) => {
body += chunk;
});
res.on("end", () => {
console.log(`Status: ${res.statusCode}`);
console.log(body);
});
});
req.on("error", (err) => {
console.error(err);
});
req.write(data);
req.end();import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class GenerateUserSessionUrl {
public static void main(String[] args) throws Exception {
URL url = new URL("https://rest.cleverbridge.com/urlgenerator/generateusersessionurl");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Accept", "application/json");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "Basic YOUR_BASE64_ENCODED_CREDENTIALS");
conn.setDoOutput(true);
String json = """
{
"TargetUrl": "https%3A%2F%2Fwww.cleverbridge.com%2F864%2F%3Fscope%3Dcheckout%26cart%3D97771%26language%3Den%26currency%3DUSD%26x-source%3Dwebsite-visit-07.2026"
}
""";
try (OutputStream os = conn.getOutputStream()) {
os.write(json.getBytes(StandardCharsets.UTF_8));
}
int status = conn.getResponseCode();
System.out.println("Status: " + status);
InputStream is = (status >= 200 && status < 300)
? conn.getInputStream()
: conn.getErrorStream();
if (is != null) {
String response = new String(is.readAllBytes(), StandardCharsets.UTF_8);
System.out.println(response);
is.close();
}
conn.disconnect();
}
}Example Response
{
"Url": "https://www.cleverbridge.com/surl-6KMKOSQTaW",
"ResultMessage": "OK"
}
ImportantAlways redirect the customer to the protected URL returned in the URL field. Do not use the original checkout URL (
TargetUrl), as it is not protected against parameter tampering.
Step 3: Redirect the Customer to the Protected Checkout URL
The customer submits their payment information and completes the checkout.
Result
After a successful payment:
- The customer receives a payment confirmation.
- Cleverbridge displays the delivery details.
- If a key generator is configured, Cleverbridge generates a license key and includes it in the delivery details.
The checkout process is complete. Cleverbridge displays the purchase confirmation to the customer and then sends a PaidOrderNotification to your system, as described in the next step.
Step 4: Receive a PaidOrderNotification
PaidOrderNotificationAfter a successful purchase, Cleverbridge sends a PaidOrderNotification containing the order information.
Use this notification to provision access, activate subscriptions, or perform any required fulfillment.
The notification contains the following parameters:
| Field | Description |
|---|---|
internalCustomer | Your internal customer identifier. |
items[].recurringBilling.subscriptionId | The Cleverbridge subscription ID. |
items[].recurringBilling.renewalType | Indicates whether the subscription renews automatically or manually. |
items[].recurringBilling.intervalNumber | The current recurring-billing interval number. |
items[].recurringBilling.nextBillingDate | The next scheduled billing date. |
Example PaidOrderNotification
PaidOrderNotificationThe following example shows a trimmed PaidOrderNotification. For the complete payload, see the JSON reference.
{
"meta": {
"type": "PaidOrderNotification",
"date": "2026-07-19T14:47:34.857671",
"schemaUrl": "https://www.cleverbridge.com/JsonNotificationSchemas/PaidOrderNotification"
},
"purchaseId": 123456789,
"internalCustomer": "123456789",
"items": [
{
"recurringBilling": {
"subscriptionId": "S12345678",
"intervalNumber": 1,
"nextBillingDate": "2026-08-19T14:47:34.857671",
"renewalType": "Automatic"
}
}
]
}Updated 3 days ago