• 首页
  • Qt文档
  • DTK文档
  • 玲珑文档
  • 开发集成

    系统接口

    付费功能最终是对系统的com.deepin.Purchase接口进行封装,dtkpay提供基于Dtk/Qt的封装。对于其他语言,可以选择根据dtkpay源码进行自己的封装。

    com.deepin.Purchase接口原型如下:

    <interface name="com.deepin.Purchase">
        <method name="Purchased">
            <arg name="appID" type="s" direction="in"></arg>
            <arg name="appPublicKey" type="s" direction="in"></arg>
            <arg name="challenge" type="a(ss)" direction="out"></arg>
        </method>
    </interface>
    

    返回参数challenge中包含两个字段,hash和sign,应用需要使用publickey对hash进行验证,如果验证通过,说明用户已经购买该应用。

    示例代码

    下面是基于Dtk的实例代码,核心如下:

    https://git.chinauos.com/sdk/dtkpay

    示例代码可以从如下地址获得:

    https://git.chinauos.com/sdk/com.deepin.demo