Class: Braintree::Transaction

### Home Classes Methods

### In Files

- lib/braintree/transaction/address_details.rb
- lib/braintree/transaction/credit_card_details.rb
- lib/braintree/transaction/customer_details.rb
- lib/braintree/transaction/status_details.rb
- lib/braintree/transaction/subscription_details.rb
- lib/braintree/transaction.rb

### Parent

Object

### Namespace

- MODULE Braintree::Transaction::CreatedUsing
- MODULE Braintree::Transaction::GatewayRejectionReason
- MODULE Braintree::Transaction::Source
- MODULE Braintree::Transaction::Status

### Methods

- ::clone_transaction
- ::clone_transaction!
- ::create
- ::create!
- ::create_from_transparent_redirect
- ::create_transaction_url
- ::credit
- ::credit!
- ::find
- ::refund
- ::sale
- ::sale!
- ::search
- ::submit_for_settlement
- ::submit_for_settlement!
- ::void
- ::void!
- #==
- #refund
- #refund_id
- #refunded?
- #submit_for_settlement
- #submit_for_settlement!
- #vault_billing_address
- #vault_credit_card
- #vault_customer
- #vault_shipping_address
- #void
- #void!

### Class/Module Index

Quicksearch

- Braintree
- Braintree::AddOn
- Braintree::AddOnGateway
- Braintree::Address
- Braintree::AddressGateway
- Braintree::AdvancedSearch
- Braintree::AdvancedSearch::MultipleValueOrTextNode
- Braintree::AuthenticationError
- Braintree::AuthorizationError
- Braintree::BraintreeError
- Braintree::Configuration
- Braintree::ConfigurationError
- Braintree::CreditCard
- Braintree::CreditCard::CardType
- Braintree::CreditCard::CustomerLocation
- Braintree::CreditCardVerification
- Braintree::CreditCardVerification::Status
- Braintree::Customer
- Braintree::Discount
- Braintree::DiscountGateway
- Braintree::DownForMaintenanceError
- Braintree::ErrorCodes
- Braintree::ErrorCodes::Address
- Braintree::ErrorCodes::CreditCard
- Braintree::ErrorCodes::CreditCard::Options
- Braintree::ErrorCodes::Customer
- Braintree::ErrorCodes::Descriptor
- Braintree::ErrorCodes::SettlementBatchSummary
- Braintree::ErrorCodes::Subscription
- Braintree::ErrorCodes::Subscription::Modification
- Braintree::ErrorCodes::Transaction
- Braintree::ErrorCodes::Transaction::Options
- Braintree::ErrorResult
- Braintree::Errors
- Braintree::ForgedQueryString
- Braintree::NotFoundError
- Braintree::Plan
- Braintree::SSLCertificateError
- Braintree::ServerError
- Braintree::SettlementBatchSummary
- Braintree::SettlementBatchSummaryGateway
- Braintree::Subscription
- Braintree::Subscription::Status
- Braintree::Subscription::TrialDurationUnit
- Braintree::SuccessfulResult
- Braintree::Test
- Braintree::Test::CreditCardNumbers
- Braintree::Test::CreditCardNumbers::FailsSandboxVerification
- Braintree::Test::TransactionAmounts
- Braintree::Transaction
- Braintree::Transaction::CreatedUsing
- Braintree::Transaction::GatewayRejectionReason
- Braintree::Transaction::Source
- Braintree::Transaction::Status
- Braintree::TransparentRedirect
- Braintree::TransparentRedirectGateway
- Braintree::UnexpectedError
- Braintree::UpgradeRequiredError
- Braintree::ValidationError
- Braintree::ValidationErrorCollection
- Braintree::ValidationsFailed
- Braintree::Version

No matching classes.

# Braintree::Transaction

See www.braintreepayments.com/docs/ruby/transactions/overview

### Attributes

add_ons[R]
amount[R]
avs_error_response_code[R]
avs_postal_code_response_code[R]
avs_street_address_response_code[R]
billing_details[R]
created_at[R]
credit_card_details[R]
currency_iso_code[R]
custom_fields[R]
customer_details[R]
cvv_response_code[R]
descriptor[R]
discounts[R]
gateway_rejection_reason[R]
id[R]
merchant_account_id[R]
order_id[R]
processor_authorization_code[R]

The authorization code from the processor.

processor_response_code[R]

The response code from the processor.

processor_response_text[R]

The response text from the processor.

purchase_order_number[R]
refund_ids[R]
refunded_transaction_id[R]
settlement_batch_id[R]
shipping_details[R]
status[R]

