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

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