我已经按照教程提供了HERE.,可以找到HERE快速入门演示。
如果我在下面的“ 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中拥有开发者资料才能运行演示吗?
此商家没有可用的接受卡。
[此消息通常是在当前Google用户没有任何与商家提供的付款方式兼容的卡时出现的。具体为allowedCardNetworks
和allowedAuthMethods
。