WechatPay v0.9.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
Specs
batch_query_comments(WechatPay.Client.t(), map(), keyword()) :: {:ok, String.t()} | {:error, HTTPoison.Error.t()}
Query comments in a batch
Specs
close_order(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Close the order
Specs
download_bill(WechatPay.Client.t(), map(), keyword()) :: {:ok, String.t()} | {:error, HTTPoison.Error.t()}
Download bill
Specs
download_fund_flow(WechatPay.Client.t(), map(), keyword()) :: {:ok, String.t()} | {:error, HTTPoison.Error.t()}
Download fund flow
Specs
place_order(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Place an order
Specs
query_order(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Query the order
Specs
query_refund(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Query the refund
Specs
refund(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Request to refund
Specs
report(WechatPay.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}
Report
Specs
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