0

I am trying to achieve following:

?php
require_once('recurly/lib/recurly.php');

// Required for the API
Recurly_Client::$subdomain = 'xxxxxx';
Recurly_Client::$apiKey = 'xxxxxxxxxxxxxxxxxxx';
Recurly_js::$privateKey = 'xxxxxxxxxxxxxxxxxxx';



$signature = Recurly_js::sign(
                                array(
                                        'subscription' => array(
                                            'plan_code' => 'testplan1',
                                            'unit_amount_in_cents' => 5000,
                                            'currency' => 'USD'
                                            )
                                    )
                            ); 
?>


<html>
  <head>
    <link href="recurly-js/themes/default/recurly.css" rel="stylesheet">
    <script src="js/jquery.js"></script>
    <script src="recurly-js/build/recurly.js"></script>
    <script>
    $(function(){

      Recurly.config({
        subdomain: 'xxxxxxxxxx'
        , currency: 'USD' //USD | GBP | CAD | EUR, etc...
        , unit_amount_in_cents: '5000'
      });
/**/
      Recurly.buildSubscriptionForm({
        target: '#recurly-form'
        , planCode: 'testplan1'
        , successURL: 'success.php'
        , signature: '<?php echo $signature;?>'
        , unit_amount_in_cents: '5000'
      });

    });
    </script>
  </head>
  <body>
    <h1>Test Form</h1>
    <div id="recurly-form"></div>
  </body>
</html>

When a form is rendered on front end, it does not reflect the price given in sign object. It displays the original value of plan set in the Recurly plan.

Is there something I am doing wrong? Or it is not possible to override the subscription value in sing function?

Thanks, Naresh

  • 1
    Finally I found that you can not alter the value being displayed in the form (without tempering the Recurly.js file) but the value being used by Recurly is the same as I set in Recurlly_js::sign() function. So instead of changing the value in the form, I found it more convenient to hide the subscription part from the form :) – Naresh Khokhaneshiya Jul 29 '13 at 07:16
  • you should post an answer to your own question. – drewish Oct 04 '13 at 18:06

0 Answers0