Is the cost given the marginal or cumulative cost? If it's the cumulative cost, then the profit is pq-C(q): your price is money per item, so you have to multiply by the number of items to find the total gross revenue. The problem is then to maximize the profit, i.e. find $\max_{q} pq-C(q)$.
If C(q) is the marginal cost, then the marginal profit is marginal revenue minus marginal cost, i.e. marginal profit = p-C(q).
The FOC is that the firm should keep selling the product until selling more would cause their marginal profit to go negative. For a continuous function to go from positive to negative, it has to go through zero. Thus, the FOC is that their marginal profit be zero.
While the marginal profit going from positive to negative means that it's going through zero, going through zero doesn't necessarily mean that you're going from positive to negative; you still have to check which direction it's going. So the SOC is that the marginal profit be decreasing.
FOC: marginal profit = 0
SOC: marginal profit decreasing
If the marginal profit is decreasing, then when it hits zero, it's going from positive to negative.