Skip to main content
Vindicia Knowledge Center

Display CB4E product offers for purchase on the Merchants online storefront (CB4E-2-001)

User Story

As a Merchant System, I need to keep a local copy of products and billing plans so that the user experience is optimized during the checkout process.

Use Case #: CB4E-2-001

Estimated Completion Time:  < 5 Days

Uses: CashBox APIs

Completed By: Merchant Developer

Prerequisites

Pre-Condition

  • Products and BillingPlans have been created in CashBox.

Post-Condition

  • Products and BillingPlans are available in the merchant's local data store. 

Basic Scenario

  1. Establish a local data cache of the product catalog (products, billing plans and campaigns).
  2. Create an API to enable easy access to the local cache for your storefront.
  3. Create a trigger mechanism or scheduled task to update the local data cache.

Design Approach

Use the CashBox REST endpoints to get the Products, Billing Plans and Campaign to establish a regularly updated local cache.  Use the cache to display products with pricing, currency, and terms during the customer checkout process. Using a local cache avoids the latency caused by retrieving this data directly from CashBox during checkout.Enable a CashBox administrative users to update the local cache on demand when modifications to the product catalog are made.

  • Note the matrix of products and billing plans is the sole responsibility of the merchant. CashBox does not enforce associations between products and billing plans.
  • Even if a merchant’s initial product and billing plan offerings are limited, the local caching procedure allows for future expansion of offerings without impacting the customer checkout experience.

CashBox REST Endpoints (prodtest):  

https://api.prodtest.vindicia.com/products
https://api.prodtest.vindicia.com/billing_plans
https://api.prodtest.vindicia.com/campaigns

Sequence Diagram

CB4E-2-001-wsd.png

Use Case Implementation

Note Increase limit attribute if necessary to manage a higher volume of results.

  1. Create a scheduled task with that calls the products endpoint and establishes a local cache. Vindicia recommends that you refresh the cache at least once every 24 hours to catch any changes to the products. Set limit to 10 to return ten results per page.
  2. Create a scheduled task with that calls the billing_plans endpoint and establishes a local cache. Vindicia recommends that you refresh the cache at least once every 24 hours to catch any changes to the billing plans. Set limit to 10 to return ten results per page.
  3. Create a scheduled task with that calls the campaigns endpoint and establishes a local cache. Vindicia recommends that you refresh the cache at least once every 24 hours to catch any changes to the campaigns. Set limit to 10 to return ten results per page. 
  4. Create a scheduled task to refresh the cache, or provide a mechanism to trigger a rebuild of the cache
  5. Create an API to access the cache contents from your storefront 

Sample Code

Calling the products endpoint for all products 

Calling the billing_plans endpoint

For an example of how to implement this use case using AWS How to implement a Product Catalog cache with AWS.