【问题标题】:Sending the token to server paypal using angularjs使用 angularjs 将令牌发送到服务器贝宝
【发布时间】:2016-09-06 14:38:57
【问题描述】:

我已成功获取一次性信用卡令牌,我需要将此令牌发送到我的服务器以完成计费流程。我可能想使用 Angular 的内置 $http 模块或第三方 REST API 库(例如 RestAngular)将信用卡令牌发送到我的服务器。

我像这样使用 $http 模块:

$http({

             url: 'https://api.sandbox.paypal.com/v1/payments/payment',
             method: 'GET',
             headers: {

                 'Content-Type': 'application/json',
                 'Authorization': 'Bearer ' + $localStorage.accessTokenPayPal,
             }, 

            }).success(function (data, status, headers, config) {
                         //console.log(data);
                           alert("valide: "+ JSON.stringify(data));

             }).error(function (error) {
                         //console.log(data);
                          alert("error:"+JSON.stringify(error));
             });

但我总是发现这条消息:

{"count":0}

请问这是什么问题??

【问题讨论】:

    标签: angularjs curl paypal oauth-2.0


    【解决方案1】:

    您使用的是哪个版本的 Angularjs?从 1.4 版本的 angularjs 开始, $http 不支持成功和错误方法。请参阅link 上的弃用通知。请使用 .then 与成功和失败回调。如果这不是您的问题,请向我们提供详细的错误消息或调用的控制台日志消息。

    谢谢, 索玛。

    【讨论】:

      猜你喜欢
      • 2016-09-08
      • 2016-12-03
      • 2017-03-16
      • 2017-11-08
      • 2011-11-20
      • 1970-01-01
      • 2020-12-14
      • 1970-01-01
      • 2016-05-23
      相关资源
      最近更新 更多