Checking access…

Skip to main content
Audience: CCG Platform Engineers

IIAS β€” Processing

Platform engineers implementing or verifying the IIAS proration calculation. See IIAS Payments for the merchant-facing contract this page backs β€” merchants don't need this formula; CCG computes it and returns the result in the response.

Processing detail for the IIAS Payments developer page.

CCG does not have any information on whether the processed cards are healthcare cards (FSA or HSA) or not. CCG simply receives the IIAS data provided by the merchant, validates it against the rules enforced by the payment processor, splits the IIAS info across payment allocations using the distribution formula below (split-tender only β€” single-tender IIAS is applied as-is), and passes the IIAS information to Stripe.

Distribution Formula​

For equal split payments (both payment methods eligible for IIAS), CCG calculates IIAS amounts proportionally using the following abbreviations:

  • QA = Qualified Amount
  • PA = Prescription Amount
  • VA = Vision Amount

Step 1: Calculate Total Amount and Split Ratio

totalAmount = paymentAllocation1_amount + paymentAllocation2_amount
splitRatio = paymentAllocation1_amount Γ· totalAmount

Step 2: Prorate IIAS Amounts for First Allocation

paymentAllocation1_QA = round(QA * splitRatio)
paymentAllocation1_PA = round(PA * splitRatio)

if totalAmount = QA + VA:
paymentAllocation1_VA = paymentAllocation1_amount - QA
else:
paymentAllocation1_VA = round(VA * splitRatio)

Step 3: Calculate Remaining Amounts for Second Allocation

paymentAllocation2_QA = QA - paymentAllocation1_QA
paymentAllocation2_PA = PA - paymentAllocation1_PA
paymentAllocation2_VA = VA - paymentAllocation1_VA
tip

The IIAS distribution calculation in the Convenient Checkout API ensures that qualified, prescription, and vision amounts are always properly aggregated across multiple payments. This guarantees:

  1. Qualified Amount Accuracy: Total qualified amount is the sum of all individual paymentAllocation's qualified amounts
  2. Prescription Amount Accuracy: Total prescription amount is the sum of all individual paymentAllocation's prescription amounts
  3. Vision Amount Accuracy: Total vision amount is the sum of all individual paymentAllocation's vision amounts

Worked Computation Examples​

Example 1: Equal Distribution of Payment Allocations
// merchant/user provided paymentAllocation amount(s)
paymentAllocation1_amount = 300; paymentAllocation2_amount = 300
// merchant provided IIAS info
qualifiedAmount = 400, prescriptionAmount = 100, visionAmount = 200

// compute total amount
totalAmount = 300 + 300 = 600

// compute splitRatio
splitRatio = 300 / 600 = 0.5

// compute IIAS for paymentAllocation1
paymentAllocation1_QA = round(400 * 0.5) = 200
paymentAllocation1_PA = round(100 * 0.5) = 50
paymentAllocation1_VA = round(200 * 0.5) = 100

// compute IIAS for paymentAllocation2
paymentAllocation2_QA = 400 - 200 = 200
paymentAllocation2_PA = 100 - 50 = 50
paymentAllocation2_VA = 200 - 100 = 100
Example 2: Equal Distribution of qualifiedAmount & visionAmount
// merchant/user provided paymentAllocation amount(s)
paymentAllocation1_amount = 471; paymentAllocation2_amount = 529
// merchant provided IIAS info
qualifiedAmount = 500, prescriptionAmount = 400, visionAmount = 500

// compute total amount
totalAmount = 471 + 529 = 1000

// compute splitRatio
splitRatio = 471 / 1000 = 0.471

// compute IIAS for paymentAllocation1
paymentAllocation1_QA = round(500 * 0.471) = 236
paymentAllocation1_PA = round(400 * 0.471) = 188
paymentAllocation1_VA = 471 - 236 = 235

// compute IIAS for paymentAllocation2
paymentAllocation2_QA = 500 - 236 = 264
paymentAllocation2_PA = 400 - 188 = 212
paymentAllocation2_VA = 500 - 235 = 265
Example 3: Without Vision Amount
// merchant/user provided paymentAllocation amount(s)
paymentAllocation1_amount = 330; paymentAllocation2_amount = 400
// merchant provided IIAS info
qualifiedAmount = 550, prescriptionAmount = 321, visionAmount = 0

// compute total amount
totalAmount = 330 + 400 = 730

// compute splitRatio
splitRatio = 330 / 730 = 0.45205479

// compute IIAS for paymentAllocation1
paymentAllocation1_QA = round(550 * 0.45205479) = 249
paymentAllocation1_PA = round(321 * 0.45205479) = 145
paymentAllocation1_VA = round(0 * 0.45205479) = 0

// compute IIAS for paymentAllocation2
paymentAllocation2_QA = 550 - 249 = 301
paymentAllocation2_PA = 321 - 145 = 176
paymentAllocation2_VA = 0 - 0 = 0
Example 4: Big Ratio Difference
// merchant/user provided paymentAllocation amount(s)
paymentAllocation1_amount = 119; paymentAllocation2_amount = 3
// merchant provided IIAS info
qualifiedAmount = 111, prescriptionAmount = 87, visionAmount = 11

// compute total amount
totalAmount = 119 + 3 = 122

// compute splitRatio
splitRatio = 119 / 122 = 0.97540984

// compute IIAS for paymentAllocation1
paymentAllocation1_QA = round(111 * 0.97540984) = 108
paymentAllocation1_PA = round(87 * 0.97540984) = 85
paymentAllocation1_VA = round(11 * 0.97540984) = 11

// compute IIAS for paymentAllocation2
paymentAllocation2_QA = 111 - 108 = 3
paymentAllocation2_PA = 87 - 85 = 2
paymentAllocation2_VA = 11 - 11 = 0
Example 5: Both Round Up Overflow By +1
// merchant/user provided paymentAllocation amount(s)
paymentAllocation1_amount = 50; paymentAllocation2_amount = 50
// merchant provided IIAS info
qualifiedAmount = 51, prescriptionAmount = 30, visionAmount = 49

// compute total amount
totalAmount = 50 + 50 = 100

// compute splitRatio
splitRatio = 50 / 100 = 0.5

// compute IIAS for paymentAllocation1
paymentAllocation1_QA = round(51 * 0.5) = 26
paymentAllocation1_PA = round(30 * 0.5) = 15
paymentAllocation1_VA = round(49 * 0.5) = 25

// compute IIAS for paymentAllocation2
paymentAllocation2_QA = 51 - 26 = 25
paymentAllocation2_PA = 30 - 15 = 15
paymentAllocation2_VA = 49 - 25 = 24
Example 6: Very Small Amount
// merchant/user provided paymentAllocation amount(s)
paymentAllocation1_amount = 1; paymentAllocation2_amount = 1
// merchant provided IIAS info
qualifiedAmount = 1, prescriptionAmount = 0, visionAmount = 1

// compute total amount
totalAmount = 1 + 1 = 2

// compute splitRatio
splitRatio = 1 / 2 = 0.5

// compute IIAS for paymentAllocation1
paymentAllocation1_QA = round(1 * 0.5) = 1
paymentAllocation1_PA = round(0 * 0.5) = 0
paymentAllocation1_VA = round(1 * 0.5) = 1

// compute IIAS for paymentAllocation2
paymentAllocation2_QA = 1 - 1 = 0
paymentAllocation2_PA = 0 - 0 = 0
paymentAllocation2_VA = 1 - 1 = 0