/// <summary> /// Cancels a pending payment. /// </summary> /// <param name="id">Payment id.</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <returns>The cancelled payment.</returns> /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception> /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception> public Resource.Payment.Payment Cancel( long id, RequestOptions requestOptions = null) { var request = new PaymentCancelRequest(); return(Send( $"/v1/payments/{id}", HttpMethod.Put, request, requestOptions)); }
/// <summary> /// Cancels a pending payment async. /// </summary> /// <param name="id">Payment id.</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A task whose the result is the cancelled payment.</returns> /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception> /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception> public Task <Resource.Payment.Payment> CancelAsync( long id, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { var request = new PaymentCancelRequest(); return(SendAsync( $"/v1/payments/{id}", HttpMethod.Put, request, requestOptions, cancellationToken)); }