class EasyPost::Services::Billing
Public Instance Methods
Source
# File lib/easypost/services/billing.rb, line 20 def delete_payment_method(priority) payment_info = get_payment_method_info(priority.downcase) endpoint = payment_info[0] payment_id = payment_info[1] @client.make_request(:delete, "#{endpoint}/#{payment_id}") # Return true if succeeds, an error will be thrown if it fails true end
Delete a payment method.
Source
# File lib/easypost/services/billing.rb, line 7 def fund_wallet(amount, priority = 'primary') payment_info = get_payment_method_info(priority.downcase) endpoint = payment_info[0] payment_id = payment_info[1] wrapped_params = { amount: amount } @client.make_request(:post, "#{endpoint}/#{payment_id}/charges", wrapped_params) # Return true if succeeds, an error will be thrown if it fails true end
Fund your EasyPost
wallet by charging your primary or secondary card on file.
Source
# File lib/easypost/services/billing.rb, line 32 def retrieve_payment_methods response = @client.make_request(:get, '/payment_methods') payment_methods = EasyPost::InternalUtilities::Json.convert_json_to_object(response) if payment_methods['id'].nil? raise EasyPost::Errors::InvalidObjectError.new(EasyPost::Constants::NO_PAYMENT_METHODS) end payment_methods end
Retrieve all payment methods.