Purchase of NFT OpenSea

I have read the Moralis documentation, but I have not found a way to purchase NFT through the Api or libraries. How can I create a purchase request knowing token_address or token_id NFT from OpenSea. I would like to see an example of something or a link to the documentation about it. Thanks

Moralis has opensea plugin to execute this. You can check the documentation under https://moralis.io/plugins/opensea/

To create the purchase request you can use createBuyOrder function. Refer https://moralis.io/plugins/opensea/ for documentation.

Hi. I tried, but I get such errorsimage
image

Maybe I made a mistake in the address. What should be stored in paymentTokenAddress

Could you confirm if your tokenAddress and tokenId are available on Opensea for sale

Yes, here is the link

This is on mainnet and testnet is mentioned in function.

I tried it on the main network. He writes like he is not authorized, that he did authorization

The payment token address should the ERC20 token address base on the listed NFT. In your case, it should be WETH token address
image

and I am unsure about the error. Apparently, the HTML in the error is saying β€œThis website is using a security service to protect itself from online attacks.”
image

Yes, I used selenium for parsing. But then it turns out to make a transaction through the Moralis plugin will not work

It turns out that you need to use the library for nodejs: Web3JS or EtheresJS. Is this the only way it works?

It looks like a problem that we have when connecting to opensea. It looks like cloudflare is blocking that request.

Do I have to wait for the error fix, or are there other ways to complete the purchase?

I don’t know the answer. If you get an api key from opensea maybe you could use it, but I heard that it is not easy to get an api key now.

Yes, it’s not easy. I sent the application a month ago and so there is no information. I will then look for other ways. Thank you for the information