来自curl 手册页
-u, --user <user:password>
是用户凭据
-d, --data <data>
是 POST 数据
因此您可以将其“解码”为:
using (var wc = new System.Net.WebClient())
{
// data
string parameters = string.Concat("description=", description, "&card[number]=" , cardNumber, "&card[exp_month]=", cardExpirationMonth, "&card[exp_year]=", cardExpirationYear),
url = "https://api.stripe.com/v1/customers;
// let's fake it and make it was a browser requesting the data
wc.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
// credentials
wc.Credentials = new System.Net.NetworkCredential("*private key here*", "");
// make it a POST instead of a GET
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
// send and get answer in a string
string result = wc.UploadString(url, parameters);
}
使用现有答案的 POST 调整进行更新。