Image source: Getty Images.

Just a few weeks after announcing a deal with Visa (NYSE:V), PayPal (NASDAQ:PYPL) has announced a similar deal with MasterCard (NYSE:MA). The arrangement will put an end to the feud between the two companies, giving PayPal more reach in stores for lower fees while also supporting MasterCard's mobile-payments initiative and increasing its online payments volume.

PayPal previously encouraged users with a MasterCard credit card connected to their accounts to link their bank account. When customers link their bank accounts with PayPal they can transfer funds at a much lower rate through an automatic clearing house, or ACH. Not surprisingly, MasterCard didn't like that because its customers began to use their PayPal accounts for online transactions, resulting in MasterCard missing out on potential revenue.

In exchange for more preferred treatment, MasterCard will open its mobile tap tools to allow more brick-and-mortar stores to accept PayPal, and it will provide PayPal a volume discount. "With each partnership agreement that we sign, we further expand the ubiquity and value of the PayPal brand and improve our own economics," CEO Dan Schulman said in a press release announcing the deal.

Did PayPal get the better end of this deal?

In the short term, probably not

PayPal will almost certainly see a hit to its margins going forward after the deals with MasterCard and Visa. Even with the volume pricing MasterCard is providing, PayPal will pay more in fees than through ACH transfers.

The fear from investors is that after these two deals (the first with Visa, the second with MasterCard) fewer PayPal users will link their bank accounts, potentially raising rates for customers and reducing transaction volume. It's those fears that sent the stock down 7% after it announced the deal with Visa. The reaction to the MasterCard deal wasn't nearly as dramatic -- shares were practically flat the day of the announcement. But shares are still trading below their price before the Visa deal.

It's worth noting, however, that PayPal's payment fee revenue as a percentage of sales has consistently declined over the past few years. In 2013, its transaction revenue as a share of total payment volume was 3.23%. That figure fell to 3.03% in 2014, and 2.88% in 2015. Through the first half of 2016, its fees accounted for 2.73% of payment volume.

PayPal points to the addition of larger sellers and the growth of Braintree as the reasons for its declining margin on payments. Braintree, which PayPal acquired in 2013, takes care of a lot of the plumbing for online and mobile payments, reducing the amount of work necessary for developers. It also owns Venmo, the peer-to-peer payments app. The decline in margins, however, is more than made up for in increased payment volume, which was up 28% last quarter and 29% in the first quarter.

Investors should expect that rate to continue declining, possibly accelerating, after making deals with both Visa and MasterCard.

But PayPal had to do something

The digital-payments space is becoming increasingly crowded, and PayPal is quickly falling behind in in-store payments – a key aspect in its deal with MasterCard. Apple Pay, Samsung Pay, and Android Pay form a collective 23% of credit card holders who have linked a card to a digital wallet. Now, Apple Pay is launching Apple Pay on Safari, its web browser, which will compete directly with PayPal.

The deal with MasterCard not only gives PayPal a potentially larger presence in stores, but it also provides another avenue for it to profit from the growth in online and mobile commerce. Merchants using Braintree's software will be able to accept MasterPass payments. MasterPass is MasterCard's digital payment's platform. (PayPal inked similar terms with Visa's digital platform Visa Checkout.) 

Another benefit is that Venmo users who receive payments from someone using a MasterCard debit card will be able to withdraw funds immediately. Typically, users have to wait two to three days. Instant withdrawals will put Venmo on the same playing field as Square Cash, which instantly begins the transfer of cash to a user's bank account -- the whole process taking just one or two days.

Most importantly, the deal gets MasterCard and Visa on PayPal's side. With competition coming from all angles, it's in PayPal's best interest to quit feuding with the biggest payments networks and start working to fight its real competition. In the long term, PayPal should benefit from the deals, gaining share in stores and with its back-end software from Braintree.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.