View Source Alipay (alipay v0.2.1)

Alipay SDK for Elixir

定义 Client 模块

小程序

defmodule YourApp.AppCodeName do
  @moduledoc "CodeName"
  use Alipay,
    app_id: "app_id",
    private_key: {:file, "private_key.pem"},
    callback_public_key: {:file, "alipay_public_key.pem"}
end

参数说明

请看 options/0

接口调用

Alipay.Trade.pay(YourApp.AppCodeName, body)

Summary

Types

@type app_id() :: String.t()
@type body() :: Enumerable.t()
@type client() :: module()
@type options() :: [
  app_id: app_id(),
  private_key: pem_file(),
  callback_public_key: pem_file(),
  requester: module(),
  sandbox?: sandbox?()
]
@type pem_file() ::
  {:binary, binary()}
  | {:file, Path.t()}
  | {:app_dir, Application.app(), Path.t()}
@type queries() :: Keyword.t()
@type response() :: Tesla.Env.result()
@type sandbox?() :: boolean()

是否是沙盒应用

Functions

Link to this function

build_client(client, options)

View Source
@spec build_client(client(), options()) :: {:ok, client()}

动态构建 client