Giter VIP home page Giter VIP logo

alipay's Introduction

alipay

支付宝即时到帐,支付宝移动支付 Golang实现

快速开始

获取安装

go get -u github.com/shima-park/alipay

推荐使用localtunnel测试回调通知

可以先安装一个localtunnel 可以方便快捷的实现你的本地web服务通过外网访问,无需修改DNS和防火墙设置

$ npm install -g localtunnel

示例

通过localtunnel获取外网地址:

$ lt --port 9090
your url is: http://eygytquvvu.localtunnel.me

修改示例代码中的配置:

记得修改示例中的对应的partner, key, email配置, 如果需要使用app支付记得添加public key path和private key path

var (
	partner = "your pid"
	key     = "your key"
	email   = "your email"

	publicKeyPath  = "your rsa pubKey path" // "xxx/rsa_public_key.pem"
	privateKeyPath = "your rsa priKey path" // "xxx/rsa_private_key.pem"

	a = alipay.NewPayment(partner, key, email)
	// app 支付需要加入rsa公钥密钥
	// a.InitRSA(publicKeyPath, privateKeyPath)

    // 示例监听的端口
	port = ":9090"

    // 通过 lt --port 9090 获取的外网地址
    localTunnel = "http://eygytquvvu.localtunnel.me"
    ...
)

启动示例程序:

$ go run example/main.go

在浏览器中访问本地服务:

http://localhost:9090/index

具体如何使用请查看example/main.go

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.