商户接入指南 商户接入指南
  • V2 (opens new window)
  • V3 (opens new window)
  • V4-English (opens new window)
  • V4-专业版 (opens new window)
  • V2 (opens new window)
  • V3 (opens new window)
  • V4-English (opens new window)
  • V4-专业版 (opens new window)
  • 概述

    • 起步
    • 对接流程
    • 联调资源
  • 服务

    • Checkout

      • 概览
      • Hosted
      • Non-Hosted
      • APIs

    • 订阅

      • 概览
      • 接入流程
    • 线下付款码支付

      • 接入流程
    • Tokenization

      • 概览
      • 接入流程
      • APIs

    • 风险管理

      • 概览
      • Dynamic 3D Secure
      • Disputes
      • APIs

    • 一键支付

      • 概览
      • 接入流程
      • APIs

    • ApplePay

    • GooglePay

      • 概览
        • 概述
        • 支付流程
        • 接入说明
      • 异步通知
      • 签名规约
      • APIs

    • KYB

    • 支付链

    • 建站工具

    • 工具

  • 附录

  • v4

GooglePay

# 概述

PingPong Checkout 通过 SDK 内嵌到合作商户 APP 的方式,向商户提供基于 Android 移动设备客户端的支付能力。

本指南定义了合作商户接入 PingPong Checkout SDK(Android)的接口标准。

提示

商户APP在向用户展示收银台之前,要根据 SDK 提供的方法判断是否向用户提供 Google Pay支付方式, 从而判断是否显示 Google Pay 支付按钮。
从商户角度来看,需要做以下几步交互:

  1. 商户 APP 调用 SDK 接口判断是否支持 Google Pay
  2. 商户 APP 收到判断结果,决定是否向用户展示 Google Pay支付按钮

# 支付流程

在前序步骤中,商户能够向用户提供 Google Pay 支付能力后,用户点击 Google Pay 支付按钮,触发交易申请,系统处理中,用户等待交易结果。

在商户侧角度来看,需做以下几步交互:

  1. 商户 APP 向商户后台初始化订单交易
  2. 商户 Server 返回商户APP请求结果
  3. 商户 APP 调用 SDK 交易请求方法(具体参数详见下面接口说明)
  4. SDK 调用商户 APP 支付结果接口,返回支付交易结果
  5. 商户 APP 向用户展示交易结果
  6. 同时 PingPong 后台异步通知交易结果到商户 Server

警告

与 ApplePay 的差异点,Google Pay 存在需要用户3D认证的可能性。当 PP Checkout判断用户需要做3D认证后,调用 SDK 中的 3D 插件,弹出认证页面,用户完成认证后,PP Checkout 后端继续交易流程

# 接入说明Android 10 or higher

# 下载

步骤 1. 在你的根目录下的 build.gradle(settings.gradle)文件的 repositories 部分末尾添加 Maven 仓库

allprojects {

    repositories {

        //...

        maven {

            url 'https://cardinalcommerceprod.jfrog.io/artifactory/android'

            credentials {

                username 'cybersource_pingpongpay_wangyy'

                password 'OOBu3#PtZwe.}mYfgc4)'

            }

        }

        maven {

            url "https://mobile-sdks.forter.com/android"

            credentials {

                username "forter-android-sdk"

                password "HvYumAfjVQYQFyoGsmNAefGdR84Esqig"

            }

        }

    }

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

步骤 2. 添加依赖项

dependencies {

    implementation 'com.google.android.gms:play-services-wallet:19.1.0'

    implementation 'org.jfrog.cardinalcommerce.gradle:cardinalmobilesdk:2.2.7-2'

    implementation 'com.forter.mobile:fortersdk:2.4.13'

}
1
2
3
4
5
6
7
8
9

请将 PingPong SDK 放置在 lib 文件夹中。

同时,请确保将以下依赖项添加到您应用程序的 build.gradle 文件中。

当前版本号是最新版本(2023-01-01),因此您可以选择更高版本的依赖项来适配您的应用程序。

dependencies {

    implementation 'androidx.appcompat:appcompat:1.4.1'

    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'

    implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.11'

    implementation('com.squareup.retrofit2:retrofit:2.9.0') {

        exclude module: 'okhttp'

        exclude module: 'okio'

    }

    implementation('com.squareup.retrofit2:converter-gson:2.9.0') {

        exclude module: 'okhttp'

        exclude module: 'okio'

        exclude module: 'gson'

    }

    implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.11'

    implementation 'com.google.code.gson:gson:2.10.1'

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

# Google Pay 静态支付按钮资源和布局文件

请将适当的按钮布局文件链接到应该显示该按钮的布局中。

例如:

<include layout="@layout/googlepay_button" />



<include layout="@layout/buy_with_googlepay_button" />



<include layout="@layout/pay_with_googlepay_button" />
1
2
3
4
5
6
7
8
9

Google Pay支付按钮有三种不同的样式可供选择: dark, light, and light with an outline.

# Google Pay 的标志

当您在支付流程中展示 Google Pay 作为支付选项时,请仅使用下方提供的 Google Pay 标志

android:src="@drawable/google_pay_mark_800"  // .xml

android:src="@drawable/google_pay_acceptance_mark_800"  // .png
1
2
3

# 品牌指南

要获取完整的指南和最佳实践,请参考以下资源

品牌指南 (opens new window)

# 缩减资源

我们强烈建议在您的 build.gradle 文件中启用资源收缩(resource shrinking)。要了解更多信息 请访问 Android Studio 文档中的缩减资源 (opens new window)

# SDK 调用示例

# 设置环境参数

接口名:setSDKEnvironment
1

# 请求参数:

字段 类型 必填 描述
environment enum M
  • PPPayEnvironment.SANDBOX
  • PPPayEnvironment.TEST
  • PPPayEnvironment.PROD
  • 示例:

    PPPayManager.getInstance().setSDKEnvironment(PPPayEnvironment.SANDBOX)
    
    1

    # Google Pay展示判断示例

    接口名:canGooglePay
    
    1

    # 请求参数:

    字段 类型 必填 描述
    context Context M Context

    # 响应参数:

    字段 类型 必填 描述
    code String M 状态码
    description String M 结果描述
    canGooglePay Boolean M
  • false - unavailable
  • true - available
  • 示例:

    private fun possiblyShowGooglePayButton() {
    
        PPPayManager.getInstance().canGooglePay(this) {
    
            when (it.code) {
    
                CanGooglePayResult.SUCCESS -> {
    
                    if (it.canUseGooglePay) {
    
                        // show GooglePay button
    
                        vb.googlePayButton.root.visibility = View.VISIBLE
    
                    } else {
    
                    }
    
                }
    
                CanGooglePayResult.ERROR -> {
    
                }
    
                else -> {
    
                }
    
            }
    
        }
    
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    上次更新: 2023/11/02, 15:08:03

    ← Web-NoHosted方式集成 异步通知→

    杭州乒乓智能技术有限公司 | Copyright © 2015-2024 checkout.pingpongx.com.All Rights Reserved.
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式