客户对象在解析/条带中保存在何处

时间:2014-08-21 18:33:50

标签: parse-platform stripe-payments

我能够使用Parse Cloud模块成功创建客户对象。现在已创建此客户对象,如何获取应返回的客户ID?这是我的代码:

Parse.Cloud.define("createCustomer", function(request, response) {    
  Stripe.Customers.create({
        account_balance: 0,
        email: request.params.email,
        description: 'new stripe user',
        metadata: {
           name: request.params.name,
           userId: request.params.objectId, // e.g PFUser object ID
           createWithCard: false
           }
         }, {
            success: function(httpResponse) {
                 response.success("success");
            },
            error: function(httpResponse) {
                 console.log(httpResponse);
                 response.error("Cannot create a new customer.");
             }
      });

});

1 个答案:

答案 0 :(得分:1)

httpResponse实际上返回整个客户。如果您只想要客户ID,请使用:

httpResponse["id"]

如果您只想将整个客户返回到调用该函数的任何内容,只需将其返回到response.success:

response.success(httpResponse);