/// <summary> /// Creates a payment. /// </summary> /// <param name="request">The data to create the payment.</param> /// <param name="requestOptions"><see cref="RequestOptions"/>.</param> /// <returns>The created payment.</returns> /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception> /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception> /// <remarks> /// Check the API documentation /// <a href="https://www.mercadopago.com/developers/en/reference/payments/_payments/post/">here</a>. /// </remarks> public Payment Create( PaymentCreateRequest request, RequestOptions requestOptions = null) { return(Send( "/v1/payments", HttpMethod.POST, request, requestOptions)); }
/// <summary> /// Creates a payment as an asynchronous operation. /// </summary> /// <param name="request">The data to create the payment.</param> /// <param name="requestOptions"><see cref="RequestOptions"/></param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A task whose the result is the created payment.</returns> /// <exception cref="MercadoPagoException">If a unexpected exception occurs.</exception> /// <exception cref="MercadoPagoApiException">If the API returns a error.</exception> /// <remarks> /// Check the API documentation /// <a href="https://www.mercadopago.com/developers/en/reference/payments/_payments/post/">here</a>. /// </remarks> public Task <Payment> CreateAsync( PaymentCreateRequest request, RequestOptions requestOptions = null, CancellationToken cancellationToken = default) { return(SendAsync( "/v1/payments", HttpMethod.POST, request, requestOptions, cancellationToken)); }