> ## Documentation Index
> Fetch the complete documentation index at: https://developers.ligdicash.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Parsing custom_data in the callback

> How to extract your transaction_id from custom_data, and why external_id is the recommended shortcut.

The `custom_data` field in the callback is an array of objects. Each entry matches a field you passed at transaction creation. LigdiCash automatically adds its own entries — always filter by `keyof_customdata` to extract your own.

## Structure of custom\_data

```json theme={null}
"custom_data": [
  {
    "keyof_customdata": "transaction_id",
    "valueof_customdata": "ART5A7044E5",
    "datecreation_customdata": "2026-05-09 07:20:23.362788"
  },
  {
    "keyof_customdata": "hash",
    "valueof_customdata": "f918c54d54cdc334ade09f8c228a224b1d3df646250c84dcdd99af528ddcd450",
    "datecreation_customdata": "2026-05-09 07:20:23.362788"
  },
  {
    "keyof_customdata": "logfile",
    "valueof_customdata": "2026050907202369fee03756652",
    "datecreation_customdata": "2026-05-09 07:20:23.362788"
  }
]
```

LigdiCash always adds `hash` and `logfile` to your array. Do not rely on the index or the order of entries — always filter by `keyof_customdata`.

## Extracting your transaction\_id

```javascript theme={null}
function getCustomValue(customData, key) {
  const entry = customData.find(e => e.keyof_customdata === key);
  return entry ? entry.valueof_customdata : null;
}

const transactionId = getCustomValue(payload.custom_data, 'transaction_id');
```

```php theme={null}
function getCustomValue(array $customData, string $key): ?string {
    foreach ($customData as $entry) {
        if ($entry['keyof_customdata'] === $key) {
            return $entry['valueof_customdata'];
        }
    }
    return null;
}

$transactionId = getCustomValue($payload['custom_data'], 'transaction_id');
```

## The external\_id field

`external_id` is a concatenation of the values of all `custom_data` fields whose key contains `"id"`. If your `custom_data` contains only one field with `"id"` in the name (e.g. `transaction_id`), `external_id` will match its value. But if several keys contain `"id"`, their values will be concatenated — which makes it unreliable for identifying the transaction.

<Warning>
  Do not rely on `external_id` as a unique identifier. Always parse `custom_data` directly with `keyof_customdata` to extract your `transaction_id` reliably.
</Warning>

## Related pages

* [Payin payload](/en/payment-api/callback/payin-payload)
* [Securing the callback](/en/payment-api/callback/security)
* [The transaction\_id pattern](/en/concepts/transaction-id-pattern)
