[英]Recurly.js - PHP Client - Digital Signature
I am trying to host forms for a recurly implementation and use PHP to create the signature. 我正在尝试托管用于递归实现的表单,并使用PHP创建签名。 I have followed the docs, searched for examples and copied the code and tried every combination I can think of but I can not figure out what the issue is - on my PHP page the form appears but at the top I am seeing part of the PHP code instead of the code executing.
我一直关注文档,搜索示例并复制了代码,并尝试了所有我能想到的组合,但我无法弄清问题所在-在我的PHP页面上,表单出现了,但是在顶部,我看到了PHP的一部分代码而不是代码执行。
My code: 我的代码:
<?php
require_once('/lib/recurly.php');
// Required for the API
Recurly_Client::$subdomain = 'myactualsubdomain'
Recurly_Client::$apiKey = 'removedmyapiforsecurity';
Recurly_js::$privateKey = 'removedmyprivatekeyforsecurity';
$signature = Recurly_js::sign(array(
'account'=>array('account_code'=>'aaa1234588'),
'subscription' => array(
'plan_code' => 'innovator',
'currency'=>'USD',
)));
?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Innovator Yearly Subscription</title>
<html>
<head>
<link rel="stylesheet" href="/css/recurly.css" type="text/css" />
<script src="/js/jquery.js"></script>
<script src="/js/recurly.js"></script>
<script>
$(function(){
Recurly.config({
subdomain: 'supportpay'
, currency: 'USD' // GBP | CAD | EUR, etc...
});
Recurly.buildSubscriptionForm({
target: '#recurly-subscribe',
planCode: 'innovator',
successURL: 'success.php',
signature: '$signature',
distinguishContactFromBillingInfo: false,
collectCompany: false,
collectContact: true,
termsOfServiceURL: 'http://supportpay.com/contact/terms-of-use/',
acceptPaypal: false,
acceptedCards: ['mastercard',
'discover',
'american_express',
'visa'],
});
});
</script>
</head>
<body>
<h1>Subscribe to Plan</h1>
<h2>Plan Code: Innovator - Yearly5</h2>
<div id="recurly-subscribe">
</div>
</body>
</html>
When I use that code and run the php the browser the form / page render correctly except at the top there is this code 当我使用该代码并运行php浏览器时,窗体/页面正确呈现,但顶部没有此代码
array('account_code'=>'aaa1234588'),'subscription' => array( 'plan_code' =>'innovator', 'currency'=>'USD', ))); ?>
Can someone please shed some light on what I am doing wrong here? 有人可以告诉我我在这里做错了什么吗?
Thank you! 谢谢!
Seems like you'd need to put the PHP variable inside a PHP tag: 似乎您需要将PHP变量放在PHP标记内:
Recurly.buildSubscriptionForm({
target: '#recurly-subscribe',
planCode: 'innovator',
successURL: 'success.php',
signature: '<?php print $signature ?>',
distinguishContactFromBillingInfo: false,
collectCompany: false,
collectContact: true,
termsOfServiceURL: 'http://supportpay.com/contact/terms-of-use/',
acceptPaypal: false,
acceptedCards: ['mastercard',
'discover',
'american_express',
'visa'],
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.