class Pin::Charges

This class models Pin's Charges API

Public Class Methods

all(page = nil, pagination = false) click to toggle source

Lists all of the charges for your account args: page (Fixnum), pagination (Boolean) returns: a collection of charge objects

if pagination is passed, access the response hash with [:response] and the pagination hash with [:pagination]

pinpayments.com/docs/api/charges#get-charges

# File lib/pin_up/charge.rb, line 14
def self.all(page = nil, pagination = false)
  build_collection_response(make_request(:get, { url: "charges?page=#{page}" }), pagination)
end
capture(token) click to toggle source

Captures a previously authorised charge and returns its details. args: charge-token (String) returns: charge object pinpayments.com/docs/api/charges#put-charges

# File lib/pin_up/charge.rb, line 58
def self.capture(token)
  build_response(make_request(:put, { url: "charges/#{token}/capture" } ))
end
create(options = {}) click to toggle source

Create a charge given charge details and a card, a card_token or a customer_token args: options (Hash) returns: a charge object pinpayments.com/docs/api/charges#post-charges

# File lib/pin_up/charge.rb, line 50
def self.create(options = {})
  build_response(make_request(:post, {url: 'charges', options: options} ))
end
find(token) click to toggle source

Find a charge for your account given a token args: token (String) returns: a charge object pinpayments.com/docs/api/charges#get-charge

# File lib/pin_up/charge.rb, line 23
def self.find(token)
  build_response(make_request(:get, {url: "charges/#{token}" } ))
end