PaySky Button SDK
此 SDK 的目的是帮助程序员使用 IOS 的 PaySky 支付 SDK。
开始使用
以下指导将帮助您在本地机器上创建项目的副本并在开发和分析目的下运行它。
先决条件
您需要安装哪些软件以及如何安装它们
1-COCOPODS installed on your machine .
2-Xcode
3-Create new IOS project in xcode to use SDK or if you have created a project before with swit
安装
一步步教您如何在项目中获取我们的 SDK。
1- open your xcode project.
2- in your project in Podfile in project level add :-
pod 'PaySkyPayButton'
4- Sync your project.(pod install)
### Using SDK
为了使用我们的 SDK,您应该从我们公司获取商户 ID 和终端 ID。
1-导入 PayButton:2 – 从 PayButton 创建一个新实例:
let paymentViewController = PaymentViewController ()
您需要向 PayButton 类实例传递一些参数:1-商户 ID。2-终端 ID。3-支付金额。4-货币代码 [可选]。5-商户安全散列。6-交易参考编号。
请注意:如果您需要保存,请将安全哈希、商户ID和终端ID加密后再存储。
示例:
paymentViewController.amount = "amount" // Amount
paymentViewController.delegate = self // PaymentDelegate
paymentViewController.mId = "merchantId" // Merchant id
paymentViewController.tId = "terminalId" // Terminal id
paymentViewController.Currency = "currencyCode" // Currency Code [Optional]
paymentViewController.refnumber = "reference number"" // unique transaction reference number.
paymentViewController.Key = "Merchant secure hash"
paymentViewController.pushViewController()
2 - 创建交易回调的委托支付(PaymentDelegate):
implete deleget on your ViewController
class ViewController: UIViewController, PaymentDelegate {
func finishSdkPayment(_ receipt: TransactionStatusResponse) {
}
}
要在我们的SDK中创建交易,您只需调用createTransaction方法,并传入PaymentTransactionCallback监听器以在交易完成后回调。这个监听器有两种方法:
1 - finishSdkPayment方法,该方法在交易成功并通过卡片支付使用SuccessfulCardTransaction对象时被调用。创建交易监听器中的SuccessfulCardTransaction对象包含:NetworkReference变量,它是交易的参考编号。AuthCode变量、ActionCode变量和ReceiptNumber变量、amount变量。
2 - finishSdkPayment方法,该方法在客户使用SuccessfulWalletTransaction对象进行钱包交易时被调用。创建交易监听器中的SuccessfulWalletTransaction对象包含:NetworkReference变量,它是指交易的参考编号和amount变量。
示例:
func finishSdkPayment(_ receipt: TransactionStatusResponse) {
if receipt.Success // will be true if transaction success
{
print(receipt.NetworkReference)
}else{
print(receipt.Message) // resonse of error
}
}
## Deployment
1-Before deploy your project live ,you should get a merchant id and terminal id from our company .
2-you should keep your merchant id and terminal id secured
in your project, encrypt them before save them in project.
## Built With
* [Alamofire](https://github.com/Alamofire/Alamofire)
* [EVReflection](https://github.com/evermeer/EVReflection)
## Authors
**PaySky Company** - (https://www.paysky.io)
## Sample Project
**https://github.com/payskyCompany/payButtonIOS.git**