arlyon / async-stripe

Async (and blocking!) Rust bindings for the Stripe API
https://payments.rs
Apache License 2.0
436 stars 127 forks source link

Cannot specify parameters when paying invoice #446

Closed migueltol22 closed 5 months ago

migueltol22 commented 11 months ago

Describe the bug

The stripe documentation highlights various parameters that can be set to pay an invoice. However the the current pay method for the invoice struct does not allow specifying any of these parameters.

To Reproduce

  1. Create invoice
  2. Attempt to pay invoice

Expected behavior

I would expect being able to pass in a struct to the pay function with all the available parameters. Something like

pub struct PayInvoiceParameters {
    pub forgive: Option<bool>
    pub mandate: Option<MandateId>
    pub off_session: Option<bool>
    pub paid_out_of_band: Option<bool>
    pub payment_method: Option<PaymentMethodId>
    pub source: Option<SourceId>
}

let invoice = Invoice::pay(&client, &invoice_id, &PayInvoiceParameters{ 
    paid_out_band: true,
    ..Default::default()
}).await?;

Code snippets

No response

OS

macOS

Rust version

1.70.0

Library version

async-stripe 0.22.2

API version

2022-11-15

Additional context

No response