See Transaction::Status

status_history[R]
subscription_details[R]
subscription_id[R]
tax_amount[R]
tax_exempt[R]
type[R]

Will either be "sale" or "credit"

updated_at[R]

### Public Class Methods

clone_transaction(transaction_id, attributes) click to toggle source

    # File lib/braintree/transaction.rb, line 86
    def self.clone_transaction(transaction_id, attributes)
      Configuration.gateway.transaction.clone_transaction(transaction_id, attributes)
    end

clone_transaction!(transaction_id, attributes) click to toggle source

    # File lib/braintree/transaction.rb, line 90
    def self.clone_transaction!(transaction_id, attributes)
      return_object_or_raise(:transaction) { clone_transaction(transaction_id, attributes) }
    end

create(attributes) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/create

    # File lib/braintree/transaction.rb, line 77
    def self.create(attributes)
      Configuration.gateway.transaction.create(attributes)
    end

create!(attributes) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/create

    # File lib/braintree/transaction.rb, line 82
    def self.create!(attributes)
      return_object_or_raise(:transaction) { create(attributes) }
    end

create_from_transparent_redirect(query_string) click to toggle source

Deprecated. Use Braintree::TransparentRedirect.confirm

See www.braintreepayments.com/docs/ruby/transactions/create_tr

    # File lib/braintree/transaction.rb, line 97
    def self.create_from_transparent_redirect(query_string)
      warn "[DEPRECATED] Transaction.create_from_transparent_redirect is deprecated. Please use TransparentRedirect.confirm"
      Configuration.gateway.transaction.create_from_transparent_redirect(query_string)
    end

create_transaction_url() click to toggle source

Deprecated. Use Braintree::TransparentRedirect.url

See www.braintreepayments.com/docs/ruby/transactions/create_tr

    # File lib/braintree/transaction.rb, line 105
    def self.create_transaction_url
      warn "[DEPRECATED] Transaction.create_transaction_url is deprecated. Please use TransparentRedirect.url"
      Configuration.gateway.transaction.create_transaction_url
    end

credit(attributes) click to toggle source

    # File lib/braintree/transaction.rb, line 110
    def self.credit(attributes)
      Configuration.gateway.transaction.credit(attributes)
    end

credit!(attributes) click to toggle source

    # File lib/braintree/transaction.rb, line 114
    def self.credit!(attributes)
      return_object_or_raise(:transaction) { credit(attributes) }
    end

find(id) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/search

    # File lib/braintree/transaction.rb, line 119
    def self.find(id)
      Configuration.gateway.transaction.find(id)
    end

refund(id, amount = nil) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/refund

    # File lib/braintree/transaction.rb, line 124
    def self.refund(id, amount = nil)
      Configuration.gateway.transaction.refund(id, amount)
    end

sale(attributes) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/create

    # File lib/braintree/transaction.rb, line 129
    def self.sale(attributes)
      Configuration.gateway.transaction.sale(attributes)
    end

sale!(attributes) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/create

    # File lib/braintree/transaction.rb, line 134
    def self.sale!(attributes)
      return_object_or_raise(:transaction) { sale(attributes) }
    end

search(&block) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/search

    # File lib/braintree/transaction.rb, line 139
    def self.search(&block)
      Configuration.gateway.transaction.search(&block)
    end

submit_for_settlement(transaction_id, amount = nil) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement

    # File lib/braintree/transaction.rb, line 144
    def self.submit_for_settlement(transaction_id, amount = nil)
      Configuration.gateway.transaction.submit_for_settlement(transaction_id, amount)
    end

submit_for_settlement!(transaction_id, amount = nil) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement

    # File lib/braintree/transaction.rb, line 149
    def self.submit_for_settlement!(transaction_id, amount = nil)
      return_object_or_raise(:transaction) { submit_for_settlement(transaction_id, amount) }
    end

void(transaction_id) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/void

    # File lib/braintree/transaction.rb, line 154
    def self.void(transaction_id)
      Configuration.gateway.transaction.void(transaction_id)
    end

void!(transaction_id) click to toggle source

See www.braintreepayments.com/docs/ruby/transactions/void

    # File lib/braintree/transaction.rb, line 159
    def self.void!(transaction_id)
      return_object_or_raise(:transaction) { void(transaction_id) }
    end

### Public Instance Methods

==(other) click to toggle source

True if `other` is a Braintree::Transaction with the same id.

    # File lib/braintree/transaction.rb, line 181
    def ==(other)
      return false unless other.is_a?(Transaction)
      id == other.id
    end

