public async Task <ChargeResponseModel> ChargeAuthorization(ChargeAuthorizationInputModel model) { var client = HttpConnection.CreateClient(this._secretKey); var jsonObj = JsonConvert.SerializeObject(model); var content = new StringContent(jsonObj, Encoding.UTF8, "application/json"); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = await client.PostAsync("charge", content); var json = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <ChargeResponseModel>(json)); }
public async Task <ChargeResponseModel> ChargeAuthorization(string amount, string email, string pin, string authorization_code, string display_name = null, string value = null, string variable_name = null) { var client = HttpConnection.CreateClient(this._secretKey); var model = new ChargeAuthorizationInputModel() { amount = amount, email = email, pin = pin, authorization_code = authorization_code }; if (!string.IsNullOrWhiteSpace(display_name)) { var _meta = new Metadata() { custom_fields = new List <ChargeAuthCustomField>() { //Capacity = //display_name = display_name, //value = value, //variable_name = variable_name } }; } var jsonObj = JsonConvert.SerializeObject(model); var content = new StringContent(jsonObj, Encoding.UTF8, "application/json"); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = await client.PostAsync("charge", content); var json = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <ChargeResponseModel>(json)); }