我是一名 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 版本。
最佳答案
整数数量 = 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);
Please also verify if you are using correct Live Secret Key and Live Publishable Key in your server side setup.
Check account logs to verify what is the exact problem you are facing while processing payments at https://dashboard.stripe.com/logs?method=not_get
Verify your Connected Account on Stripe
Account Details: https://dashboard.stripe.com/account/details
Identity Verification: https://stripe.com/docs/connect/identity-verificationDocumentation Links:-
[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
关于python - 在家庭服务器上处理 Stripe 付款时出现禁止 (403) 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36827454/