Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Braintree中的付款方式令牌无效_Python_Token_Payment Gateway_Braintree - Fatal编程技术网

Python Braintree中的付款方式令牌无效

Python Braintree中的付款方式令牌无效,python,token,payment-gateway,braintree,Python,Token,Payment Gateway,Braintree,我想在订阅支付网关Braintree的功能方面对其进行测试——针对我的应用程序,使用Django(python) 你的代码我只有一个py文件。(没有前端)。当我想要创建订阅时,我得到一个错误: <ErrorResult 'Payment method token is invalid.' at 7f101d301390> 我在Braintree工作。如果你有更多的问题,请回答 一般来说,像Braintree这样的服务的一个主要好处是,你永远不必处理信用卡号码,因此你的情况会更好,这

我想在订阅支付网关Braintree的功能方面对其进行测试——针对我的应用程序,使用Django(python)

你的代码我只有一个py文件。(没有前端)。当我想要创建订阅时,我得到一个错误:

<ErrorResult 'Payment method token is invalid.' at 7f101d301390>
我在Braintree工作。如果你有更多的问题,请回答

一般来说,像Braintree这样的服务的一个主要好处是,你永远不必处理信用卡号码,因此你的情况会更好,这将更好地匹配与Braintree的真正集成

也就是说,如果您确实希望在没有前端的情况下对其进行测试,您可以这样测试:

result = braintree.Customer.create({
    "credit_card": {
        "number": "4111111111111111",
        "expiration_date": "12/16"
    }
})

result = braintree.Subscription.create({
    "payment_method_token": result.customer.credit_cards[0].token,
    "plan_id": "my_plan_id"
})

@AwaisMustafa是的,使用PayPal帐户的支付方式令牌创建订阅。@agf您能告诉我如何获得令牌frim PayPal acc吗?@Sachinsah请联系Braintree支持部门提出您的问题,但基本上是一样的,除了更换
信用卡
位。我花了很长时间才找到对支付方法的价值有意义的东西。为什么他们不能称之为付款方式_id@BogdanM. 一般来说,区别在于,
\u令牌
s可以由商户通过API设置,而
\u id
s不能设置。
result = braintree.Customer.create({
    "credit_card": {
        "number": "4111111111111111",
        "expiration_date": "12/16"
    }
})

result = braintree.Subscription.create({
    "payment_method_token": result.customer.credit_cards[0].token,
    "plan_id": "my_plan_id"
})