oauth-2.0 - 使用 Paypal 信用卡付款时出现 401 Unauthorized 错误

标签 oauth-2.0 paypal

我希望用户使用 paypal 接受信用卡付款。所以我已经从应用程序授权用户并按照此链接中所述进行调用 https://developer.paypal.com/webapps/developer/docs/integration/direct/accept-credit-cards/

这是我从本地机器发出的 curl 请求

  curl -v https://api.sandbox.paypal.com/v1/payments/payment \

  -H "Content-Type:application/json" \
  -H "Authorization:Bearer 22SKUmLAeeKccfG-FmJdFiT97FLQnjSbeDHDN0hHdEQ" \
  -d '{
        "intent":"sale",
        "payer":{
        "payment_method":"credit_card",
        "funding_instruments":[
         {
           "credit_card":{
             "number":"4417119669820331",
             "type":"visa",
             "expire_month":11,
             "expire_year":2018,
             "cvv2":"874",
             "first_name":"Joe",
             "last_name":"Shopper",
      "billing_address":{
        "line1":"52 N Main ST",
        "city":"Johnstown",
        "country_code":"US",
        "postal_code":"43210",
        "state":"OH"
      }
    }
  }
]
},
"transactions":[
{
  "amount":{

"total":"7.47",
    "currency":"USD",
    "details":{
      "subtotal":"7.41",
      "tax":"0.03",
      "shipping":"0.03"
    }
  },
  "description":"This is the payment transaction description."
  }
]
}'

我收到以下错误“401 Unauthorized”

任何人都可以帮助我在上面的电话中缺少什么。或进行信用卡付款需要任何其他范围。

最佳答案

尝试获取新的访问 token 并将其用作调用的一部分: https://developer.paypal.com/webapps/developer/docs/integration/direct/make-your-first-call/#get-an-access-token

401 通常意味着您没有正确的访问 token 或它已过期。

关于oauth-2.0 - 使用 Paypal 信用卡付款时出现 401 Unauthorized 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18888293/

相关文章:

c# - 自己发行 JWT token 与使用 IdentityServer4(OIDC) 进行 Web API

oauth-2.0 - Google Oauth token 限制

iframe - 使用 IPN 验证 PayPal 付款是否成功

ssl - PayPal IPN SSL 协议(protocol)版本

php - 组成以下标准对象的 PHP 代码是什么

java - 从 OAuth2.1 迁移到 OAuth2.0

oauth-2.0 - OAuth2 : query string vs. 片段

Java SSL DH key 对生成 - 质数错误

paypal - 无法使用 Paypal 测试帐户付款

PayPal Express Checkout 集成未完全完成交易