See PayPal Developer documentation for more information.
/// <summary> /// Refunds a sale, by ID. For a full refund, include an empty payload in the JSON request body. For a partial refund, include an `amount` object in the JSON request body. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="refundRequest">RefundRequest</param> /// <returns>DetailedRefund</returns> public static DetailedRefund Refund(APIContext apiContext, string saleId, RefundRequest refundRequest) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(saleId, "saleId"); ArgumentValidator.Validate(refundRequest, "refundRequest"); // Configure and send the request var pattern = "v1/payments/sale/{0}/refund"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { saleId }); return(PayPalResource.ConfigureAndExecute <DetailedRefund>(apiContext, HttpMethod.POST, resourcePath, refundRequest.ConvertToJson())); }
/// <summary> /// Refunds a sale, by ID. For a full refund, include an empty payload in the JSON request body. For a partial refund, include an `amount` object in the JSON request body. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="refundRequest">RefundRequest</param> /// <returns>DetailedRefund</returns> public static DetailedRefund Refund(APIContext apiContext, string saleId, RefundRequest refundRequest) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(saleId, "saleId"); ArgumentValidator.Validate(refundRequest, "refundRequest"); // Configure and send the request var pattern = "v1/payments/sale/{0}/refund"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { saleId }); return PayPalResource.ConfigureAndExecute<DetailedRefund>(apiContext, HttpMethod.POST, resourcePath, refundRequest.ConvertToJson()); }