class Bitkassa::PaymentResponse

A PaymentResponse represents the immediate response after requesting a payment. It can will parse the JSON and contain the information nessecary to determine the status of the payment request.

Attributes

address[RW]

Refer to Initialize for the description of all attributes.

amount[RW]

Refer to Initialize for the description of all attributes.

bitcoin_url[RW]

Refer to Initialize for the description of all attributes.

error[RW]

Refer to Initialize for the description of all attributes.

expire[RW]

Refer to Initialize for the description of all attributes.

payment_id[RW]

Refer to Initialize for the description of all attributes.

payment_url[RW]

Refer to Initialize for the description of all attributes.

success[RW]

Refer to Initialize for the description of all attributes.

Public Class Methods

from_json(json) click to toggle source

Generate a PaymentResponse from a JSON payload.

# File lib/bitkassa/payment_response.rb, line 18
def self.from_json(json)
  new(JSON.parse(json))
end
new(attributes) click to toggle source

Initialize a new payment response. Usually done by a PaymentRequest.

Attributes:

  • payment_id, Unique ID assigned to this payment by Bitkassa

  • payment_url, The Bitcoin payment URL which you can show (as link and/or QR) for the customer to pay from his wallet (if you’re hosting your own payment page)

  • address The Bitcoin address where the customer is supposed to send his payment.

  • amount, The amount in satoshis to be paid.

  • expire, Unix timestamp when the payment expires (typically 15 minutes after start)

  • error, Reason why the payment could not be initiated. Only set when payment errord.

  • success, Confirmation that the API call was processed successfull

# File lib/bitkassa/payment_response.rb, line 38
def initialize(attributes)
  attributes.each do |key, value|
    setter_method = "#{key}=".to_sym
    send(setter_method, value)
  end
end