refund(amount = nil) click to toggle source

Deprecated. Use Braintree::Transaction.refund

See www.braintreepayments.com/docs/ruby/transactions/refund

    # File lib/braintree/transaction.rb, line 202
    def refund(amount = nil)
      warn "[DEPRECATED] refund as an instance method is deprecated. Please use Transaction.refund"
      result = @gateway.transaction.refund(id, amount)

      if result.success?
        SuccessfulResult.new(:new_transaction => result.transaction)
      else
        result
      end
    end

refund_id() click to toggle source

    # File lib/braintree/transaction.rb, line 218
    def refund_id
      warn "[DEPRECATED] Transaction.refund_id is deprecated. Please use TransparentRedirect.refund_ids"
      @refund_id
    end

refunded?() click to toggle source

Returns true if the transaction has been refunded. False otherwise.

    # File lib/braintree/transaction.rb, line 214
    def refunded?
      !@refund_id.nil?
    end

submit_for_settlement(amount = nil) click to toggle source

Deprecated. Use Braintree::Transaction.submit_for_settlement

See www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement

    # File lib/braintree/transaction.rb, line 226
    def submit_for_settlement(amount = nil)
      warn "[DEPRECATED] submit_for_settlement as an instance method is deprecated. Please use Transaction.submit_for_settlement"
      result = @gateway.transaction.submit_for_settlement(id, amount)
      if result.success?
        copy_instance_variables_from_object result.transaction
      end
      result
    end

submit_for_settlement!(amount = nil) click to toggle source

Deprecated. Use Braintree::Transaction.submit_for_settlement!

See www.braintreepayments.com/docs/ruby/transactions/submit_for_settlement

    # File lib/braintree/transaction.rb, line 238
    def submit_for_settlement!(amount = nil)
      warn "[DEPRECATED] submit_for_settlement! as an instance method is deprecated. Please use Transaction.submit_for_settlement!"
      return_object_or_raise(:transaction) { submit_for_settlement(amount) }
    end

vault_billing_address() click to toggle source

If this transaction was stored in the vault, or created from vault records, vault_billing_address will return the associated Braintree::Address. Because the vault billing address can be updated after the transaction was created, the attributes on vault_billing_address may not match the attributes on billing_details.

    # File lib/braintree/transaction.rb, line 247
    def vault_billing_address
      return nil if billing_details.id.nil?
      @gateway.address.find(customer_details.id, billing_details.id)
    end

vault_credit_card() click to toggle source

If this transaction was stored in the vault, or created from vault records, vault_credit_card will return the associated Braintree::CreditCard. Because the vault credit card can be updated after the transaction was created, the attributes on vault_credit_card may not match the attributes on credit_card_details.

    # File lib/braintree/transaction.rb, line 256
    def vault_credit_card
      return nil if credit_card_details.token.nil?
      @gateway.credit_card.find(credit_card_details.token)
    end

vault_customer() click to toggle source

If this transaction was stored in the vault, or created from vault records, vault_customer will return the associated Braintree::Customer. Because the vault customer can be updated after the transaction was created, the attributes on vault_customer may not match the attributes on customer_details.

    # File lib/braintree/transaction.rb, line 265
    def vault_customer
      return nil if customer_details.id.nil?
      @gateway.customer.find(customer_details.id)
    end

vault_shipping_address() click to toggle source

If this transaction was stored in the vault, or created from vault records, vault_shipping_address will return the associated Braintree::Address. Because the vault shipping address can be updated after the transaction was created, the attributes on vault_shipping_address may not match the attributes on shipping_details.

    # File lib/braintree/transaction.rb, line 274
    def vault_shipping_address
      return nil if shipping_details.id.nil?
      @gateway.address.find(customer_details.id, shipping_details.id)
    end

void() click to toggle source

Deprecated. Use Braintree::Transaction.void

See www.braintreepayments.com/docs/ruby/transactions/void

    # File lib/braintree/transaction.rb, line 282
    def void
      warn "[DEPRECATED] void as an instance method is deprecated. Please use Transaction.void"
      result = @gateway.transaction.void(id)
      if result.success?
        copy_instance_variables_from_object result.transaction
      end
      result
    end

void!() click to toggle source

Deprecated. Use Braintree::Transaction.void!

See www.braintreepayments.com/docs/ruby/transactions/void

    # File lib/braintree/transaction.rb, line 294
    def void!
      warn "[DEPRECATED] void! as an instance method is deprecated. Please use Transaction.void!"
      return_object_or_raise(:transaction) { void }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.