Wallet Sharing Across Multiple WooCommerce Stores
The project involved implementing a shared wallet and seamless login between two independent WooCommerce stores.
User experience is pivotal to the success of any business. You want to make sure everything goes well for your customers, so that they have the least path of resistance when making a purchase.
Let's take this particular case for example.
The client had two WooCommerce stores- two independent stores, running on two different sites (not on WordPress multisite). However, the client wanted his customers to have a seamless shopping experience across both stores. This meant:
- when customers would register on one site, they would automatically be registered on the other site as well
- when customers would log into one site, they would be logged into the other site too (same for log out - you log out from one site, you log out from both)
- the customers would be able to use their wallet across both stores - here's where it gets interesting!
Now, in most cases, a wallet can be shared across two sites. Like a mobile wallet for example. But Mangopay, well, Mangopay is a bit different. Mangopay creates a wallet per site => 2 sites would mean, 2 wallets!
So, how did we go about creating a shared wallet?
To allow the wallet to be shared across to sites, we needed to create a single wallet per user and then share the wallet details as the user navigated between sites.
As simple as it sounds, there's personal data involved. We needed a secure way of sharing this data.
Now, the client also required a user to have seamless login across the two WooCommerce stores. Which meant, we had to somehow synchronize log in and log out across the stores. When users sign in to one of the sites, they get registered and logged in to the site. When they visits the other site, they get logged in to that site automatically. They don't need to sign in again.
By default, a Mangopay wallet is created for each user on sign up. Thus, ideally, a single wallet should be created for a user, that can be used on both the sites. However, as mentioned, Mangopay creates two different payment wallets for the same user for the two sites. Mangopay uses certain details that have to be shared between sites.
To tackle this, we used the same theory that would apply to seamless sign on.
The user authorization protocol that was used to send user data between the two sites was used to transfer details to share the Mangopay wallet.
For seamless login, the authorization platform stores customer data. We stored the additional data required by Mangopay by requesting it at the time of registration. The wallet gets created when the user registers and is stored on the authorization platform. When the user visits the other site, the details are fetched from the authorization platform account and linked to the user profile on the other site, thereby preventing the creation of another wallet for an individual user.
In theory, this strategy can be used to share list of products purchased by a user to help show related products on the other store. It can be used to share any kind of information to elevate the user's experience and boost your business.