mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
231 stars 63 forks source link

I need examples with mollie connect (use of access tokens, onboarding, etc etc...) #267

Closed DocBouCou closed 2 years ago

DocBouCou commented 2 years ago

Hi,

In the docs of the mollie api client for node, I cannot find any examples or docs for what I need, which are:

Regards,

DocBouCou commented 2 years ago

I am not the only one who needs more examples and/or docs, see #150

Pimm commented 2 years ago

Hi, thanks for the issue.

Using an access token is a matter of providing it while constructing the client instead of an API key:

const mollieClient = createMollieClient({ accessToken: 'access_…' });

You can submit onboarding data:

mollieClient.onboarding.submit({ … });

or get the onboarding status:

await mollieClient.onboarding.get();

The payment links API is very similar to the payment API:

mollieClient.paymentLinks.create({ … });

The onboarding and payment links APIs are relatively new, which is why they are not yet documented everywhere. We do ‒ however ‒ make sure the TypeScript type definitions are always up-to-date. If you're using an IDE which understands these definitions (even if you're not writing TypeScript!) they can help you learn which methods/parameters are available, perhaps better than any code example can.

When you look for examples, do you check docs.mollie.com or in /examples? Because I have a suspicion the latter is not very popular.

DocBouCou commented 2 years ago

Thank you for your answer :-) .

Yes, of course, when I am looking for docs then I look the docs! To me, in the connect/oAuth/etc. part, the docs are not so clear (although they are great for everything else). And, yes, I've also looked at the examples folder (it helped me a lot when starting with other parts of mollie).

Pimm commented 2 years ago

Thanks!

Mollie Connect is the most difficult Mollie feature to explain to developers, and I agree that we could do a better job at it. (I'd point you to docs.mollie.com/connect/overview, but you've obviously already found it.)

I'm closing this issue, but please let me know if you need further assistance.

DocBouCou commented 2 years ago

Hi again,

To use the paymentLink api with an access token, I have to give the profile id. How can I know for sure the profile id of my users? I have read the "list profiles api" docs, but, concretely, what should I do if for some reason one of my user has many profiles? (in theory, my users have no reason to have more than one profile, but, who knows?)

Regards,

Pimm commented 2 years ago

One organisation can have multiple profiles. An organisation could be operating two separate webshops, for instance. When you create a payment (or payment link), you would have to specify for which of those two webshops that payment (link) is.

How you should handle this in your specific project depends on what your project is, exactly. But this question doesn't relate to this library, but rather to Mollie as a platform. I would ask you to contact Mollie support and discuss your situation with them.