Without seeing all the code as to what functions you're calling I cant say if it's right but the logic is correct.
I would first call this to get all the reseller's accounts:
Code:
/xml-api/listaccts?searchtype=owner&search=$resellerusername
Then from that data, you have the username of each account owned by the reseller.
You can then loop through all the usernames (mid you I'm a perl guy):
Code:
foreach my $username (%usernames){
/xml-api/suspendacct?user=$username&reason=customer%20of%20$resellerusername
}
Noting that I haven't specified how to call the XML API above. I usually do it with Net::SSLeay on Perl.