WechatPay v0.8.0 WechatPay.API View Source
The Core API module
Link to this section Summary
Functions
Query comments in a batch
Request to close the order
Download the bill
Download the fund flow
Place an unified order
Query an order
Query the refund status
Request to Refund an order
Call the payitil/report API
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
⚠️ This requires the ssl config is set
Examples
iex> WechatPay.API.batch_query_comments(%{
begin_time: "20190222000000",
end_time: "20190224000000",
offset: 0
})
...> {:ok, data}
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()}
Request to close the order
Examples
iex> WechatPay.API.close_order(%{out_trade_no: "1415757673"})
...> {:ok, data}
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 the bill
Examples
iex> WechatPay.API.download_bill(%{
device_info: "013467007045764",
bill_date: "20140603",
bill_type: "ALL"
})
...> {:ok, data}
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 the fund flow
⚠️ This requires the ssl config is set
Examples
iex> WechatPay.API.download_fund_flow(%{
account_type: "Basic",
bill_date: "20140603"
})
...> {:ok, data}
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 unified order
Examples
iex> WechatPay.API.place_order(%{
device_info: "WEB",
body: "Wechat-666",
attach: nil,
out_trade_no: "1415757673",
fee_type: "CNY",
total_fee: 709,
spbill_create_ip: "127.0.0.1",
notify_url: "http://example.com/wechat-pay-callback",
time_start: 20091225091010,
time_expire: 20091227091010,
trade_type: "JSAPI",
openid: "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
})
...> {:ok, data}
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 an order
Examples
iex> WechatPay.API.query_order(%{out_trade_no: "1415757673"})
...> {:ok, data}
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 status
Examples
iex> WechatPay.API.query_refund(%{
device_info: "WEB",
out_trade_no: "1415757673"
})
...> {:ok, data}
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 an order
⚠️ This requires the ssl config is set
Examples
iex> attrs = %{
device_info: "013467007045764",
transaction_id: "1217752501201407033233368018",
out_trade_no: "1217752501201407033233368018",
out_refund_no: "1217752501201407033233368018",
total_fee: 100,
refund_fee: 100,
refund_fee_type: "CNY",
op_user_id: "1900000109",
refund_account: "REFUND_SOURCE_RECHARGE_FUNDS"
}
...> WechatPay.API.refund(attrs, opts)
...> {:ok, data}
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()}
Call the payitil/report API
Examples
iex> params = %{
device_info: "013467007045764",
interface_url: "https://api.mch.weixin.qq.com/pay/unifiedorder",
execute_time_: 1000,
return_code: "SUCCESS",
return_msg: "签名失败",
result_code: "SUCCESS",
err_code: "SYSTEMERROR",
err_code_des: "系统错误",
out_trade_no: "1217752501201407033233368018",
user_ip: "8.8.8.8",
time: "20091227091010"
}
...> WechatPay.API.report(params)
...> {:ok, data}