All places that sell SL Access Cards accept credit/debit cards. Almost all accept cash.
You can’t buy tickets on busses or on trains. SL has a help page about buying tickets.
You can use Mobile Phone Tickets everywhere in Stockholm. Just download the official SL app for your phone. It accepts credit/debit cards and some Swedish payment methods.
You will find self-service machines at all larger stations and select smaller ones, they only accept credit/debit cards.
All the entrances to train & metro stations are manned and you can buy tickets and access cards there.
Many kiosks, or “tobacco shops” as they usually call themselves, sell SL Tickets and Access Cards without markup. Look for an SL Flag or some other mentioning of “SL Tickets”.
There are also a few SL Center‘s in Stockholm. There are 2 in Stockholm Central but there are also many Pressbyrån there that also sell the tickets. At SL Center they can answer any question that you might have about the public transportation system as well as sell you tickets.
Where to find these places
Go to SL.se/en and use the map. Choose Sales points and find nearby place.