getPrimaryPurchase
SolvaPay SDK / react/src / getPrimaryPurchase
Function: getPrimaryPurchase()
getPrimaryPurchase(
purchases):PurchaseInfo|null
Defined in: packages/react/src/utils/purchases.ts:78
Get the primary purchase to display
Prioritization:
- Active purchases (most recent by startDate)
- null if no valid purchases
Note: Backend keeps purchases as 'active' until expiration, so we only need to check for active purchases. Cancelled purchases are still active until their endDate.
Parameters
purchases
Returns
PurchaseInfo | null