401使用Paypal信用卡付款时未经授权的错误

时间:2013-09-19 07:08:57

标签: oauth-2.0 paypal

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

这是我正在制作本地机器的卷曲请求

  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”

任何人都可以帮我解决上述电话中缺少的问题。或者进行信用卡付款需要任何额外的范围。

1 个答案:

答案 0 :(得分:1)

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

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