这是我路由器的一部分.js:
.state('app.thanks', {
url: "/thanks",
views: {
'menuContent': {
templateUrl: "templates/thanks.php"
}
}
})
在 payapl 网站付款首选项 ->返回 URL 地址中,我定义了这一点:https://my-website-url.com/#/app/thanks,
据我了解,为了从 Payapl 获取参数,我需要使用此代码来获取交易 ID:
if(isset($_GET['tx']) && ($_GET['tx'])!=null && ($_GET['tx'])!= "") {
$tx = $_GET['tx'];
if($tx) doSometing();
}
else {
exitCode();
}
如何将其与我的角度应用程序结合使用? 只需要把这段代码放在我的感谢.php页面?
谢谢!!
您无法使用角度应用程序执行此步骤。这必须非常清楚,因为您需要验证交易和付款PayPal。要正确执行此操作,代码必须在服务器上运行并验证付款过程是否确实成功,否则您可以免费分发产品。您没有在此处添加任何代码来执行此操作,因此我希望您准备好一个可以正确执行此操作的代码。
在服务器上验证事务后,您自己的脚本可以将用户重定向到角度应用程序上的正确位置。所以你的设置和脚本应该类似于这个 -
网站付款首选项 -
> https://my-website-url.com/paypalVerify.phpif ( isset($_GET['tx']) && $_GET['tx'] ) {
$tx = $_GET['tx'];
if(verifyTx($tx)) {
//do some stuff
header('Location: https://my-website-url.com/#/app/thanks');
die();
}
}
header('Location: https://my-website-url.com/#/app/wheresMyMoney');
die();