WechatPay.Plug.Refund (WechatPay v0.10.0) View Source

Plug behaviour to handle Refund Notification from Wechat's Payment Gateway.

Official document: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_16&index=9

Example

Define a handler

See WechatPay.Plug.Handler for how to implement a handler.

defmodule MyApp.WechatHandler do
  use WechatPay.Plug.Handler

  @impl WechatPay.Plug.Handler
  def handle_data(conn, _data) do
    :ok
  end
end

Plug in

In your app's lib/my_app_web/router.ex:

post "/wechat_pay/notification/refund", WechatPay.Plug.Refund, [handler: MyApp.WechatHandler, api_key: "my-api-key"]

Link to this section Summary

Link to this section Functions

Specs

call(Plug.Conn.t(), api_key: any(), handler: any()) :: Plug.Conn.t()

Specs

init(keyword()) :: [api_key: any(), handler: any()]