pingpp-lua is a lua-payments extension that lets you pay with ping++.
The following APIs are supported:
Create the API client:
local pingpp = require("payments.pingpp")
local client = pingpp.Pingpp({
app_id = "your-app-id",
app_key = "sk_xxxxxxxx"
})Create a new charge:
local pingxx_charge = assert(client:create_charge({
order_no = "123456789",
amount = 100,
subject = "Some thing",
body = "Buy sth.",
channel = "wx",
client_ip = "127.0.0.1"
}))
-- send pingxx_charge to client.Query charge:
local pingxx_charge = assert(client:get_charge({
id = "ch_xxxxxxxx",
}))
-- check charge state etc.Verify signature of webhooks request:
local pingpp = require("payments.pingpp")
local verifier = pingpp.PingppSign('Your-pingpp-public-key')
-- parse request to table, get signature from http header['x-pingplusplus-signature']
assert(verifier(request, signature))MIT, Copyright (C) 2017 by enginix.