Knowledge Center

Knowledge Center > Zuora CPQ > Hosted Commerce Pages > Hosted Checkout Pages > Create Checkout Pages on Your Website > Provide a Callback Page

Provide a Callback Page

Zuora Hosted Checkout Pages are no longer under active development. Customers should use Payment Pages 2.0 for their secure payment acceptance requirements.

Overview

 

After the hosted page has been submitted, Zuora will send a callback response to the Return URL as configured. The Return URL is responsible for processing the resulting parameters of when Zuora tries to create a subscription.

Return URL Parameters

When a subscription is successfully created, the parameter "success=true" will be added to the end of the Return URL response.  For example, a success response from Zuora would look like:

http://yourdomain.com/yourapp/zuora_callback.php?id=40289222362eebb4150064&tenantId=129&timestamp=1332231691912&token=owh8smKy9FBNKPukm163FlnEFcmiyH0m&responseSignature=NjcxMzJIMTRiNGY5ZmE3NDJmOTJhZWQ0NDl3OTl3MmQ=&success=true

The parameters returned to the Return URL depends on the parameters you selected when you were creating or editing the Checkout page.  For example, in the screenshot below, the merchant has chosen to have :

Screen shot 2012-03-20 at 1.52.15 PM.png

Using the example above, a success response from Zuora would look like:

http://yourdomain.com/yourapp/zuora_callback.php?id=40289222362eebb4150064&tenantId=129&timestamp=1332231691912&token=owh8smKy9FBNKPukm163FlnEFcmiyH0m&responseSignature=NjcxMzJIMTRiNGY5ZmE3NDJmOTJhZWQ0NDl3OTl3MmQ=&success=true&organization=type&first_name=type&email=null&account_id=40289222362ee1a601362f325a4603e5&subscription_id=40289222362ee1a601362f325a7203e9&last_name=Smith&product_rate_plan_id=40289222361a2ee601361a391351002e&product_id=null

For unsuccessful hosted page submissions, parameters, successerrorCode, and errorMessage, will be returned:

http://yourdomain.com/yourapp/zuora_callback.php?id=40289222362eebb4150064&tenantId=129&timestamp=1332231691912&token=owh8smKy9FBNKPukm163FlnEFcmiyH0m&responseSignature=NjcxMzJIMTRiNGY5ZmE3NDJmOTJhZWQ0NDl3OTl3MmQ=&success=false&errorCode=GeneralSystemError&errorMessage=This is some error message

Process Return URL Parameters

The callback page should perform something similar to the following when it is loaded. This is required because of cross-domain restrictions for iFrames.

<script>
function callback() {
        if (param("success") == true) parent.hp_cback_success(param("subscription_id"));
        else parent.hp_cback_fail(param("errorCode"), param("errorMessage"));
}
</script>
<body onload="callback();"/>

Zuora recommends that you use the callback page as a simple proxy for transmitting the data from Zuora to your subscription form. You should implement two JavaScript methods in on the subscription page: One to handle success and one to handle failures. They should look similar to the following:

function hp_cback_success(ref_id) {
        document.HostedPaymentMethodPageForm.paymentMethodId.value = ref_id;
        document.HostedPaymentMethodPageForm.submit();
}

function hp_cback_fail(errorCode, errorMessage) {
//display an error message
}

What's Next

Next, Verify the Callback Response.

Last modified

Tags

Classifications

(not set)