Get product id when creating a product through connected service

Hey!

I have a Printify account integrated to the website.
I was able to create a product from the website on Printify which then is automatically added to the Wix Store and I can add it to the cart.

However, there is a problem with the last part. See code below (which works):

The problem arises when I try to fetch products. There is no product created there yet and thus the result is empty:

How can I get the id for that product and add it to the cart?

Thanks!

Solved this problem, though maybe not so elegantly. I have created an interval that checks if the product has been created and if yes, it gets cleared. Usually it takes around 5 seconds.