2016-09-11 8 views
5

भुगतान के लिए प्रबंधित खातों का उपयोग करने का प्रयास कर रहा है। असल में एक उपयोगकर्ता चार्ज किया जाता है और प्लेटफ़ॉर्म खाते की बजाय प्रबंधित खाते में पैसा भेजा जाता है। मैं "ग्राहकों को साझा करना" का उपयोग कर रहा हूं, मैं इस लिंक https://stripe.com/docs/connect/shared-customers के नीचे कोड का उपयोग कर रहा हूं। टोकन को पुन: प्राप्त करने के बाद मैं एक बार चार्ज करने मैं कह "कार्ड जानकारी नहीं मिली" एक त्रुटि प्राप्त करने की कोशिश, लेकिन मैं जब टोकनजब मैं प्रबंधित खाते में भुगतान करने का प्रयास करता हूं तो त्रुटि प्राप्त हो रही है

को बनाने में त्रुटि cardId गुजर रहा हूँ: message: "Could not find payment information"

Stripe.tokens.create(
{ customer: request.params.customerId, card: request.params.cardId }, 
{ stripe_account: 'acct_xyz' }, // id of the connected account 
    function(err, token) { 

    Stripe.charges.create(
{ 
amount: 1000, // amount in cents 
currency: "usd", 
source: token, 
description: "Example charge", 
application_fee: 123 // amount in cents 
}, 
function(err, charge) { 
console.log(err); 
}); 
}); 

उत्तर

5

इस काम करता है तुम्हारे लिए? यहाँ मुख्य अंतर

  1. मैं stripe.charges.create अनुरोध पर { stripe_account: 'acct_xyz' } शामिल कर रहा हूँ और साथ ही इस कनेक्ट किए गए खाते पर ही होने की साझा ग्राहकों का उपयोग कर अगर जरूरत है। https://stripe.com/docs/connect/payments-fees#charging-directly

  2. के बजाय tokensource के रूप में मैं टोकन ऑब्जेक्ट (उदा tok_xxxyyyzzz) का केवल id विशेषता का उपयोग कर रहा हूँ।

नमूना:

// id of connected account you want to create customer on, charge 
var connectedAccountId = "acct_16MNx0I5dd9AuSl3"; 

// id of customer and card you want to create a token from 

var platformCustomerId = "cus_8vEdBa4rQTGond"; 
var platformCustomerCardId = "card_18dOAcFwTuOiiF4uwtDe2Nip"; 

var stripe = require("stripe")(
    "sk_test_xxxyyyyzzz" 
); 

    // create a token using a customer and card on the Platform account 
    stripe.tokens.create(
     {customer: platformCustomerId, card: platformCustomerCardId }, 
     {stripe_account: connectedAccountId}, 
     function(err, token) { 
     if (err) 
      throw (err); 

      stripe.charges.create({ 
       amount: 4444, 
       currency: "usd", 
       source: token.id, 
       description: "Charge on a connected account", 
       application_fee: 1111 
      }, 
      {stripe_account: connectedAccountId}, 
      function(err, charge) { 
       if (err) 
       throw (err); 
       console.log(charge); 
      }); 
     }); 

वैकल्पिक रूप से, के रूप में आप ने कहा कि आप प्रबंधित खाते का उपयोग कर रहे हैं, तो आप मंच है, जो आप साझा ग्राहकों को पूरी तरह से प्रवाह से बचने के लिए अनुमति देता है के माध्यम से चार्ज करने पर विचार कर सकता है, को देखने के यहां नमूना के लिए, https://stripe.com/docs/connect/payments-fees#charging-through-the-platform

+1

आईडी यह मेरे लिए क्या है। धन्यवाद दोस्त :) –

संबंधित मुद्दे

 संबंधित मुद्दे