gpt4 book ai didi

android - 如何在 Android 中使用 Simplify Commerce Payment API?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:22:23 25 4
gpt4 key购买 nike

我正在尝试从卡 token 创建付款在我的 android 程序中,如下链接所示:

Sample usage of payment api

我无法使用 Simplify Commerce Android SDK 创建“支付”对象,因此我通过将此行添加到我的 gradle 构建中来包含 java 支付 SDK

compile 'com.simplify:payments-sdk-java:1.3.0'

添加此行后我可以导入“com.simplify.payments”包并创建支付对象,但这次我的 android 构建失败(因为我使用 java sdk?)。

    Information:Gradle tasks [:app:assembleDebug]
Warning:Dependency org.apache.httpcomponents:httpclient:4.2.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.2.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.2.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.2.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareComSimplifySdkAndroid103Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/hamcrest/Description;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED

如何在我的 android 程序中使用 Simplify Commerce 支付 api?

Github Link to my project

最佳答案

全面披露:这并没有回答如何在您的应用中包含支付 API 的问题,而是为您指明了使用 Simplify 在您的应用中收款的正确方向。

您绝对不应该尝试在您的 Android 应用程序中使用 payments java sdk。这样做需要您提供您的私有(private) API key ,并且会带来严重的安全问题。请参阅:https://github.com/simplifycom/simplify-android-sample/wiki/Simplify-Android-SDK-Tutorial#process-a-payment

Friendly reminder: DO NOT BUNDLE YOUR PRIVATE KEY WITHIN YOUR APP!

Your private keys are considered sacred and can be used to process payments, issue refunds, and more. A common development mistake is to simply include the Java SDK in an app and use a private key to complete the transaction lifecycle without involving a server. While it may seem like an easy way to integrate payments, distributing your private key in an app leaves it vulnerable through simple reverse engineering. Once compromised, an attacker can use your key to perform almost every operation offered through our APIs. This is bad security practice. In addition, since keys can be revoked from the API Keys page, they are also considered volatile. If a private key is revoked, any app using it will be broken until an update is released with a new key. The bottom line is this: Don't do it. We will find you. :)

好消息是 Simplify 提供了一个 Android SDK,您可以使用它在您的应用程序中收集和标记卡信息。只需将其包含在以下行中:

compile 'com.simplify:simplify-android:2.0.3'

引用文档和示例应用程序位于: https://github.com/simplifycom/simplify-android-sample

关于android - 如何在 Android 中使用 Simplify Commerce Payment API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32770983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com