StripePost v0.4.2 StripePost.Client View Source

Access service functionality through Elixir functions, wrapping the underlying HTTP API calls.

This is where you will want to write your custom code to access your API.

Link to this section Summary

Functions

Charge an account with the following body configurations

Create a customer with the following body configurations

Retrieve a customer by his/her stripe ID

List all customer, if you don’t provide a limit we will fetch them all

Link to this section Functions

Link to this function charge(body, configs \\ nil) View Source

Charge an account with the following body configurations

StripePost.charge(
  %{amount: 10000,
    currency: "cad",
    description: "3 wozzle",
    source: "pk_abc_123"}
)

Where the source is the payment token received from Stripe most likely in your client javascriopt.

You also now also authorize (without charging) an account by setting the capture field to false. For more details auth and capture

StripePost.charge(
  %{amount: 10000,
    currency: "cad",
    description: "3 wozzle",
    source: "pk_abc_123"
    capture: false}
)

The configurations are optional, and can be (preferrably) configured as elixir configs, like:

config :stripe_post,
  secret_key: "sk_test_abc123",
  public_key: "pk_test_def456",
  content_type: "application/x-www-form-urlencoded"

But, if you must, then you can specify it directly like

configs = %{
  secret_key: "sk_test_abc123",
  content_type: "application/x-www-form-urlencoded"
}
Link to this function create_customer(body, configs \\ nil) View Source

Create a customer with the following body configurations

body = %{description: "customer xxx", source: "pk_abc_123"}
Link to this function get_customer(id, configs \\ nil) View Source

Retrieve a customer by his/her stripe ID

Link to this function list_customers(query_params \\ %{}, configs \\ nil) View Source

List all customer, if you don’t provide a limit we will fetch them all

query_params = %{limit: 100, starting_after: "obj_pk_1234"}