Reseller Plugin


We have crafted a WordPress plugin to allow Resellers and Partners easy integration with our system. Instructions below.

  1. Download the plugin and install or install via the Add Plugin menu in WordPress.
  2. Login to Photon and grab your API-KEY and API-SECRET. Remember to always keep these safe, you are responsible for them.
  3. Activate the Plugin
  4. Paste in your API-KEY into the field.
  5. Edit wp-config.php and add: define('PAGELY_PARTNER_API_SECRET','YOUR_API_SECRET');
  6. Refresh the Options screen for the plugin. You should see any plans and products you have created. (Create plans and products by logging into Photon or using the API calls). Note: the sandbox or live dropdown. Be careful not to test in live setting.
  7. Select which plans, and other options you wish to use.
  8. Create a custom page template, and somewhere in it add: pagely_order_form($post->post_name); within php tags
  9. Create a new page in WordPress and select the custom page template you have made.
  10. Visit that page and refresh, you should now see the form. The account portion of the form will do client side validation and remote validation of a couple inputs.
  11. The second form step is payment. If the user selects Paypal it will do the redirection and land them back on your site. If credit card it display a credit form.
  12. On successful payment it will display a status message and the upgrade cart where the user may purchase additional upgrades you have selected.
  13. The user may now login to their site.

Notes

  • The basic CSS of the forms is just that, basic. Add custom styles to your stylesheet or paste into the Custom CSS textarea on the options page. The examples you see are using bootstrap, which means the html is bootstap ready.
  • Form will not load if not https://

Screenshots

Display plans on a separate page.

If you want to shows the plans on a page by themselves, you can try this code in a page template. Loop through the plans and create a form submit to post the plan ID to the signup page.

<?php 
$pagely = New PagelyApi;
$preselected_plan = $pagely->_get_pp_session('preselected_plan');
$plans = $pagely->_get_plans(); 
$i=1;
if ($plans) {
	foreach ($plans['plans'] as $p) {

		if ( $p->id == $plans['default'] ) {
				$recommended = $p->id;
		}

		if (!$preselected_plan) {
			$selected = $recommended;
		} else {
			$selected = $preselected_plan;
		}

		$featured = false;
		$price = explode('.',$p->price); 	
		if( !$preselected_plan && $recommended == $p->id ) { $featured = 'featured'; }						
?>

<div class="plan span3 <?php if( $featured ) { echo 'featured'; } ?> p<?php echo $i;?>">
	<ul class="plan-inner unstyled uberdark rb8">
		<li class="name"><?php echo $p->name?></li>
		<li class="desc"><span><?php echo $p->desc; ?></span></li>
		<li>
			<ul class="unstyled params">
				<li class="last"><a href="/plans-pricing/" class="btn btn-mini btn-success">Compare Plans</a></li>
			</ul>
		</li>
		<li class="price"><span><sup>$</sup><?php echo $price[0] ?><sub>/mo</sub></span></li>
		<li class="go"><form method="post" action="/signup/" style="padding:0;margin:0"><button type="submit" class="btn btn-large btn-primary"><i class="icon-shopping-cart icon-white"></i> Checkout</button><input type="hidden" value="<?php echo $p->id;?>" name="pagely_order[plan]"/></form></li>

	</ul>
</div>
<?php $i++; } } else { ?>
<p class="alert alert-warning">Problem with the API. Someone will be flogged momentarily.</p>
<?php } ?>