A library that helps you easily interact with the ProxyPay API using the elixir programming language.
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
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"}
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"})
Returns Payment events stored on the server that were not yet Acknowledged
ExProxyPay.get_payments(n, config)
This function generates a unique Reference Id to be associated with a given payment reference
{state, id} = ExProxyPay.generate_reference_id(config)
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)
This endpoint deletes a reference with given Id
ExProxyPay.delete_reference(id, config)
This method is used to acknowledge that a payment was processed
ExProxyPay.acknowledge_payment(id, config)
The library is available as open source under the terms of the MIT License.