This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Plans in Recurly



Overview

The following operations allow you to work with plans. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with plans, see Sample configuration

OperationDescription

createPlan

Creates a plan.

getPlanByCodeRetrieves a plan by code.
listPlansRetrieves all the plans.

Operation details

This section provides further details on the operations related to plans.

Creating a plan

The createPlan operation creates a plan.

createPlan
<recurly.createPlan>
	<planCode>{$ctx:planCode}</planCode>
    <name>{$ctx:name}</name>
	<unitAmountInCents>{$ctx:unitAmountInCents}</unitAmountInCents>
	<accountingCode>{$ctx:accountingCode}</accountingCode>
    <setupFeeInCents>{$ctx:setupFeeInCents}</setupFeeInCents>
    <taxCode>{$ctx:taxCode}</taxCode>
    <successUrl>{$ctx:successUrl}</successUrl>
    <trialIntervalLength>{$ctx:trialIntervalLength}</trialIntervalLength>
    <planIntervalLength>{$ctx:planIntervalLength}</planIntervalLength>
    <trialIntervalUnit>{$ctx:trialIntervalUnit}</trialIntervalUnit>
    <description>{$ctx:description}</description>
    <unitName>{$ctx:unitName}</unitName>
    <displayQuantity>{$ctx:displayQuantity}</displayQuantity>
    <cancelUrl>{$ctx:cancelUrl}</cancelUrl>
    <totalBillingCycles>{$ctx:totalBillingCycles}</totalBillingCycles>
    <planIntervalUnit>{$ctx:planIntervalUnit}</planIntervalUnit>
	<taxExempt>{$ctx:taxExempt}</taxExempt>
</recurly.createPlan>
Properties
  • planCode: Required - The unique code to identify the plan.
  • name: Required - The plan name.
  • unitAmountInCents: Required - The amount of a unit in cents.
  • accountingCode: The accounting code for related invoice line items.
  • setupFeeInCents: The fee for setup in cents.
  • taxCode: The tax code.
  • successUrl: The URL to redirect to after signup.
  • trialIntervalLength: The trial interval length.
  • planIntervalLength: The plan interval length.
  • trialIntervalUnit: The trial interval unit such as days or months.
  • description: The plan description.
  • unitName: The unit description for the quantity.
  • displayQuantity: Whether the display quantity is shown on the hosted payment page.
  • cancelUrl: The URL to redirect to on, cancelled signup.
  • totalBillingCycles: The number of billing cycles before the plan stops renewing.
  • planIntervalUnit: The plan interval unit such as days or months.
  • taxExempt: The tax exempt status; if "true", exempts tax on the plan.
Sample request

Following is a sample REST/XML request that can be handled by the createPlan operation.

Sample Request for createPlan
<createPlan>
   <planCode>goldttt</planCode>
   <name>Gold plan</name>
   <setupFeeInCents>
      <values>
         <USD>1000</USD>
         <EUR>800</EUR>
      </values>
   </setupFeeInCents>
   <unitAmountInCents>
      <values>
         <USD>6000</USD>
         <EUR>4500</EUR>
      </values>
   </unitAmountInCents>
   <planIntervalLength>1</planIntervalLength>
   <planIntervalUnit>months</planIntervalUnit>
   <taxExempt>false</taxExempt>
   <apiUrl>https://virtusax.recurly.com</apiUrl>
   <apiKey>09da0279537848789809f1f86e349afb</apiKey>
</createPlan>
Related Recurly documentation

https://docs.recurly.com/api/plans#create-plan

Retrieving a plan by code

The getPlanByCode operation retrieves a plan by code.

getPlanByCode
<recurly.getPlanByCode>
	<planCode>{$ctx:planCode}</planCode>
</recurly.getPlanByCode>
Properties
  • planCode: Required - The unique code to identify the plan.
Sample request

Following is a sample REST/XML request that can be handled by the getPlanByCode operation.

