pinxs v0.1.2 PINXS.Charges.Charge View Source

The Charge module provides functions for working wtih charges.

Required Fields

When creating a charge, the following fields are required.

  • email
  • description
  • amount
  • ip_address

and one of

  • card
  • card_token
  • customer_token

Error handling

All requests return tagged tuples in the form {:ok, result} or {:error, %PINXS.Error{}}

Link to this section Summary

Functions

Captures a previously authorized charge

Creates a new charge and returns its details

Retreives a single charge

Retreives a paginated list of charges

Retreives a specific pages of charges

Link to this section Types

Link to this type t() View Source
t() :: %PINXS.Charges.Charge{
  amount: nil | integer(),
  amount_refunded: nil | integer(),
  authorisation_expired: nil | boolean(),
  capture: nil | boolean(),
  captured: nil | boolean(),
  card: nil | PINXS.Cards.Card.t(),
  card_token: nil | String.t(),
  currency: String.t(),
  customer_token: nil | String.t(),
  description: String.t(),
  email: String.t(),
  ip_address: String.t(),
  merchant_entitlement: nil | integer(),
  metadata: nil | map(),
  refund_pending: nil | boolean(),
  settlement_currency: nil | String.t(),
  token: nil | String.t(),
  total_fees: nil | integer(),
  transfer: nil | list()
}

Link to this section Functions

Link to this function capture(charge, amount \\ %{}) View Source

Captures a previously authorized charge

Creates a new charge and returns its details

The Charge struct must have one of the following fields, card, card_token or customer_token

Retreives a single charge

Link to this function get_all() View Source
get_all() :: {:ok, [PINXS.Charges.Charge.t()]} | {:error, PINXS.Error.t()}

Retreives a paginated list of charges

Link to this function get_all(page) View Source
get_all(integer()) ::
  {:ok, [PINXS.Charges.Charge.t()]} | {:error, PINXS.Error.t()}

Retreives a specific pages of charges