[英]Paypal Express Checkout with AngularJS
Has anyone had success integrating the PayPal Express Checkout API into an AngularJS web app? 是否有人成功将PayPal Express Checkout API集成到AngularJS Web应用程序中? I have tried to adapt the "in-context" integration steps into my angular site;
我试图将“上下文”集成步骤调整到我的角度站点中。 however, it only works properly once.
但是,它只能正常运行一次。
My scenario is this: 我的情况是这样的:
paypal.checkout.initXO()
, and then makes a server-side call to generate an express checkout token paypal.checkout.initXO()
,然后进行服务器端调用以生成快速结账令牌 paypal.checkout.startFlow(tokenFromServer)
paypal.checkout.startFlow(tokenFromServer)
As I said above, this works fine once; 就像我在上面说的那样,这可以正常工作一次; the PayPal API navigates the browser to my confirmation page just as I expect.
PayPal API会按照我的期望将浏览器导航到我的确认页面。 However, subsequent attempts to use the express checkout API don't navigate the browser after finishing with the paypal popup window.
但是,在完成贝宝弹出窗口后,随后尝试使用Express Checkout API的操作不会导航浏览器。 Refreshing the browser allows me to use express checkout again, once.
刷新浏览器使我可以再次使用快速结帐。
I'm not seeing any errors in the Javascript console. 我在Javascript控制台中没有看到任何错误。
In the meantime I've added this to the ui.router
state that is the start point of my "purchase" workflow: 同时,我将其添加到
ui.router
状态,这是我的“购买”工作流程的起点:
.state("example.buy.the.thing", {
url: "/buy",
templateUrl: "path/to/my/template.html",
controller: ["$window", ($window) => {
if ($window.needsPaypalRefresh) {
$window.location.reload();
}
$window.needsPaypalRefresh = true;
}]
})
It refreshes the page on subsequent visits to this state, which resets the PayPal API. 下次访问此状态时,它将刷新页面,从而重置PayPal API。 It works.
有用。 It's ugly, but it works.
很难看,但是可以用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.