zlp-demo-golang

command module
v0.0.0-...-0b880a3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2019 License: MIT Imports: 13 Imported by: 0

README

Demo tích hợp ZaloPay cho Golang

Demo tích hợp các API của ZaloPay cho golang

Cài đặt

  1. front-end
  2. ngrok
  3. go
  4. mysql
  5. Clone project này về và cài đặt các dependencies
git clone https://github.com/tiendung1510/zlp-demo-golang

cd zlp-demo-golang

go get
  1. Tạo một database mới (utf8_unicode_ci) trong mysql và thay đổi connection string trong config.json
{
  "db": {
    "connstring": "<username>:<password>@tcp(localhost:3306)/<dbname>?parseTime=true"
  }
}

Chạy Project

  1. Chạy phần front-end
  2. Tạo ngrok public url cho localhost:1789
ngrok http 1789 # tạo ngrok public url
  1. Chạy project
go run main.go # port 1789

Thay đổi App Config

Khi muốn thay đổi app config (appid, key1, key2, publickey, privatekey), để nhận được callback ở localhost thì Merchant Server cần xử lý forward callback như sau:

  1. Khi nhận được callback từ ZaloPay Server, lấy ngrok public url trong embeddata.forward_callback của callback data:
{
  "embeddata": {
    "forward_callback": "<ngrok public url khi chạy lệnh `ngrok http 1789`>"
  }
}
  1. Post callback data (application/json) cho ngrok public url vừa lấy

Các API tích hợp trong demo

  • Xử lý callback
  • Thanh toán QR
  • Cổng ZaloPay
  • QuickPay
  • Mobile Web to App
  • Hoàn tiền
  • Lấy trạng thái hoàn tiền

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL