WechatPay.Client (WechatPay v0.10.0) View Source

API client.

Link to this section Summary

Functions

Build a new client from options.

Link to this section Types

Specs

t() :: %WechatPay.Client{
  api_host: String.t(),
  api_key: String.t(),
  app_id: String.t(),
  mch_id: String.t(),
  sign_type: :md5 | :sha256,
  ssl: [ca_cert: String.t() | nil, cert: String.t(), key: String.t()]
}

Link to this section Functions

Specs

new(Enum.t()) :: {:ok, t()} | {:error, binary()}

Build a new client from options.

Example

iex>WechatPay.Client.new(app_id: "APP_ID", mch_id: "MCH_ID", api_key: "API_KEY", sign_type: :sha256)
{:ok,
%WechatPay.Client{
  api_host: "https://api.mch.weixin.qq.com/",
  api_key: "API_KEY",
  app_id: "APP_ID",
  mch_id: "MCH_ID",
  sign_type: :sha256,
  ssl: nil
}}