2016-09-11 29 views
5

Próba użycia kont zarządzanych do wypłat. Zasadniczo użytkownik jest obciążany, a pieniądze są wysyłane na zarządzane konto zamiast na konto platformy. Używam "dzielenia się klientami" Używam kodu na dole tego linku https://stripe.com/docs/connect/shared-customers. Po pobraniu token staram się zrobić jeden ładunek pojawia się błąd mówiący „Informacje Card not found”, ale ja minięciu CardID podczas tworzenia tokenaBłąd podczas próby wypłaty na konto zarządzane

błąd: 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); 
}); 
}); 

Odpowiedz

5

to działa dla Ciebie? Główne różnice są tu

  1. jestem tym { stripe_account: 'acct_xyz' } na życzenie stripe.charges.create jak to musi się zdarzyć na podłączonym samą uwagę, jeśli za pomocą udostępnionego klientów. https://stripe.com/docs/connect/payments-fees#charging-directly

  2. Zamiast token jak source Używam tylko atrybut token obiektu (np tok_xxxyyyzzz) id.

Próbka:

// 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); 
      }); 
     }); 

Alternatywnie, jak mówiłeś, że jesteś przy użyciu Konta zarządzane, może warto rozważyć ładowania poprzez platformę, która pozwala uniknąć udostępnionego Klienci płynąć całkowicie, patrz tutaj dla próbki, https://stripe.com/docs/connect/payments-fees#charging-through-the-platform

+1

Identyfikator jest tym, co zrobił dla mnie. Dzięki stary :) –