getPlanByCode
<getPlanByCode>
	<apiUrl>https://virtusax.recurly.com</apiUrl>
	<apiKey>09da0279537848789809f1f86e349afb</apiKey>
	<planCode>gold123</planCode>
</getPlanByCode>
Related Recurly documentation

https://docs.recurly.com/api/plans#lookup-plan

Retrieving all the plans

The listPlans operation retrieves all the plans.

listPlans
<recurly.listPlans>
	<cursor>{$ctx:cursor}</cursor>
    <perPage>{$ctx:perPage}</perPage>
</recurly.listPlans>
Properties
  • cursor: The link for the next page.
  • perPage: The number of records to be retrieved per page.
Sample request

Following is a sample REST/XML request that can be handled by the listPlans operation.

listPlans
<listPlans>
	<apiUrl>https://virtusax.recurly.com</apiUrl>
	<apiKey>09da0279537848789809f1f86e349afb</apiKey>
	<perPage>1</perPage>
	<cursor>1596131336932158860</cursor>
</listPlans>
Related Recurly documentation

https://docs.recurly.com/api/plans#list-plans

Sample configuration

Following is a sample proxy service that illustrates how to connect to Recurly with the init operation and use the createPlan operation. The sample request for this proxy can be found in the createPlan sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="recurly_createPlan"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="planCode" expression="//planCode/text()"/>
         <property name="name" expression="//name/text()"/>
         <property name="unitAmountInCents" expression="//unitAmountInCents/values"/>
         <property name="description" expression="//description/text()"/>
         <property name="accountingCode" expression="//accountingCode/text()"/>
         <property name="planIntervalUnit" expression="//planIntervalUnit/text()"/>
         <property name="planIntervalLength" expression="//planIntervalLength/text()"/>
         <property name="trialIntervalUnit" expression="//trialIntervalUnit/text()"/>
         <property name="trialIntervalLength" expression="//trialIntervalLength/text()"/>
         <property name="setupFeeInCents" expression="//setupFeeInCents/values"/>
         <property name="totalBillingCycles" expression="//totalBillingCycles/text()"/>
         <property name="unitName" expression="//unitName/text()"/>
         <property name="displayQuantity" expression="//displayQuantity/text()"/>
         <property name="successUrl" expression="//successUrl/text()"/>
         <property name="cancelUrl" expression="//cancelUrl/text()"/>
         <property name="taxExempt" expression="//taxExempt/text()"/>
         <property name="taxCode" expression="//taxCode/text()"/>
         <property name="apiUrl" expression="//apiUrl/text()"/>
         <property name="apiKey" expression="//apiKey/text()"/>
         <recurly.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <apiKey>{$ctx:apiKey}</apiKey>
         </recurly.init>
         <recurly.createPlan>
            <accountingCode>{$ctx:accountingCode}</accountingCode>
            <unitAmountInCents>{$ctx:unitAmountInCents}</unitAmountInCents>
            <setupFeeInCents>{$ctx:setupFeeInCents}</setupFeeInCents>
            <taxCode>{$ctx:taxCode}</taxCode>
            <successUrl>{$ctx:successUrl}</successUrl>
            <trialIntervalLength>{$ctx:trialIntervalLength}</trialIntervalLength>
            <planIntervalLength>{$ctx:planIntervalLength}</planIntervalLength>
            <trialIntervalUnit>{$ctx:trialIntervalUnit}</trialIntervalUnit>
            <description>{$ctx:description}</description>
            <unitName>{$ctx:unitName}</unitName>
            <displayQuantity>{$ctx:displayQuantity}</displayQuantity>
            <planCode>{$ctx:planCode}</planCode>
            <name>{$ctx:name}</name>
            <cancelUrl>{$ctx:cancelUrl}</cancelUrl>
            <totalBillingCycles>{$ctx:totalBillingCycles}</totalBillingCycles>
            <planIntervalUnit>{$ctx:planIntervalUnit}</planIntervalUnit>
            <taxExempt>{$ctx:taxExempt}</taxExempt>
         </recurly.createPlan>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>