/// <summary> /// Captures a pending payment. /// </summary> /// <param name="id">Payment id.</param> /// <param name="amount">Amount to capture (if null, will capture the total payment amount).</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <returns>The captured 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 Capture( long id, decimal?amount, RequestOptions requestOptions = null) { var request = new PaymentCaptureRequest { TransactionAmount = amount, }; return(Send( $"/v1/payments/{id}", HttpMethod.Put, request, requestOptions)); }
/// <summary> /// Captures a authorized payment async. /// </summary> /// <param name="id">Payment id.</param> /// <param name="amount">Amount to capture (if null, will capture the total payment amount).</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A task whose the result is the captured 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> CaptureAsync( long id, decimal?amount, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { var request = new PaymentCaptureRequest { TransactionAmount = amount, }; return(SendAsync( $"/v1/payments/{id}", HttpMethod.Put, request, requestOptions, cancellationToken)); }