stripe/resources/
payment_method_ext.rs1use serde::{Deserialize, Serialize};
2
3use crate::client::{Client, Response};
4use crate::ids::{CustomerId, PaymentMethodId};
5use crate::resources::PaymentMethod;
6
7#[derive(Clone, Debug, Deserialize, Serialize)]
11pub struct AttachPaymentMethod {
12 pub customer: CustomerId,
13}
14
15impl PaymentMethod {
16 pub fn attach(
20 client: &Client,
21 payment_method_id: &PaymentMethodId,
22 params: AttachPaymentMethod,
23 ) -> Response<PaymentMethod> {
24 client.post_form(&format!("/payment_methods/{}/attach", payment_method_id), params)
25 }
26
27 pub fn detach(client: &Client, payment_method_id: &PaymentMethodId) -> Response<PaymentMethod> {
31 client.post(&format!("/payment_methods/{}/detach", payment_method_id))
32 }
33}