private V1PaypalRefundResult _V1CCRefund(string paymentId) { /* full refund */ string url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "v1/payments/sale/" + paymentId + "/refund"; JavaScriptSerializer serializer = new JavaScriptSerializer(); string return_json = _V1Action(url, "{}"); V1PaypalRefundResult result = serializer.Deserialize <V1PaypalRefundResult>(return_json); return(result); }
private V1PaypalRefundResult _V1CCRefund(string salesId, string currency, double amount) { /* partial refund */ string url = _baseUrl + (_baseUrl.EndsWith("/") ? "" : "/") + "v1/payments/sale/" + salesId + "/refund"; V1PaypalAmount refund_amount = new V1PaypalAmount { currency = currency, total = amount.ToString("0.00") }; JavaScriptSerializer serializer = new JavaScriptSerializer(); //serializer.RegisterConverters(new JavaScriptConverter[] { new NullPropertiesConverter() }); string refund_json = serializer.Serialize(refund_amount); string return_json = _V1Action(url, refund_json); V1PaypalRefundResult result = serializer.Deserialize <V1PaypalRefundResult>(return_json); return(result); }