ExPIX.generate_static_code

You're seeing just the function generate_static_code, go back to ExPIX module for more information.
Link to this function

generate_static_code(key, static_params, account_params \\ %{}, additional_params \\ %{})

View Source

Specs

generate_static_code(
  String.t(),
  static_params(),
  account_params(),
  additional_params()
) :: {:ok, String.t()} | {:error, any()}

Generates a static raw code. This function uses the default parameters defined in the static_code configuration, but if you need a special parameter, this function can receive such parameters as well.

  • key - The 'key' to be charged. It can be a CNPJ, CPF, phone number or a random binary string. It is not necessary to send the key type, but this function expects that the key is already in the format for your type (see the PIX docs for some examples).
  • static_params - Basic information to build a static code.
  • account_params - Optional parameters to build the notes of the operation.
  • additional_params - Additional parameters to build the code.

Example:

  iex> ExPIX.generate_static_code("email@email.com", %{merchant_name: "Leonardo Leite", merchant_city: "Florianopolis"})
  {:ok, "00020101021126370014br.gov.bcb.pix0115email@email.com52040000530398654040.005802BR5914Leonardo Leite6013Florianopolis62070503***6304891C"}