Complete Point Retrieval Flow

Detailed explanation of the process from opening my page to displaying points

pointsretrieval flowAPI integrationmy page
4 min read

About This Article

When a customer opens their my page, the system queries the POS for point balance behind the scenes. This process completes within seconds, allowing customers to check their points without waiting. This article explains the mechanism in detail.

Flow Overview

Step-by-Step Flow

Access my page

Customer accesses my page after login

Verify auth token

Server validates session token

Identify customer ID

Get Shopify customer ID from token

Extract member number

Extract numeric part (member number) from Shopify customer ID

Query POS

Search POS customer info with member number

Get points

Get current point balance from POS

Display on screen

Show retrieved points on my page

Step Details

Steps 1-2: Access and Authentication

Authentication Flow
Customer Browser

Access my page (sends Cookie: sessionToken)

Your Server

Token validation (expiration check, signature verification)

Result: Auth OK -> Display my page / Auth NG -> Redirect to login screen

Steps 3-4: Customer ID Processing

ID Conversion Flow
Shopify Customer ID (GraphQL format)

gid://shopify/Customer/8840734670934

Extract numeric part

8840734670934

Use for POS search

This number is used to match as POS member number

Steps 5-6: POS Query

Query to POS
Your Server

Customer search request (Member #: 8840734670934)

POS System

Customer data search

Point balance
Value1250
Expiration
Value2025/12
Member rank
ValueGold

Step 7: Display on Screen

point_balance: 1250
After Conversion (Display)1,250
Conversion ContentAdd thousand separators
point_expiry: 2025-12-31
After Conversion (Display)December 31, 2025
Conversion ContentLocal date format
member_rank: gold
After Conversion (Display)Gold Member
Conversion ContentLabel conversion

Error Handling

Possible Errors and Responses

Auth error
CauseToken expired
Display to UserGuide to login screen
Internal ResponsePrompt re-login
Customer not registered
CauseNot synced to POS
Display to UserShow 'Not registered at store'
Internal ResponseCheck sync process
POS connection error
CausePOS system failure
Display to User'Temporarily unavailable'
Internal ResponseRetry, notify admin
Timeout
CausePOS response delay
Display to User'Please try again'
Internal ResponseLog timeout

Fallback Display on Error

Example screen display on error

Show customer name while displaying error only for point section.

Customer name
ContentMr. Taro Yamada (normal display)
Point balance
Content'Currently unavailable'
Action
Content'Reload' button
Note
Content'*Can also verify at store'

Point: Even on error, other functions work and retry option is presented

Performance Optimization

Processing Time Breakdown

My page access
Duration0ms
Auth token verification
Duration~50ms
Customer ID extraction
Duration~10ms
POS API call
Duration500-800ms
Data formatting/display
Duration~50ms
Total
Duration~600ms-900ms

Bottleneck: POS API call takes most time, improvement requires POS-side response

Loading UX Optimization

Security Considerations

Mechanism to Prevent Showing Others' Points

Ownership Verification Flow
Receive request

Receive auth token (Customer A's) and target (Customer A's points)

Verify

Token's customer ID = Request's customer ID -> OK if match

Result

Match -> Return points / Mismatch -> 403 error, deny access

Benefits of This Mechanism

Customer Experience

  • Check latest points just by opening page
  • Wait time under 1 second for comfort
  • Appropriate feedback even on errors

System Perspective

  • Proper separation of authentication and authorization
  • Errors don't affect other functions
  • Performance visibility and improvement possible

Related Topics