Goldman Sachs Group Inc. has agreed to buy GreenSky Inc. for about $2.24 billion, adding to its Marcus consumer-banking platform a company that offers payment plans to customers with home-improvement projects or health-care needs.

The New York-based bank will pay 0.03 share of its common stock for each share of GreenSky, which works out to about $12.11 a share, according to a statement. When Atlanta-based GreenSky went public in 2018, Goldman was one of the lead underwriters on its initial offering at $23 a share. Now Goldman is purchasing the company today at about half that price.

Consumers, especially younger people, have flocked in recent years to buy-now, pay-later programs offered by companies including Afterpay Ltd. and Affirm Holdings Inc. Goldman is already working with Apple Inc. on a buy-now, pay-later program, people with knowledge of the matter said in July. In buying GreenSky, the bank is adding a fintech firm that works with more than 10,000 merchants to offer payment options to their customers.

Goldman’s plan for expanding its Marcus business includes drawing new customers to its mobile app and core offerings such as unsecured loans and savings accounts. It’s also making a push to have its services reside inside other platforms and corporations, similar to its credit card tie-up with Apple. The purchase of GreenSky falls somewhere between the two strategies, with Goldman acquiring customers directly by providing its services to merchants who offer them at the point of sale.

“We have been clear in our aspiration for Marcus to become the consumer-banking platform of the future, and the acquisition of GreenSky advances this goal,” Goldman Chief Executive Officer David Solomon said in the statement. “GreenSky and its talented team have built an impressive, cloud-native platform that will allow Marcus to reach a new and active set of merchants and customers.”

Banks use GreenSky’s technology to provide loans to super-prime and prime consumers, according to the statement. It services a $9 billion loan portfolio and about 4 million customers have financed more than $30 billion of purchases using its technology since GreenSky was founded by CEO David Zalik in 2006.

GreenSky’s stock had surged almost 70% this year through Tuesday. In July, the company reached a deal with the Consumer Financial Protection Bureau to resolve an inquiry into consumer complaints about unauthorized loans. GreenSky at the time had agreed to pay $2.5 million and set aside $9 million more for loan cancellations and cash redress for affected customers.

The boards of Goldman and GreenSky have already approved the acquisition. The deal, subject to approval by GreenSky stockholders, is slated to close in the fourth quarter of this year or first quarter of 2022.