class GoCardless::Resources::Payment
Payment
objects represent payments from a [customer](developer.gocardless.com/pro/#api-endpoints-customers) to a [creditor](developer.gocardless.com/pro/#api-endpoints-creditors), taken against a Direct Debit [mandate](developer.gocardless.com/pro/#api-endpoints-mandates).
GoCardless
will notify you via a [webhook](developer.gocardless.com/pro/#webhooks) whenever the state of a payment changes. Represents an instance of a payment resource returned from the API
Attributes
amount[R]
amount_refunded[R]
charge_date[R]
created_at[R]
currency[R]
description[R]
id[R]
metadata[R]
reference[R]
status[R]
Public Class Methods
new(object)
click to toggle source
initialize a resource instance @param object [Hash] an object returned from the API
# File lib/gocardless-pro/resources/payment.rb, line 47 def initialize(object) @object = object @amount = object['amount'] @amount_refunded = object['amount_refunded'] @charge_date = object['charge_date'] @created_at = object['created_at'] @currency = object['currency'] @description = object['description'] @id = object['id'] @links = object['links'] @metadata = object['metadata'] @reference = object['reference'] @status = object['status'] end
Public Instance Methods
links()
click to toggle source
return the links that the resource has
# File lib/gocardless-pro/resources/payment.rb, line 64 def links Struct.new( *{ creditor: '', mandate: '', payout: '', subscription: '' }.keys.sort ).new(*@links.sort.map(&:last)) end
to_h()
click to toggle source
Provides the resource as a hash of all it’s readable attributes
# File lib/gocardless-pro/resources/payment.rb, line 81 def to_h @object end