RBC Capital Markets is moving to the sidelines on shares of Affirm — at least in the near-term. Analyst Daniel Perlin downgraded the buy-now-pay-later company to sector perform from outperform, citing a difficult macro environment. AFRM 1D mountain Affirm shares fall on earnings miss, layoff news He said in a Wednesday note that the “combination of higher funding costs, latency effects of pricing actions, and expected deceleration into FH2/23 [gross merchandise volume] and revenues points to a more challenging environment ahead, and although management reiterated its commitment to achieving adj. operating income as the company exits FY23, we are slightly less convinced that it will be successful.” The downgrade from RBC comes after Affirm posted a larger-than-expected loss for the fiscal second quarter and light guidance for the current period and full year. Affirm also said it’s slashing 19% of its workforce, with shares shedding more than 17% premarket. Along with the downgrade, Perlin adjusted his price target to $17 from $23 a share. The new target represents 6% upside from Wednesday’s close. To be sure, Perlin views Affirm as a leader in the BNPL market long term, but higher interest rates, increased funding costs and slowing consumer discretionary spending should temper that thesis near term. So far this year, Affirm shares have surged nearly 66% after a tough 2022 that saw the stock crater 90%. — CNBC’s Michael Bloom contributed reporting