ex_proxypay

A library that helps you easily interact with the ProxyPay API using the elixir programming language


License
MIT

Documentation

ExProxypay

A library that helps you easily interact with the ProxyPay API using the elixir programming language.

Installation

If available in Hex, the package can be installed by adding ex_proxypay to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_proxypay, "~> 0.1.0"}
  ]
end

Create a payment request with ProxyPay

Full code to create a payment request using ProxyPay.

  config = %Config{api_key: "YOUR_API_KEY", environment: "SANDBOX"}
  {state, id} = ExProxyPay.generate_reference_id(config)
  ExProxyPay.create_reference(id, %PaymentReference{amount: 100, end_datetime: "2020/03/14", custom_fields: nil}, config)

output:

  {:ok, "Reference was created or updated successfully"}

Configure ProxyPay api key and environment:

To interact with ProxyPay you will need to define the environment to interact with and the api key for authentication.

You have at your disposal two environments: "SANDBOX" and "PRODUCTION".

  config = Config.init(%{api_key: "YOUR_API_KEY", environment: "SANDBOX"})

Get Payments

Returns Payment events stored on the server that were not yet Acknowledged

  ExProxyPay.get_payments(n, config)

Create reference id

This function generates a unique Reference Id to be associated with a given payment reference

  {state, id} = ExProxyPay.generate_reference_id(config)

Create Reference using reference id

The generateReference method creates or updates a payment reference with given Id

  reference = %PaymentReference{amount: 100, end_datetime: "2020/03/14", custom_fields: nil}
  ExProxyPay.create_reference(id, reference, config)

Delete Reference

This endpoint deletes a reference with given Id

  ExProxyPay.delete_reference(id, config)

Acknowledge a payment

This method is used to acknowledge that a payment was processed

  ExProxyPay.acknowledge_payment(id, config)

License

The library is available as open source under the terms of the MIT License.