Was this article helpful?

Provide a Callback Page

Overview

After the hosted page has been submitted, a callback will be issued to the callback URL as configured. The callback page will receive the result of the call to Zuora and is responsible for processing the resulting parameters of when Zuora tries to create a payment method.

Callback Page Requirements

When a payment method is succesfully created, the parameters "success" and "refId" will be returned ("refId" represents the newly created payment method ID in Zuora):

http://yourdomain.com/yourapp/zuora_callback.jsp?success=true&refId=4028e6963554eb60013558e2e68d1fac

  • errorCode
  • errorMessage

For unsuccessful hosted page submissions, parameters such as success, errorCode, and errorMessage will be returned:

http://yourdomain.com/yourapp/zuora_callback.jsp?success=false&errorCode=GeneralSystemError&errorMessage=This is some error message

Error Parameters

An additional parameter will be appended for every enabled field that had an error. For example, if the Name on Card field is enabled in the Details Page but not entered in the iFrame, the following will be appended onto the callback URL in the format errorField_Field Name.  (A full list of error field names and error codes can be found in the error handling section).

&errorField_creditCardHolderName=NullValue

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("refId"));
        else parent.hp_cback_fail(param("errorCode"), param("errorField_creditCardType"), ...);
}
</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, ef_creditCardType, ef_creditCardNumber,ef_creditCardExpirationMonth, ef_creditCardExpirationYear, ef_cardSecurityCode,ef_creditCardHolderName) {
//display some kind of error message
}

What's Next

Next, Verify the Callback Response.

  1.  
Was this article helpful?
Pages that link here
Page statistics
497 view(s), 10 edit(s) and 4600 character(s)

Tags

This page has no custom tags set.

Comments

You must to post a comment.

Attach file

Attachments