Passing through a GameObject/Function to a button's OnClick

I’ve got a prefab (generic store item) being loaded into a panel, and I’m using a parent gameobject to update all store items with their correct info - item name, image etc etc, which is all simple enough reading/writing from Lists.

However, loading in the button is a little more difficult - I need it to first take in an existing object in the scene (which contains attached scripts that handle the store/item logic), into the OnClick() component. I then need to ensure the OnClick() is set to call the correct function (buyThis(int n)), and also pass through a value for n.

Can anyone point me in the right direction on this?

Edit: For clarity, here’s the prefab below:

So under On Click(), I need to attach this to an object that’s not a prefab - but is actually in the scene. Following this, I need to set the actual method that I want to be called, and set the int argument. Here’s a manually placed one;

So, in this one we can see the object attached, the method/function selected, and a value inserted for the required int argument.

In short, when instantiating/placing the prefab into the scene, I need to insert custom values for the gameobject to be loaded, and then for the method & arguments to be updated too.

public ACSILogic acsiLogic//get the script in here
int num;//some number
GameObject newGO = (GameObject)Instantiate(theprefab);

	UnityEngine.Events.UnityAction action1 = () => { acsiLogic.buyAsci(num); };
	newGO.GetComponent<Button>().onClick.AddListener(action1);//find the button and set

make sure you have a empty OnClick() at your prefab button… this will not show in the editor.