【问题标题】:Stripe Capture Charge Amount Node and SwiftStripe Capture Charge 金额节点和 Swift
【发布时间】:2017-10-14 23:09:48
【问题描述】:

我正在尝试收取不同金额的费用,但我收到一条错误消息,提示“没有此类费用”,有时该金额应低于费用,事实就是如此。然而,最常见的错误是“没有这样的费用”错误,虽然费用不是零。

这是 node.js 中的 Cloud Code 函数:

Parse.Cloud.define("cancellationFee", function(request, response){
    stripe.charges.capture({
    charge: request.params.charge,
    amount: 500,
    destination: 500
    }, function(err, charge) {
        if(err){
                console.log(err);
                response.error(err);
        }else{
                console.log("Successfully captured cancellation fee");
                response.success("captured cancellation fee");
        }
}); 
});

Swift 代码 charge 变量不为零。

PFCloud.callFunctionInBackground("cancellationFee", withParameters: ["charge": chargeID]) { (success: AnyObject?, error: NSError?) -> Void in
             if error == nil{
                 // code
             }else{
                 // code
             }
}

【问题讨论】:

    标签: swift parse-platform stripe-payments parse-cloud-code stripe-connect


    【解决方案1】:

    对于仍然遇到此问题的一些人,正确的解决方案是首先将 charge_id 作为 String 传递,然后将 amount 作为第二个参数> 在这样的对象内:

    stripe.charges.capture( 'chargeIdExample3242', {amount: 23} );
    

    Source

    【讨论】:

      【解决方案2】:

      您确定您的错误不是由于将目标设置为数字造成的吗?目的地应该是一个帐户 ID。并且也应该在创建一个费用时设置,而不是捕获费用。除了要捕获的费用之外,您不应将任何其他参数传递给 charge 方法。

      您也不应该在此处设置收费金额。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-12-11
        • 2015-07-23
        • 2018-02-10
        • 2018-11-04
        • 2017-07-18
        • 2017-07-28
        • 1970-01-01
        • 2017-05-27
        相关资源
        最近更新 更多