/chargify_direct_examples

Chargify Direct Examples in Elixir using the Phoenix Framework

Primary LanguageElixir

ChargifyDirectExamples

Chargify Direct in Elixir and Phoenix

To start the Phoenix project:

  1. Set environment variables for CHARGIFY_DIRECT_API_ID, CHARGIFY_DIRCT_API_SECRET and CHARGIFY_DIRECT_PASSWORD

  2. Install dependencies with mix deps.get and cd assets && npm install

Note that both the Phoenix Framework and the Chargify V2 dependencies are pointed at the master branch of their respective git repos. This means things may break! If so, try editing mix.exs to point at the latest release or an earlier commit.

  1. Start the Phoenix 1.3 endpoint with mix phx.server

Now you can visit localhost:4000 from your browser to create a subscription.

Or visit http://localhost:4000/update?sub=12345 with an existing subscription id to update the payment profile information.

See the 'util' directory for a Ruby script to generate the Braintree client token until there is an Elixir library to do it on the server side.

The get-call.sh script can be used to retrieve information about the results of an api call. Set the CALL_ID environment variable before executing it.

References