Decentro 1.0.3

Decentro 1.0.3

Konfig Publisher维护。



Decentro 1.0.3

  • decentro.tech

Swift5 API客户端用于Decentro

集合

概述

此API客户端由Konfig生成。

安装

CocoaPods

  1. 将以下代码添加到您的 Podfile:
  2. 添加 pod 'Decentro', '~> 1.0.3' 到您的 Podfile

您的 Podfile 应该看起来像这样

# Podfile
source 'https://github.com/CocoaPods/Specs.git'

target 'Example' do
  pod 'Decentro', '~> 1.0.3'
end
  1. 运行 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 处理程序

模型

授权

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,
]