Skip to content

enginix/pingpp-lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pingpp-lua

pingpp-lua is a lua-payments extension that lets you pay with ping++.

The following APIs are supported:

Examples

Create the API client:

local pingpp = require("payments.pingpp")

local client = pingpp.Pingpp({
    app_id = "your-app-id",
    app_key = "sk_xxxxxxxx"
})

Charges

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.

Signature

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))

License

MIT, Copyright (C) 2017 by enginix.

About

Payments support for pingpp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages