0

我希望用户使用贝宝接受信用卡付款。所以我已经从应用程序授权用户并拨打此链接中提到的电话 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”

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

4

1 回答 1

1

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

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

于 2013-09-20T19:33:34.707 回答