Class: Stripe::CustomerPaymentSourceService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::CustomerPaymentSourceService
- Defined in:
- lib/stripe/services/customer_payment_source_service.rb
Defined Under Namespace
Classes: CreateParams, DeleteParams, ListParams, RetrieveParams, UpdateParams, VerifyParams
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.
219 220 221 222 223 224 225 226 227 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 219 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.
230 231 232 233 234 235 236 237 238 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 230 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.
241 242 243 244 245 246 247 248 249 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 241 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.
252 253 254 255 256 257 258 259 260 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 252 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.
263 264 265 266 267 268 269 270 271 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 263 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.
274 275 276 277 278 279 280 281 282 |
# File 'lib/stripe/services/customer_payment_source_service.rb', line 274 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 |