Braintree v0.4.0 Braintree.Transaction

Create a new sale.

To create a transaction, you must include an amount and either a payment_method_nonce or a payment_method_token.

Summary

Functions

Find an existing transaction by transaction_id

Use a transaction_id and optional amount to issue a refund for that transaction

Use a payment_method_nonce or payment_method_token to make a one time charge against a payment method

Use a transaction_id to issue a void for that transaction

Functions

find(transaction_id)

Specs

find(String.t) ::
  {:ok, any} |
  {:error, Braintree.ErrorResponse.t}

Find an existing transaction by transaction_id

Example

{:ok, transaction} = Transaction.find("123")
refund(transaction_id, params)

Specs

refund(String.t, Map.t) ::
  {:ok, any} |
  {:error, Braintree.ErrorResponse.t}

Use a transaction_id and optional amount to issue a refund for that transaction

Example

{:ok, transaction} = Transaction.refund("123", %{amount: "100.00"})

transaction.status # "refunded"
sale(params)

Specs

sale(Map.t) ::
  {:ok, any} |
  {:error, Braintree.ErrorResponse.t}

Use a payment_method_nonce or payment_method_token to make a one time charge against a payment method.

Example

{:ok, transaction} = Transaction.sale(%{
  amount: "100.00",
  payment_method_nonce: @payment_method_nonce,
  options: %{submit_for_settlement: true}
})

transaction.status # "settling"
void(transaction_id)

Specs

void(String.t) ::
  {:ok, any} |
  {:error, Braintree.ErrorResponse.t}

Use a transaction_id to issue a void for that transaction

Example

{:ok, transaction} = Transaction.void("123")

transaction.status # "voided"