Skip to main content

Sample Code for Hosted Payment Method Pages


Sample Code for Hosted Payment Method Pages

This article is for the Hosted Payment Method Pages (HPM) 1.0. Zuora has deprecated HPM1.0. There are no further plans for HPM 1.0 and Zuora will no longer provide support for any issues with HPM 1.0. Payment Pages 2.0 are now generally available, and are a replacement for HPM 1.0. To migrate from HPM 1.0 to Payment Pages 2.0, see this migration guide.


This section contains sample code for implementing Hosted Payment Method pages.

Zuora Global Support does not troubleshoot content from GitHub. The sample code is as an example of code that has worked for previous implementations and was created by both Zuora and non-Zuora authors. You must customize the sample code for use with your system. Send any comments and feedback to

Sample Demo Project

The sample code attached in this section will produce a simple demo project of the Hosted Payment Method pages. The project dynamically generates the iFrame URL, embeds the iFrame onto a webpage, and provides a link to refresh the iFrame and a link that displays the iFrame URL.

You will need to modify four input values in each of the projects to make it display your Hosted Payment Method pages:

  • ID (Page)
  • Tenant ID
  • API Security Key
  • Domain URL (the domain that iFrame is hosted, e.g.

Each sample code project also contains a callback file that contains logic to do the callback validation.  You will need to modify one input (API Security Key) on this file in order to make the demo project work.

If you properly modify the inputs above, then the demo project should display the following simple display of the Hosted Payment Method pages:

Screen shot 2012-02-08 at 11.56.13 AM.png

Below are the languages for which sample code for this demo project is available.


  1. Open the PHP demo project.
  2. Modify the​ subscription.php file with the four input values listed above.


  1. Open the Java demo project.
  2. Modify the subscription.jsp file with the four input values listed above.


  1. Open the Ruby demo project.
  2. Modify the payment_controller.rb file with the four input values listed above.


  1. Open the .NET demo project.
  2. Modify the subscription.aspx.cs file with the four input values listed above.