#costia-custom-french

1 messages ยท Page 1 of 1 (latest)

dark gate
hazy lichen
#

OK no problem thanks ! ๐Ÿ™‚ Can I keep these discussions open if I need to clarify something that I don't understand?

dark gate
#

Sure ๐Ÿ™‚

#

feel free to ask any questions about using connected custom accounts or the api etc

#

i may archive this later when i step away, but if so you're welcome to post in the main channel

hazy lichen
#

Re ๐Ÿ™‚ I have a question i'm in french and i want to fill all fields on account creation and do not update after but i have this error message if i don't use the token :
Error: Connect platforms based in FR must create Custom accounts via account tokens.
and i use the token this error :
Error: Parameter 'legal_entity[type]' cannot be used in conjunction with an account token.
so how i can fill all fields without update the account after the creation my code

app.post("/api/fulll/", cors(), async function (req, res) {
  let { id } = req.body
  Merchants.findOne({ id: id }, async function (err, data) {
    if (err) console.log("there is an  error", err)
    if (data) {
      console.log(data)
      const accountResult = await stripe.tokens.create({
        account: {
          business_type: 'company',
          company: {
            name: data.companyName,
            address: {
              line1: data.address,
              city: data.town,
              state: data.country,
              postal_code: data.postalCode,
            },
          },
          tos_shown_and_accepted: true,
        },
      });
      if (accountResult) {
        console.log("account result", accountResult)
        const account = await stripe.accounts.create({
          type: 'custom',
          country: 'FR',
          email: data.email, 
          capabilities: {
            card_payments: { requested: true },
            transfers: { requested: true },
          },
          legal_entity: {
            first_name: data.firstname,
            last_name: data.surname,
            type: "company",
            business_name: data.officialCompanyName,
            business_tax_id: data.siretNumber,
            business_vat_id: data.VATNumber,
            additional_owners: [],
            dob: data.dob,
            address: {
              line1: data.address,
              city: data.town,
              state: data.area,
              postal_code: data.postalCode,
            },
            personal_address: {
              line1: data.address,
                city: data.town,
                state: data.area,
              postal_code: data.postalCode,
              country: data.countryShort
            },
          },
        });
        if (account) {
          
          console.log("\x1b[35m", "account", "\x1b[32m", account)
        }
      }
    }
  })
dark gate
#

When are you hitting that error about the account token and legal entity?

hazy lichen
#

okay so when my code is like this i have error :
Error: Parameter 'legal_entity[type]' cannot be used in conjunction with an account token.

app.post("/api/fulll/", cors(), async function (req, res) {
  let { id } = req.body
  Merchants.findOne({ id: id }, async function (err, data) {
    if (err) console.log("there is an  error", err)
    if (data) {
      console.log(data)
      const accountResult = await stripe.tokens.create({
        account: {
          business_type: 'company',
          company: {
            name: data.companyName,
            address: {
              line1: data.address,
              city: data.town,
              state: data.country,
              postal_code: data.postalCode,
            },
          },
          tos_shown_and_accepted: true,
        },
      });

      if (accountResult) {
        console.log("account result", accountResult)
        const account = await stripe.accounts.create({
          type: 'custom',
          country: 'FR',
          email: data.email, 
          capabilities: {
            card_payments: { requested: true },
            transfers: { requested: true },
          },
          legal_entity: {
            first_name: data.firstname,
            last_name: data.surname,
            type: "company",
            business_name: data.officialCompanyName,
            business_tax_id: data.siretNumber,
            business_vat_id: data.VATNumber,
            additional_owners: [],
            dob: data.dob,
            address: {
              line1: data.address,
              city: data.town,
              state: data.area,
              postal_code: data.postalCode,
            },
            personal_address: {
              line1: data.address,
                city: data.town,
                state: data.area,
              postal_code: data.postalCode,
              country: data.countryShort
            },
          },
          account_token: accountResult.id, ///this line 
        });
        if (account) {
          
          console.log("\x1b[35m", "account", "\x1b[32m", account)
        }
      }
    }
  })
})
#

and i setup the request id

dark gate
#

Sure but where do you see this error, which line of code triggers it? Do you get a stripe error response from the API?

hazy lichen
#

i have this error on cont account = await stripe.accounts.create ...
All the error:

(node:25196) UnhandledPromiseRejectionWarning: Error: Connect platforms based in FR must create Custom accounts via account tokens. For documentation on account tokens, see https://stripe.com/docs/connect/account-tokens.
    at Function.generate (D:\strapi\practice\pract-front\serveur\node_modules\stripe\lib\Error.js:40:16)
    at res.toJSON.then.StripeAPIError.message (D:\strapi\practice\pract-front\serveur\node_modules\stripe\lib\StripeResource.js:220:35)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:25196) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25196) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

Error Connect platforms based in FR must create Custom accounts via account tokens.
id: req_I7Bn6CTgrLLYBJ
Error : Parameter 'legal_entity[type]' cannot be used in conjunction with an account token.
id: req_uPddU4DJjXrvcZ

dark gate
#

ok thank you, taking a look

#

ah, so just send those piece separately -- though I expected the legal entity info to need to use the account token too

#

but you'll have ot send the account token in one request

hazy lichen
#

OKay but can i do things like that

 const accountResult = await stripe.tokens.create({
        account: {
          business_type: 'company',
          company: {
            name: data.companyName,
            address: {
              line1: data.address,
              city: data.town,
              state: data.country,
              postal_code: data.postalCode,
            },
          },
 legal_entity: {
            first_name: data.firstname,
            last_name: data.surname,
            type: "company",
            business_name: data.officialCompanyName,
            business_tax_id: data.siretNumber,
            business_vat_id: data.VATNumber,
            additional_owners: [],
            dob: data.dob,
            address: {
              line1: data.address,
              city: data.town,
              state: data.area,
              postal_code: data.postalCode,
            },
            personal_address: {
              line1: data.address,
                city: data.town,
                state: data.area,
              postal_code: data.postalCode,
              country: data.countryShort
            },
          },
          tos_shown_and_accepted: true,
        },
      });
dark gate
#

yes, i suspect you need to supply the legal entity info in an account token

#

are you having issues if you try this?

hazy lichen
#

yes but just because my dob i null i fix it and i told you

dark gate
#

Sorry, i did not see a note about fixing that. Is it working for you now then?

hazy lichen
#

yes

#

its works !!!

#

thanks a lot for the help

dark gate
#

hooray! ๐Ÿ™Œ you're very welcome

hazy lichen
#

have a good day and thanks again for the help

dark gate
#

You too!