0
我嘗試使用RestSharp發送請求到Stripe API。我構建了我的請求,但由於驗證錯誤而無法發送。該請求返回0錯誤代碼。Repsharp請求條帶給SendFailure錯誤
這裏是我的代碼:
var client = new RestClient("https://api.stripe.com");
client.Authenticator = new HttpBasicAuthenticator (stripe_key, "");
var request = new RestRequest("v1/tokens", Method.POST);
request.AddParameter("card[number]", card.number);
request.AddParameter("card[exp_month]", card.expMonth);
request.AddParameter("card[exp_year]", card.expYear);
request.AddParameter("card[cvc]", card.cvc);
IRestResponse response = client.Execute(request);
Log.trace ("Content : " + response.Content);
Log.trace ("Status code : " + response.StatusCode.ToString());
Log.trace ("Error message : " + response.ErrorMessage);
而且我的輸出:
Content :
Status code : 0
Error message : Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
難道你不可能使用[Stripe.net](https://github.com/jaymedavis/stripe.net)? – Ywain
不,我在Unity上工作,只支持.Net 2.0 ... –
啊,那太糟糕了。 根據錯誤消息,問題似乎是您的系統無法連接到「https:// api.stripe.com」,因爲它無法驗證由Stripe的API服務器發送的SSL證書。如果可以,請嘗試導入此證書包(從官方的Stripe Ruby綁定中):https://raw.githubusercontent.com/stripe/stripe-ruby/master/lib/data/ca-certificates.crt – Ywain