Latest 1.0.2
Homepage https://github.com/mrLIHUAN/DZPaySDK
License MIT
Platforms ios 8.0, requires ARC
Authors

支付中心

版本要求

iOS SDK 要求 iOS 8.0 及l以上版本

接入方法

安装

使用 CocoaPods

  1. 在 ‘podfile’添加

       pod 'DZPaySDK', '~> 1.0.1'

      默认会包含支付宝、微信、银联

  2. 运行 pod install
  3. 从现在开始使用 .xcworkspace 打开项目,而不是 .xcodeproj
  4. 添加 URL Schemes:在 Xcode 中,选择你的工程设置项,选中 "TARGETS" 一栏,在 "Info" 标签栏的 "URL Types" 添加 "URL Schemes",如果使用微信,填入所注册的微信应用程序 id,如果不使用微信,则自定义,允许英文字母和数字,首字母必须是英文字母,建议起名稍复杂一些,尽量避免与其他程序冲突。
  5. 在桥接文件中引入头文件
       #import "DZPaySDK/PayViewController.h"

额外配置

  1. iOS 9 以上版本如果需要使用支付宝和微信渠道,需要在 Info.plist 添加以下代码

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>weixin</string>
        <string>wechat</string>
        <string>alipay</string>
        <string>alipays</string>
        <string>mqq</string>
    </array>
  2. iOS 9 限制了 http 协议的访问,如果 App 需要访问 http://,需要在 Info.plist 添加如下代码

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
  3. 在AppDelegate中写回调方法

    func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
        let annotation = options["UIApplicationOpenURLOptionsSourceApplicationKey"] as! NSString
        if(annotation .isEqualToString("com.tencent.xin")){
            return WXApi.handleOpenURL(url, delegate: TeldPayManager.sharedManager())
        }else if(annotation .isEqualToString("com.alipay.iphoneclient")){
            AlipaySDK .defaultService().processAuthResult(url, standbyCallback: { (dic) -> Void in
            })
        }
        return true;
    }

Latest podspec

{
    "name": "DZPaySDK",
    "version": "1.0.2",
    "summary": "u652fu4ed8u4e2du5fc3",
    "homepage": "https://github.com/mrLIHUAN/DZPaySDK",
    "license": "MIT",
    "authors": {
        "mrLIHUAN": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mrLIHUAN/DZPaySDK.git",
        "tag": "1.0.2"
    },
    "requires_arc": true,
    "default_subspecs": [
        "AliPay15.1.6",
        "SDK1.6.2",
        "pic",
        "Code"
    ],
    "platforms": {
        "ios": "8.0"
    },
    "libraries": [
        "z",
        "c++",
        "sqlite3"
    ],
    "subspecs": [
        {
            "name": "Code",
            "source_files": "DZPaySDK/Code/*.h",
            "public_header_files": "DZPaySDK/Code/*.h",
            "vendored_libraries": "DZPaySDK/Code/*.a",
            "frameworks": [
                "SystemConfiguration",
                "CoreGraphics",
                "UIKit",
                "CoreTelephony",
                "CoreText",
                "CoreMotion",
                "QuartzCore",
                "CFNetwork",
                "JavaScriptCore"
            ]
        },
        {
            "name": "AliPay15.1.6",
            "ios": {
                "vendored_frameworks": "DZPaySDK/AliPay15.1.6/AlipaySDK.framework"
            },
            "resources": "DZPaySDK/AliPay15.1.6/AlipaySDK.bundle"
        },
        {
            "name": "SDK1.6.2",
            "resources": "DZPaySDK/SDK1.6.2/*.*"
        },
        {
            "name": "pic",
            "resources": "DZPaySDK/pic/*.*"
        }
    ]
}

Pin It on Pinterest

Share This