WechatPay v0.9.0 WechatPay.App View Source

The App payment method.

Official document

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.App.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: "APP",
  product_id: "12345"
})

Link to this section Summary

Link to this section Functions

Link to this function

batch_query_comments(client, attrs, options \\ [])

View Source

Specs

batch_query_comments(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, String.t()} | {:error, HTTPoison.Error.t()}

Query comments in a batch

Official document

Link to this function

close_order(client, attrs, options \\ [])

View Source

Specs

close_order(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}

Close the order

Official document

Link to this function

download_bill(client, attrs, options \\ [])

View Source

Specs

download_bill(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, String.t()} | {:error, HTTPoison.Error.t()}

Download bill

Official document

Link to this function

download_fund_flow(client, attrs, options \\ [])

View Source

Specs

download_fund_flow(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, String.t()} | {:error, HTTPoison.Error.t()}

Download fund flow

Official document

Link to this function

generate_pay_request(client, prepay_id)

View Source

Specs

generate_pay_request(WechatPay.Client.t(), String.t()) :: map()

Generate pay request info, which is required for the App SDK

Official document

Link to this function

place_order(client, attrs, options \\ [])

View Source

Specs

place_order(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}

Place an order

Official document

Link to this function

query_order(client, attrs, options \\ [])

View Source

Specs

query_order(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}

Query the order

Official document

Link to this function

query_refund(client, attrs, options \\ [])

View Source

Specs

query_refund(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}

Query the refund

Official document

Link to this function

refund(client, attrs, options \\ [])

View Source

Specs

refund(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}

Request to refund

Official document

Link to this function

report(client, attrs, options \\ [])

View Source

Specs

report(WechatPay.Client.t(), map(), keyword()) ::
  {:ok, map()} | {:error, WechatPay.Error.t() | HTTPoison.Error.t()}

Report

Official document