Android 谷歌支付;“快速入门演示”;如果我选择“不显示卡片列表”;直接;Paymenttokenization选项的方法

Android 谷歌支付;“快速入门演示”;如果我选择“不显示卡片列表”;直接;Paymenttokenization选项的方法,android,payment,google-pay,Android,Payment,Google Pay,我已经按照教程提供的快速入门演示可以找到 如果我在方法下面的“tokenizationSpecification”参数中选择 private static JSONObject getGatewayTokenizationSpecification() throws JSONException { return new JSONObject(){{ put("type", "PAYMENT_GATEWAY"); put("parameters", new JSONObject(){{

我已经按照教程提供的快速入门演示可以找到

如果我在方法下面的“tokenizationSpecification”参数中选择

private static JSONObject getGatewayTokenizationSpecification() throws JSONException {
return new JSONObject(){{
  put("type", "PAYMENT_GATEWAY");
  put("parameters", new JSONObject(){{
    put("gateway", "example");
    put("gatewayMerchantId", "exampleGatewayMerchantId");
    }
  });
}};
private static JSONObject getDirectTokenizationSpecification()
        throws JSONException, RuntimeException {
    if (Constants.DIRECT_TOKENIZATION_PARAMETERS.isEmpty()
            || Constants.DIRECT_TOKENIZATION_PUBLIC_KEY.isEmpty()
            || Constants.DIRECT_TOKENIZATION_PUBLIC_KEY == null
            || Constants.DIRECT_TOKENIZATION_PUBLIC_KEY == "REPLACE_ME") {
        throw new RuntimeException(
                "Please edit the Constants.java file to add protocol version & public key.");
    }
    JSONObject tokenizationSpecification = new JSONObject();

    tokenizationSpecification.put("type", "DIRECT");
    JSONObject parameters = new JSONObject(Constants.DIRECT_TOKENIZATION_PARAMETERS);
    tokenizationSpecification.put("parameters", parameters);

    return tokenizationSpecification;
}
}

这很好,但如果我选择下面的方法

private static JSONObject getGatewayTokenizationSpecification() throws JSONException {
return new JSONObject(){{
  put("type", "PAYMENT_GATEWAY");
  put("parameters", new JSONObject(){{
    put("gateway", "example");
    put("gatewayMerchantId", "exampleGatewayMerchantId");
    }
  });
}};
private static JSONObject getDirectTokenizationSpecification()
        throws JSONException, RuntimeException {
    if (Constants.DIRECT_TOKENIZATION_PARAMETERS.isEmpty()
            || Constants.DIRECT_TOKENIZATION_PUBLIC_KEY.isEmpty()
            || Constants.DIRECT_TOKENIZATION_PUBLIC_KEY == null
            || Constants.DIRECT_TOKENIZATION_PUBLIC_KEY == "REPLACE_ME") {
        throw new RuntimeException(
                "Please edit the Constants.java file to add protocol version & public key.");
    }
    JSONObject tokenizationSpecification = new JSONObject();

    tokenizationSpecification.put("type", "DIRECT");
    JSONObject parameters = new JSONObject(Constants.DIRECT_TOKENIZATION_PARAMETERS);
    tokenizationSpecification.put("parameters", parameters);

    return tokenizationSpecification;
}
不起作用。[不显示我的卡片列表。]

注意:-我执行了下面的方法来生成公钥,并将其替换到常量文件中

#生成私钥 openssl ecparam-name prime256v1-genkey-noout-out key.pem

# generate a base64-encoded public key

openssl ec -in key.pem -pubout -text -noout 2> /dev/null | grep "pub:" -A5 | sed 1d | xxd -r -p | base64 | paste -sd "\0" -
问题:- -我必须在google pay中有开发者档案才能运行演示吗

没有可用于此商户的接受卡


此消息通常出现在当前谷歌用户没有任何与商户提供的支付选项兼容的卡时。具体而言,
AllowedCardNetwork
allowedAuthMethods
国家可能是这种情况下的一个因素

为了消除这种情况,您能否尝试创建一个新的Google帐户用于测试?在美国创建此Google帐户,并向该帐户添加付款方式/信用卡

用下面的例子来测试它:(它对我有用,我在美国)

如果它工作并显示卡,则可能是您使用的用户所在国家/地区现在提供的直接集成存在问题


它仍然不起作用,这可能是一个问题-该卡不支持直接集成,在这种情况下,请尝试使用不同的卡(最好来自美国等其他国家-如果您没有可用的卡,这可能会很困难).

您在Logcat中得到了什么?您检查过@PratikButani吗?是的,我检查过了,但我是否需要gPay开发者配置文件才能运行快速入门演示?您不需要注册即可尝试测试集成。尝试以下似乎适用于web集成的公钥:
BOdoXP+9Aq473SnGwg3JU1aiNpsd9vH2ognq4PtDtlLGa3Kj8TPf+jaqnpydskh3juhis0kyrlwhagnzkhyf2y=
(from:)@Soc仍在获取“没有可用于此商户的已接受卡”。我想要使用“网关”选项显示的卡列表。再次,会说相同的演示商户Id使用“网关”方法,而不使用“直接”方法@Sreeram NairIt与印度以外的国家合作,因为我们对“印度gpay账户”有不同的支付整合方法。