Class: Stripe::CustomerPaymentSourceService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::CustomerPaymentSourceService
- Defined in:
- lib/stripe/services/customer_payment_source_service.rb
Instance Method Summary collapse
-
#create(customer, params = {}, opts = {}) ⇒ Object
When you create a new credit card, you must specify a customer or recipient on which to create it.
-
#delete(customer, id, params = {}, opts = {}) ⇒ Object
Delete a specified source for a given customer.
-
#list(customer, params = {}, opts = {}) ⇒ Object
List sources for a specified customer.
-
#retrieve(customer, id, params = {}, opts = {}) ⇒ Object
Retrieve a specified source for a given customer.
-
#update(customer, id, params = {}, opts = {}) ⇒ Object
Update a specified source for a given customer.
-
#verify(customer, id, params = {}, opts = {}) ⇒ Object
Verify a specified bank account for a given customer.
Methods inherited from StripeService
#initialize, #request, #request_stream
Constructor Details
This class inherits a constructor from Stripe::StripeService
Instance Method Details
#create(customer, params = {}, opts = {}) ⇒ Object
When you create a new credit card, you must specify a customer or recipient on which to create it.
If the card’s owner has no default card, then the new card will become the default. However, if the owner already has a default, then it will not change. To change the default, you should [update the customer](stripe.com/docs/api#update_customer) to have a new default_source.
11 12 13 14 15 16 17 18 19 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 11 def create(customer, params = {}, opts = {}) request( method: :post, path: format("/v1/customers/%<customer>s/sources", { customer: CGI.escape(customer) }), params: params, opts: opts, base_address: :api ) end |
#delete(customer, id, params = {}, opts = {}) ⇒ Object
Delete a specified source for a given customer.
22 23 24 25 26 27 28 29 30 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 22 def delete(customer, id, params = {}, opts = {}) request( method: :delete, path: format("/v1/customers/%<customer>s/sources/%<id>s", { customer: CGI.escape(customer), id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#list(customer, params = {}, opts = {}) ⇒ Object
List sources for a specified customer.
33 34 35 36 37 38 39 40 41 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 33 def list(customer, params = {}, opts = {}) request( method: :get, path: format("/v1/customers/%<customer>s/sources", { customer: CGI.escape(customer) }), params: params, opts: opts, base_address: :api ) end |
#retrieve(customer, id, params = {}, opts = {}) ⇒ Object
Retrieve a specified source for a given customer.
44 45 46 47 48 49 50 51 52 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 44 def retrieve(customer, id, params = {}, opts = {}) request( method: :get, path: format("/v1/customers/%<customer>s/sources/%<id>s", { customer: CGI.escape(customer), id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#update(customer, id, params = {}, opts = {}) ⇒ Object
Update a specified source for a given customer.
55 56 57 58 59 60 61 62 63 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 55 def update(customer, id, params = {}, opts = {}) request( method: :post, path: format("/v1/customers/%<customer>s/sources/%<id>s", { customer: CGI.escape(customer), id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#verify(customer, id, params = {}, opts = {}) ⇒ Object
Verify a specified bank account for a given customer.
66 67 68 69 70 71 72 73 74 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 66 def verify(customer, id, params = {}, opts = {}) request( method: :post, path: format("/v1/customers/%<customer>s/sources/%<id>s/verify", { customer: CGI.escape(customer), id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |