Swift5 API客户端用于Decentro
集合
概述
此API客户端由Konfig生成。
- API版本:1.0.0
- 包版本:1.0.3 更多信息,请访问 https://decentro.tech
安装
CocoaPods
- 将以下代码添加到您的
Podfile
: - 添加
pod 'Decentro', '~> 1.0.3'
到您的Podfile
您的 Podfile
应该看起来像这样
# Podfile
source 'https://github.com/CocoaPods/Specs.git'
target 'Example' do
pod 'Decentro', '~> 1.0.3'
end
- 运行
pod install
❯ pod install
Analyzing dependencies
Downloading dependencies
Installing Decentro 1.0.3
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
入门指南
import Decentro
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]!
DecentroAPI.customHeaders = [
"client_id": apiKey,
]
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]!
DecentroAPI.customHeaders = [
"client_secret": apiKey,
]
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]!
DecentroAPI.customHeaders = [
"module_secret": apiKey,
]
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]!
DecentroAPI.customHeaders = [
"provider_secret": apiKey,
]
let generatePaymentLinkRequest = GeneratePaymentLinkRequest(referenceId: "referenceId_example", payeeAccount: "payeeAccount_example", amount: 123, purposeMessage: "purposeMessage_example", generateQr: 123, expiryTime: 123, customizedQrWithLogo: 123, generateUri: 123) // GeneratePaymentLinkRequest |
// Generate payment link
CollectionsAPI.generatePaymentLink(generatePaymentLinkRequest: generatePaymentLinkRequest) { (response, error) in
guard error == nil else {
print(error!)
return
}
if response != nil {
dump(response)
}
}
API 端点
所有 URI 都相对于 https://in.staging.decentro.tech
类 | 方法 | HTTP 请求 | 描述 |
---|---|---|---|
CollectionsAPI | generatePaymentLink | POST /v2/payments/upi/link | 生成支付链接 |
CollectionsAPI | getTransactionStatus | GET /v2/payments/transaction/{transaction_id}/status | 获取交易状态 |
CollectionsAPI | issueCollectRequest | POST /v2/payments/collection | 发起收集请求 |
CollectionsAPI | issueUpiRefund | POST /v2/payments/upi/refund | 发起 UPI 退款 |
CollectionsAPI | validateUpiHandle | POST /v2/payments/vpa/validate | 验证 UPI 处理程序 |
模型
- GeneratePaymentLink400Response
- GeneratePaymentLinkRequest
- GeneratePaymentLinkResponse
- GeneratePaymentLinkResponseData
- GeneratePaymentLinkResponseDataPspUri
- GetTransactionStatusResponse
- GetTransactionStatusResponseData
- GetTransactionStatusResponseError
- IssueCollectRequest400Response
- IssueCollectRequestRequest
- IssueCollectRequestResponse
- IssueCollectRequestResponseData
- 发行UPi退款400响应
- 发行UPi退款请求
- 发行UPi退款响应
- 发行UPi退款响应数据
- 验证UPi处理400响应
- 验证UPi处理请求
- 验证UPi处理响应
- 验证UPi处理响应数据
授权
client_id
- 类型: API密钥
- API密钥参数名: client_id
- 位置: HTTP头
import Decentro
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]!
DecentroAPI.customHeaders = [
"client_id": apiKey,
]
client_secret
- 类型: API密钥
- API密钥参数名: client_secret
- 位置: HTTP头
import Decentro
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]!
DecentroAPI.customHeaders = [
"client_secret": apiKey,
]
module_secret
- 类型: API密钥
- API密钥参数名: module_secret
- 位置: HTTP头
import Decentro
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]!
DecentroAPI.customHeaders = [
"module_secret": apiKey,
]
provider_secret
- 类型: API密钥
- API密钥参数名: provider_secret
- 位置: HTTP头
import Decentro
let apiKey = ProcessInfo.processInfo.environment["API_KEY"]!
DecentroAPI.customHeaders = [
"provider_secret": apiKey,
]