PINXS.Charges.Charge (pinxs v3.2.0) 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
Retrieves a single charge
Retrieves a paginated list of charges
Retrieves a specific pages of charges
Retrieve charges based on search criteria
Voids a pre-authorized charge without claiming funds
Link to this section Types
Specs
t() :: %PINXS.Charges.Charge{
amount: nil | integer(),
amount_refunded: nil | integer(),
authorisation_expired: nil | boolean(),
authorisation_voided: nil | boolean(),
capture: nil | boolean(),
captured: nil | boolean(),
card: nil | PINXS.Cards.Card.t(),
card_token: nil | String.t(),
currency: nil | String.t(),
customer_token: nil | String.t(),
description: nil | String.t(),
email: nil | String.t(),
ip_address: nil | 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
Creates a new charge and returns its details
The Charge struct must have one of the following fields, card, card_token or customer_token
Retrieves a single charge
Retrieves a paginated list of charges
Retrieves a specific pages of charges
Retrieve charges based on search criteria
Search options
%{
query: "",
start_date: "YYYY/MM/DD", # 2013/01/01
end_date: "YYYY/MM/DD", # 2013/12/25
sort: "", # field to sort by, default `created_at`
direction: 1 # 1 or -1
}
Voids a pre-authorized charge without claiming funds