Feature Request: Attach a PaymentMethod to a Customer
phayes opened this issue · 1 comments
phayes commented
I've found that I'm needing this API:
https://stripe.com/docs/api/payment_methods/attach
It would be nice if it was implemented.
Thanks for the awesome crate!
phayes commented
This is the workaround I have for now:
pub fn attach_payment_method(
client: &stripe::Client,
customer_id: String,
payment_method: stripe::PaymentMethodId,
) -> stripe::Response<stripe::PaymentMethod> {
#[derive(Serialize)]
struct AttachPaymentMethod {
customer: String,
}
let params = AttachPaymentMethod {
customer: customer_id,
};
client.post_form(
&format!("/payment_methods/{}/attach", payment_method),
params,
)
}