# Multiple Line Items

Submit purchase orders with more than one line item using the indexed LI_ parameters.

Source: https://developer.inoviopay.com/api/line-items.html  
Markdown: https://developer.inoviopay.com/api/line-items.md

The Payment Service supports purchase orders with more than one line item. Use the Line Item Parameters: `LI_PROD_ID_X`, `LI_COUNT_X`, and `LI_VALUE_X`. The "X" indicates a dynamic number depending on how many line items you want to send.

| Parameter | Description |
|---|---|
| `LI_PROD_ID_X` (required) | Product ID for the line item. Replace 'X' with an incrementing integer. |
| `LI_COUNT_X` (required) | Quantity for the line item. Max value is 99. |
| `LI_VALUE_X` (required) | Transaction Amount for the line item. |


Capturing a single line item later (partial shipment, split fulfillment) uses `captureLineItem(order, lineItemRef, amount)` in all four SDKs, taking a `LineItemRef` from `result.lineItemRefs` (or `result.line_item_refs` in Python) rather than a raw `PO_LI_ID` string.

**cURL**

```bash
curl -X POST "https://api.inoviopay.com/payment/pmt_service.cfm" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "request_action=CCAUTHORIZE&req_username=api_user&req_password=P%40ssw0rd%21&site_id=12345&request_api_version=4.14&request_response_format=JSON&pmt_numb=4111111111111111&pmt_expiry=122026&pmt_key=123&request_currency=USD&li_prod_id_1=1001&li_value_1=19.95&li_prod_id_2=2001&li_value_2=10.50"
```

**PHP**

```php
use Inovio\Gateway\{Credentials, InovioClient};
use Inovio\Gateway\Model\{LineItem, Money, PaymentMethods};
use Inovio\Gateway\Request\TransactionRequest;

$client = new InovioClient(new Credentials('api_user', 'P@ssw0rd!', '12345'), 'SANDBOX');

$req = new TransactionRequest(
    PaymentMethods::card('4111111111111111', '122026', '123'),
    [
        new LineItem('1001', 1, Money::of('19.95', 'USD')),
        new LineItem('2001', 1, Money::of('10.50', 'USD')),
    ]
);

$result = $client->authorize($req);

match ($result->status) {
    'APPROVED' => /* $result->lineItemRefs — one LineItemRef per LI_, for later captureLineItem() */,
    'DECLINED' => /* $result->outcome->service */,
    default    => /* PENDING | RUNNING | FAILED */,
};
```

**Node**

```ts
import { InovioClient, Money, PaymentMethods } from '@inovio/gateway-sdk';

const client = new InovioClient(
  { reqUsername: 'api_user', reqPassword: 'P@ssw0rd!', siteId: '12345' },
  { environment: 'SANDBOX' }
);

const result = await client.authorize({
  paymentMethod: PaymentMethods.card('4111111111111111', '122026', '123'),
  lineItems: [
    { productId: '1001', count: 1, value: Money.of('19.95', 'USD') },
    { productId: '2001', count: 1, value: Money.of('10.50', 'USD') },
  ],
});

switch (result.status) {
  case 'APPROVED': /* result.lineItemRefs — one LineItemRef per LI_ */ break;
  case 'DECLINED': /* result.outcome.service */ break;
  default: /* PENDING | RUNNING | FAILED */ break;
}
```

**Python**

```python
from inovio_gateway import Credentials, InovioClient, Money, PaymentMethods, TransactionStatus
from inovio_gateway.model import LineItem
from inovio_gateway.request import TransactionRequest

client = InovioClient(Credentials("api_user", "P@ssw0rd!", site_id="12345"), environment="SANDBOX")

result = client.authorize(TransactionRequest(
    payment_method=PaymentMethods.card("4111111111111111", "122026", "123"),
    line_items=[
        LineItem("1001", 1, Money.of("19.95", "USD")),
        LineItem("2001", 1, Money.of("10.50", "USD")),
    ],
))

if result.status is TransactionStatus.APPROVED:
    pass  # result.line_item_refs — one LineItemRef per LI_, for later capture_line_item()
elif result.status is TransactionStatus.DECLINED:
    pass  # result.outcome.service
```

**Java**

```java
InovioClient client = new InovioClient(
    new InovioClient.Credentials("api_user", "P@ssw0rd!", "12345"));

TransactionRequest req = new TransactionRequest(
    PaymentMethods.card("4111111111111111", "122026", "123"),
    new LineItem("1001", 1, Money.of("19.95", "USD")),
    new LineItem("2001", 1, Money.of("10.50", "USD")));

TransactionResult result = client.authorize(req);

switch (result.status()) {
    case APPROVED -> { /* result.lineItemRefs() — one LineItemRef per LI_ */ }
    case DECLINED -> { /* result.outcome().service() */ }
    default -> { /* PENDING | RUNNING | FAILED */ }
}
```

**Response**

```json
{
  "REQUEST_ACTION": "CCAUTHORIZE",
  "TRANS_STATUS_NAME": "APPROVED",
  "CURR_CODE_ALPHA": "USD",
  "TRANS_VALUE": 30.45,
  "TRANS_VALUE_SETTLED": 30.45,
  "CURR_CODE_ALPHA_SETTLED": "USD",
  "TRANS_EXCH_RATE": "",
  "TRANS_ID": 3948572123,
  "CUST_ID": 9827167,
  "XTL_CUST_ID": "",
  "PO_ID": 99281742,
  "XTL_ORDER_ID": "",
  "BATCH_ID": 883929,
  "PROC_NAME": "Test Processor",
  "MERCH_ACCT_ID": 100,
  "CARD_BRAND_NAME": "Visa",
  "CARD_DETAIL": "CREDIT",
  "CARD_TYPE": "VISA BUSINESS",
  "CARD_CLASS": "CONSUMER CREDIT",
  "CARD_COUNTRY": "CRI",
  "CARD_PREPAID": 0,
  "CARD_BANK": "",
  "CARD_BALANCE": "",
  "PMT_L4": "1111",
  "PMT_ID": "",
  "PMT_ID_XTL": "",
  "PROC_UDF01": "",
  "PROC_UDF02": "",
  "PROC_AUTH_RESPONSE": "AUTH514",
  "PROC_RETRIEVAL_NUM": "7169CEF3-64EF-46BB-55A333956994D2D",
  "PROC_REFERENCE_NUM": "",
  "REQ_ID": "84729109",
  "AVS_RESPONSE": "M",
  "CVV_RESPONSE": "M",
  "REQUEST_API_VERSION": "4.14",
  "PO_LI_ID_1": "9928186",
  "PO_LI_COUNT_1": 1,
  "PO_LI_AMOUNT_1": 19.95,
  "PO_LI_PROD_ID_1": "1001",
  "PO_LI_ID_2": "9928187",
  "PO_LI_COUNT_2": 1,
  "PO_LI_AMOUNT_2": 10.5,
  "PO_LI_PROD_ID_2": "2001",
  "MBSHP_ID_1": ""
}
```
