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.
- 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
Captures a previously authorized charge
Link to this function
create(charge_map)
View Source
create(PINXS.Charges.Charge.t()) :: {:ok, PINXS.Charges.Charge.t()} | {:error, PINXS.Error.t()}
Creates a new charge and returns its details
The Charge
struct must have one of the following fields, card
, card_token
or customer_token
Link to this function
get(token)
View Source
get(String.t()) :: {:ok, PINXS.Charges.Charge.t()} | {:error, PINXS.Error.t()}
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