class Pin::Charge
Attributes
amount[RW]
amount_refunded[RW]
card[RW]
card_token[RW]
created_at[RW]
currency[RW]
customer_token[RW]
description[RW]
email[RW]
error_message[RW]
ip_address[RW]
merchant_entitlement[RW]
refund_pending[RW]
refunds[RW]
status_message[RW]
success[RW]
token[RW]
total_fees[RW]
transfer[RW]
Public Class Methods
create(options = {})
click to toggle source
options should be a hash with the following params email, description, amount, currency, ip_address
are mandatory identifier must be a hash, can take the forms
{card: <Pin::Card>} {card_token: String<"...">} {customer_token: String<"...">} {customer: <Pin::Customer>}
eg. {email: ‘user@example.com’, description: ‘One month subscription’, amount: 19900, currency: ‘USD’, ip_address
: ‘192.0.0.1’, customer_token
: ‘asdf’}
Calls superclass method
Pin::Base::create
# File lib/pin-payments/charge.rb, line 20 def create(options = {}) options[:customer_token] = options.delete(:customer).token unless options[:customer].nil? super(options) end
search(options = {})
click to toggle source
search for charges using parameters provided in options available parameters:
query (string) start_date (date, or string formatted as 'YYYY-MM-DD') end_date (date, or string formatted as 'YYYY-MM-DD') sort (string or symbol: "created_at" (default), "description", or "amount") direction ("asc"/"desc", or 1/-1)
# File lib/pin-payments/charge.rb, line 32 def search(options = {}) options[:direction] = options[:direction] == 'asc' ? 1 : -1 if ['asc', 'desc'].include?(options[:direction]) build_collection_from_response(authenticated_get('/charges/search', options)) end
Public Instance Methods
refund!(amnt = nil)
click to toggle source
creates a refund for this Charge
refunds the full amount of the charge by default, provide an amount in cents to override
# File lib/pin-payments/charge.rb, line 46 def refund!(amnt = nil) Refund.create(token, amnt) end