A Coatesville man who used a software glitch to defraud eBay out of nearly $320,000 was sentenced Friday to a day in prison and four months of house arrest after he paid back the retailer by selling the items he stole.

Chad Broudy, 25, pleaded guilty last year to two counts of wire fraud after he exploited a glitch that let him over-redeem eBay’s gift cards again and again without the cards getting charged. For 2½ months, Broudy went on an epic shopping spree, paying virtually nothing for more than 3,000 items valued at roughly $320,000, according to federal prosecutors.

The sentence included restitution of $319,739 to eBay, all of which had been paid before Friday’s hearing, according to Broudy’s lawyer, Philadelphia-based attorney Andrew Montroy.

U.S. District Judge Joel Slomsky said that Broudy’s repayment in full was “of great significance” when deciding his sentence. In addition to the day in jail and the four months of house arrest, he sentenced Broudy to three years of supervised release and 200 hours of community service. Broudy must pay a $1,500 fine and a $200 special assessment, too.

“Mr. Broudy has used his skills to sell the property that he stole and to raise enough funds, which are now sitting in the clerk’s office, to pay restitution," Slomsky said, according to an audio recording of the hearing. “It shows the kind of disciplined person he is, and as someone who in my judgment has the ability to not re-offend.”

The U.S. Attorney’s Office for the Eastern District of Pennsylvania declined to comment on the sentence. Prosecutors had urged the court to put Broudy in prison for 27 to 33 months. During the hearing, Assistant U.S. Attorney Albert Glenn said Broudy’s crimes were significant and sophisticated enough to warrant a years-long sentence.

“He discovered this [glitch], but when he discovered it, he had some choices,” Glenn said. "He could have said, “OK, I better not do that. That’s wrong.' Or he could have said ‘OK, I better let eBay know and tell them that this is a problem.’ But he did neither of those. He then proceeded to exploit it, and he did it again and again and again and again. He did it 1,100 times.”

The eBay glitch would fail to deduct monetary value from a gift card when a product was purchased with both the gift card and another payment method, prosecutors said. When buying items, Broudy would put nearly all the product’s cost on the gift card, which would not get charged, and only a nominal amount on the other payment method, prosecutors said. That allowed him to buy items at virtually no cost.

Broudy bought Macs, iPhones, speakers, small gold bars, and even cash ($100 bills), court records show. He obtained a cotton candy maker, a cordless vacuum cleaner, a brass eagle statue, and a Star Trek sushi set. He sold much of his bounty, converting Xbox controllers, wine glasses, and smart thermostats into cash.

The software bug existed from fall 2016 to January 2017, court records show. Broudy was responsible for roughly a third of the loss that eBay suffered from the glitch, Glenn said during Friday’s hearing.

The company did not return requests for comment on Monday.

In letters to the court, family members described Broudy as a young man who struggled academically in college and associated himself with an “online community” that took him down a bad path. But they said he turned his life around and graduated from Penn State-Abington with good grades. He is now a support engineer for NetMedia Solutions, a Lansdale computer services firm.

“I know I made a mistake,” Broudy said Friday. “I wasn’t doing well at the time academically, mentally. It was a bad choice. It was a really bad choice. It’s affected far beyond just me. It’s affected my family.”

Broudy used four different eBay accounts and 113 gift cards to make 1,100 transactions exploiting the software glitch, according to court records. None of the eBay accounts was registered to Broudy’s complete name, but they included his last name and home address, and Broudy conducted the scheme using a computer at his Coatesville home, prosecutors said.

“Things would come in the mail frequently, but Chad said not to worry about it and that it was all purchased legally, and that he had money saved up from previous jobs he worked,” wrote Jeffrey Broudy, Chad’s older brother, in a letter to the court. “Nobody thought anything of it.”