View Source Circlex.Api.Payments.Payments (Circlex v0.1.7)

API Client to the Payments Payments API.

Reference: https://developers.circle.com/reference/payments-payments-get

Link to this section Summary

Functions

Get a list of payments.

In the sandbox environment, initiate a mock wire payment that mimics the behavior of funds sent through the bank (wire) account linked to master wallet.

Link to this section Functions

Link to this function

get_payment(id, opts \\ [])

View Source

Get a payment.

Reference: https://developers.circle.com/reference/payments-payments-get-id

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Payments.Payments.get_payment("24c26e1b-8666-46fa-96ea-892afcadb9bb", host: host)
{
  :ok,
  %Circlex.Struct.Payment{
    amount: %Circlex.Struct.Amount{amount: "3.14", currency: "USD"},
    create_date: "2022-07-15T21:10:03.635Z",
    description: "Merchant Push Payment",
    fees: %Circlex.Struct.Amount{amount: "2.00", currency: "USD"},
    id: "24c26e1b-8666-46fa-96ea-892afcadb9bb",
    merchant_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
    merchant_wallet_id: "1000216185",
    refunds: [],
    source: %Circlex.Struct.SourceDest{
      address: nil,
      address_id: nil,
      address_tag: nil,
      chain: nil,
      id: "ad823515-3b51-4061-a016-d626e3cd105e",
      type: :wire
    },
    status: "paid",
    type: "payment",
    update_date: "2022-07-15T21:11:03.863523Z"
  }
}
Link to this function

list_payments(opts \\ [])

View Source

Get a list of payments.

Reference: https://developers.circle.com/reference/payments-payments-get

TODO: Filters

examples

Examples

iex> host = Circlex.Test.start_server()
iex> Circlex.Api.Payments.Payments.list_payments(host: host)
{
  :ok,
  [
    %Circlex.Struct.Payment{
      amount: %Circlex.Struct.Amount{amount: "3.14", currency: "USD"},
      create_date: "2022-07-15T21:10:03.635Z",
      description: "Merchant Push Payment",
      fees: %Circlex.Struct.Amount{amount: "2.00", currency: "USD"},
      id: "24c26e1b-8666-46fa-96ea-892afcadb9bb",
      merchant_id: "5dfa1127-050b-4ba6-b9b5-b2015aa4c882",
      merchant_wallet_id: "1000216185",
      refunds: [],
      source: %Circlex.Struct.SourceDest{
        address: nil,
        address_id: nil,
        address_tag: nil,
        chain: nil,
        id: "ad823515-3b51-4061-a016-d626e3cd105e",
        type: :wire
      },
      status: "paid",
      type: "payment",
      update_date: "2022-07-15T21:11:03.863523Z"
    }
  ]
}
Link to this function

mock_wire(tracking_ref, amount, opts \\ [])

View Source

In the sandbox environment, initiate a mock wire payment that mimics the behavior of funds sent through the bank (wire) account linked to master wallet.

Reference: https://developers.circle.com/reference/payments-payments-mock-create

examples

Examples

iex> host = Circlex.Test.start_server()
iex> amount = %{amount: "12345.00", currency: "USD"}
iex> Circlex.Api.Payments.Payments.mock_wire("CIR3KX3L99", amount, host: host)
{:ok,
 %{
   "amount" => %{"amount" => "12345.00", "currency" => "USD"},
   "status" => "pending",
   "trackingRef" => "CIR3KX3L99"
 }}