WechatPay v0.8.0 WechatPay.Native View Source
The Native payment method.
Example
Set up a client:
{:ok, client} = WechatPay.Client.new(
app_id: "the-app_id",
mch_id: "the-mch-id",
api_key: "the-api_key",
ssl: [
ca_cert: File.read!("fixture/certs/rootca.pem"),
cert: File.read!("fixture/certs/apiclient_cert.pem"),
key: File.read!("fixture/certs/apiclient_key.pem")
]
)
Place an order:
WechatPay.Native.place_order(client, %{
body: "Plan 1",
out_trade_no: "12345",
fee_type: "CNY",
total_fee: "600",
spbill_create_ip: Void.Utils.get_system_ip(),
notify_url: "http://example.com/",
trade_type: "Native",
product_id: "12345"
})
Link to this section Summary
Functions
Query comments in a batch
Close the order
Download bill
Download fund flow
Place an order
Query the order
Query the refund
Request to refund
Shorten the URL to reduce the QR image size
Link to this section Functions
Link to this function
batch_query_comments(client, attrs, options \\ [])
View Source
batch_query_comments(client, attrs, options \\ [])
View Source
batch_query_comments(WechatPay.Client.t(), map(), keyword()) ::
{:ok, String.t()} | {:error, HTTPoison.Error.t()}
batch_query_comments(WechatPay.Client.t(), map(), keyword()) :: {:ok, String.t()} | {:error, HTTPoison.Error.t()}
Query comments in a batch
Link to this function
close_order(client, attrs, options \\ [])
View Source
close_order(client, attrs, options \\ [])
View Source
close_order(WechatPay.Client.t(), map(), keyword()) ::
{:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
close_order(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Close the order
Link to this function
download_bill(client, attrs, options \\ [])
View Source
download_bill(client, attrs, options \\ [])
View Source
download_bill(WechatPay.Client.t(), map(), keyword()) ::
{:ok, String.t()} | {:error, HTTPoison.Error.t()}
download_bill(WechatPay.Client.t(), map(), keyword()) :: {:ok, String.t()} | {:error, HTTPoison.Error.t()}
Download bill
Link to this function
download_fund_flow(client, attrs, options \\ [])
View Source
download_fund_flow(client, attrs, options \\ [])
View Source
download_fund_flow(WechatPay.Client.t(), map(), keyword()) ::
{:ok, String.t()} | {:error, HTTPoison.Error.t()}
download_fund_flow(WechatPay.Client.t(), map(), keyword()) :: {:ok, String.t()} | {:error, HTTPoison.Error.t()}
Download fund flow
Link to this function
place_order(client, attrs, options \\ [])
View Source
place_order(client, attrs, options \\ [])
View Source
place_order(WechatPay.Client.t(), map(), keyword()) ::
{:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
place_order(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Place an order
Link to this function
query_order(client, attrs, options \\ [])
View Source
query_order(client, attrs, options \\ [])
View Source
query_order(WechatPay.Client.t(), map(), keyword()) ::
{:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
query_order(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Query the order
Link to this function
query_refund(client, attrs, options \\ [])
View Source
query_refund(client, attrs, options \\ [])
View Source
query_refund(WechatPay.Client.t(), map(), keyword()) ::
{:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
query_refund(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Query the refund
Link to this function
refund(client, attrs, options \\ [])
View Source
refund(client, attrs, options \\ [])
View Source
refund(WechatPay.Client.t(), map(), keyword()) ::
{:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
refund(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Request to refund
Link to this function
report(client, attrs, options \\ [])
View Source
report(client, attrs, options \\ [])
View Source
report(WechatPay.Client.t(), map(), keyword()) ::
{:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
report(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Report
Link to this function
shorten_url(client, url, options \\ [])
View Source
shorten_url(client, url, options \\ [])
View Source
shorten_url(WechatPay.Client.t(), String.t(), keyword()) ::
{:ok, String.t()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
shorten_url(WechatPay.Client.t(), String.t(), keyword()) :: {:ok, String.t()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Shorten the URL to reduce the QR image size