如何使用条带支付在android中设置订阅计划? [英] How to set subscribe the plan in android using stripe payment?

查看:31
本文介绍了如何使用条带支付在android中设置订阅计划?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的 android 应用中实现条带支付网关.到目前为止,我可以使用 stripe 验证信用卡,但我坚持订阅.我无法在应用程序中设置 Stripe.api_key.它的显示无法解析变量.如果我删除 Stripe.api_key 然后应用程序抛出以下异常

<块引用>

Stripe::AuthenticationError - 未提供 API 密钥.(提示:使用Stripe.api_key = <API-KEY>"设置您的 API 密钥.您可以从 Stripe Web 界面生成 API 密钥.有关详细信息,请参阅 https://stripe.com/api,或发送电子邮件至 support@stripe.com 如果您有任何问题.):

请帮忙解决问题

解决方案

支付流程中唯一应该直接在原生 Android 应用程序中完成的部分是客户支付信息的收集和标记化,使用 Stripe 的 Android SDK.

令牌创建后,您必须将其发送到后端服务器,在那里您可以使用它创建客户,然后使用客户创建订阅.>

您不能直接从应用执行此操作的原因是这些请求要求您使用您的 API 秘密密钥,并且绝不能以任何方式将 API 秘密密钥共享或嵌入到应用中.否则,攻击者可以检索它并使用它来访问您的帐户并代表您发出 API 请求.

I am implementing the stripe payment gateway in my android app. Up to Now I am able to validate the credit card using stripe but I got stuck to subscribe . I am unable to set Stripe.api_key in app. Its shows cannot resolve variable. If I remove Stripe.api_key then app throw following exception

Stripe::AuthenticationError - No API key provided. (HINT: set your API key using "Stripe.api_key = <API-KEY>". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions.):

please help to resolve the issue

解决方案

The only part of the payment flow that should be done directly within a native Android app is the collection and tokenization of the customer's payment information, using Stripe's Android SDK.

Once the token has been created, you must sent it to a backend server, where you can use it to create a customer, then use the customer to create a subscription.

The reason you can't do this directly from the app is because those requests require that you use your secret API key, and the secret API key should never in any way be shared or embedded with the app. Otherwise, an attacker could retrieve it and use it to access your account and issue API requests on your behalf.

这篇关于如何使用条带支付在android中设置订阅计划?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