我使用以下代码为 Paypal Rest API 存储信用卡信息
String AccessToken = "";
PaypalAccessToken pat = new PaypalAccessToken();
AccessToken = pat.GetPaypalAccessToken();
PayPal.Api.Payments.Address add = new PayPal.Api.Payments.Address();
add.city = TextBoxCity.Text;
add.line1 = TextBoxAddress.Text;
add.phone = TextBoxPhoneNumber.Text;
add.postal_code = TextBoxZipcode.Text;
add.state = DropDownState.SelectedValue;
PayPal.Api.Payments.CreditCard cc = new PayPal.Api.Payments.CreditCard();
cc.number = TextBoxCreditCardNumber.Text;
cc.expire_month = Convert.ToInt16(TextBoxExpiryMonth.Text);
cc.expire_year = Convert.ToInt16(TextBoxExpiryYear.Text);
cc.cvv2 = TextBoxCVVNumber.Text;
cc.type = DropDownCreditCardType.SelectedValue;
//cc.billing_address = add;
PayPal.Api.Payments.CreditCard ResultCC = cc.Create(AccessToken);
此代码适用于演示凭据,但是当我尝试将其与实时凭据一起使用时,它给了我错误:401 Unauthorized。我仍然可以在实时凭据中获取令牌,但我无法存储信用卡。