An important part of AGSA’s digital transformation was extending their physical shop into an online space. They chose the Shopify platform to host their service and wanted to include the same discount system that their members enjoyed in the physical shop. Our task was to take the membership data from Raiser’s Edge and provide a way for the members to receive their discounts.
The conception phase of the discount mechanism involved a number of alternatives that were considered. Initially, we discussed having a unified login on the main website that would extend to the shop. However, this approach requires members to login and there was some anticipation that this would add more complexity to the system as well as more overheads for the members. Ultimately, we pushed for a simpler system that relied only on the unique identifier used for each member. This would allow a member to simply punch in their details from their membership card.
With a plan set and the data from Raiser’s Edge now in our hands, we could use Shopify’s API to create discount codes for each member. Given that memberships are created continually, we also had to build a periodic task that would automatically synchronise membership changes to Shopify. With each synchronisation, we create discount codes for new or rejoining members and we remove the codes for expired memberships.
While our integration with Shopify has gone reasonably well, we have run into an issue with the API’s usage limits. Shopify only allows a small number of calls to fetch all the discount codes created so far. Once our periodic task had run for a few days, we found that we passed that limit and the system began to crash during the initial call to the Shopify API. To work around the issue, we began to persist the state of Shopify’s discount codes locally. This added some minor complexity to the synchronisation code, but it allows us to perform the necessary checks quite cheaply. As a side-effect, the workaround has also massively boosted the performance of the synchronisation to Shopify.