我試圖消耗stripe.com與restsharp API,使用充電命令restsharp如何添加鍵值對的參數
https://stripe.com/docs/api/php#create_charge
有通過元數據作爲鍵值對,但我不機遇「不像是會成功
const string baseUrl = "https://api.stripe.com/";
const string endPoint = "v1/charges";
var apiKey = this.SecretKey;
var client = new RestClient(baseUrl) { Authenticator = new HttpBasicAuthenticator(apiKey, "") };
var request = new RestRequest(endPoint, Method.POST);
request.AddParameter("card", token);
request.AddParameter("amount", wc.totalToPayForStripe);
request.AddParameter("currency", "eur");
request.AddParameter("description", wc.crt.cartid + " - " + wc.co.oid);
request.AddParameter("metadata", "{cartid: " + wc.crt.cartid + ", oid: " + wc.co.oid + "}");
request.AddParameter("statement_description", "# " + wc.crt.cartid);
request.AddParameter("description", wc.crt.cartid + " - " + wc.co.oid);
始終得到以下錯誤:
Invalid metadata: metadata must be a set of key-value pairs
顯然,我沒有按照我應該的方式傳遞鍵值對,但是我找不到任何restsharp文檔。
任何人都可以幫助嗎?
工程就像一個魅力,非常感謝! – 2014-10-17 14:17:02
也爲我工作。使用不同的語言編碼,但是相同的問題和解決方案。 – pk1557 2014-10-18 23:42:13