Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
PingPlusPlus
/
pingpp-ruby
Public
Notifications
You must be signed in to change notification settings
Fork
21
Star
80
Code
Issues
1
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Files
Expand file tree
master
Breadcrumbs
pingpp-ruby
/
example
/
agreement_create.rb
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
42 lines (35 loc) · 1.96 KB
master
Breadcrumbs
pingpp-ruby
/
example
/
agreement_create.rb
Copy path
Top
File metadata and controls
Code
Blame
42 lines (35 loc) · 1.96 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
=begin
Ping++ Server SDK 说明:
以下代码只是为了方便商户测试而提供的样例代码,商户可根据自己网站需求按照技术文档编写, 并非一定要使用该代码。
接入支付流程参考开发者中心:https://www.pingxx.com/docs/server/charge ,文档可筛选后端语言和接入渠道。
该代码仅供学习和研究 Ping++ SDK 使用,仅供参考。
=end
require "pingpp"
require_relative "./agreement_extra"
# api_key 获取方式:登录 [Dashboard](https://dashboard.pingxx.com) -> 点击管理平台右上角公司名称 -> 企业设置 -> Secret Key
API_KEY = "sk_test_ibbTe5jLGCi5rzfH4OqPW9KC"
# app_id 获取方式:登录 [Dashboard](https://dashboard.pingxx.com) -> 应用卡片下方
APP_ID = "app_1Gqj58ynP0mHeX1q"
# 设置 API key
Pingpp.api_key = API_KEY
=begin
设置请求签名密钥,密钥对需要你自己用 openssl 工具生成,如何生成可以参考帮助中心:https://help.pingxx.com/article/123161;
生成密钥后,需要在代码中设置请求签名的私钥(rsa_private_key.pem);
然后登录 [Dashboard](https://dashboard.pingxx.com)->点击右上角公司名称->开发信息->商户公钥(用于商户身份验证)
将你的公钥复制粘贴进去并且保存->先启用 Test 模式进行测试->测试通过后启用 Live 模式
=end
# 设置你的私钥路径,用于请求的签名
Pingpp.private_key_path = "#{File.dirname(__FILE__)}/your_rsa_private_key.pem"
# 或者直接设置私钥字符串
# Pingpp.private_key = 'PEM 格式的私钥字符串'
channel = "qpay" # 支付使用的第三方支付渠道取值
# 签约协议号
contract_no = Time.now.to_i.to_s[0,12]
agr = Pingpp::Agreement.create(
:contract_no => contract_no, # 签约协议号
:app => APP_ID,
:channel => channel, # 签约渠道
:metadata => {}, # metadata 元数据
:extra => AgreementExtra.send(channel) # 对应各渠道的取值规则请查看 agreement_extra 相应方法内说明
)
puts agr
You can’t perform that action at this time.