在家庭服务器上处理 Stripe 付款时出现禁止 (403) 错误

Posted

技术标签:

【中文标题】在家庭服务器上处理 Stripe 付款时出现禁止 (403) 错误【英文标题】:Forbidden (403) error when processing Stripe payments on home server 【发布时间】:2016-08-18 01:40:23 【问题描述】:

我是一名 ios 开发人员,希望将 Stripe 支付功能添加到我的一个应用中。我在我的 SSL 站点上创建了一个页面,该页面托管了来自以下链接的建议代码:

https://stripe.com/docs/charges

当我尝试处理付款时,我收到“禁止 (403)”错误。谁能告诉我我可能做错了什么?我的 Ruby 文件中的所有代码如下:

stripe.api_key = "MySecretKeyGoesHere"

token = request.POST['stripeToken']

try:
  charge = stripe.Charge.create(
    amount=1000, # amount in cents, again
    currency="gbp",
    source=token,
    description="Example charge"
  )
except stripe.error.CardError, e:
 # The card has been declined
 pass

在许多主要语言中都有这方面的示例,我很乐意使用其中任何一种,但目前正在尝试 Ruby 和 Python 版本。

【问题讨论】:

请问您是使用实时模式还是测试模式进行 Stripe Payments? 我在实时模式下工作 如何在python中用引号括住标识符导入?你是巫师吗? ^^ 放轻松,我已经 15 年没有写过 Swift 以外的东西了! 【参考方案1】:

int 数量 = 10000; // $100.00 int applicationFee = int(金额 * 0.3); // 30% 份额

Map<String, Object> chargeParams = new HashMap<String, Object>();
chargeParams.put("amount", amount);
chargeParams.put("currency", "usd");
chargeParams.put("description", "Example charge");
chargeParams.put("customer", customerId); // customerId is the ID of the customer object for the paying person    
chargeParams.put("destination", accountId); // accountId is the ID of the account object for the vendor that should be paid
chargeParams.put("application_fee", applicationFee);
Charge.create(chargeParams);

    还请验证您是否在服务器端设置中使用了正确的Live Secret KeyLive Publishable Key

    检查帐户日志以验证您在https://dashboard.stripe.com/logs?method=not_get处理付款时遇到的确切问题

    在 Stripe 上验证您的关联帐户

    帐户详情: https://dashboard.stripe.com/account/details 身份验证:https://stripe.com/docs/connect/identity-verification

    文档链接:- [1] https://stripe.com/docs/api#create_charge [2]https://stripe.com/docs/api#create_transfer [3] https://stripe.com/docs/api#create_refund [4]https://stripe.com/docs/api#balance_object [5]https://stripe.com/docs/connect/payments-fees#charging-directly [6]https://stripe.com/docs/connect/authentication#authentication-via-the-stripe-account-header [7]https://stripe.com/docs/connect/payments-fees#charging-through-the-platform

【讨论】:

你能解释一下这解决了什么问题以及它的去向吗?谢谢 请检查您的帐户余额是否有足够的余额来处理付款过程。尝试在创建费用时打印可用余额。还请验证您是否在服务器端设置中使用了正确的私钥和公钥。 你有一个实时的 Stripe 服务器吗? 是的,我们首先在测试模式下测试了所有内容。然后我们打开了实时模式,一切正常

以上是关于在家庭服务器上处理 Stripe 付款时出现禁止 (403) 错误的主要内容,如果未能解决你的问题,请参考以下文章

使用 Stripe 付款创建复杂订单

GoDaddy用支付宝付款时出现我们无法处理这笔交易,请查看您的付款信息并重试。

Stripe:如何在没有计划的情况下设置定期付款?

在Stripe + React中发生无效的挂钩调用错误

Stripe:重复付款失败

Stripe React Native:商家显示名称不能为空字符串