2016-09-25 32 views

回答

1

Node.js的條紋庫是異步的,所以你要麼需要包括一個回調與that API call或將其返回到varpromises處理。

使用回調,這將是這樣的:

stripe.transfers.create({ 
    amount: payoutAmount*100, 
    currency: "usd", 
    destination: "default_for_currency", 
    method: "instant" 
}, {stripe_account: String(accountId)}, function(error, transfer) { 
    if (error) { 
     // Transfer failed, so do something with the error: 
     return doSomethingWithError(error); 
    } 

    // Transfer succeeded, so do something with the Transfer: 
    doSomethingWithTransfer(transfer); 
});