> For the complete documentation index, see [llms.txt](https://tech.x2bee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tech.x2bee.com/api-guide/api-guides-en/back-office/settlement-bo/pg-approval-comparison-management.md).

# PG Approval Comparison Management

Performs comparison between the EC system's payment history and the PG company's (Inicis) approval history. Key features include PG approval comparison and PG settlement comparison, which allow adjustment for amount discrepancies and deposit confirmation/cancellation processing.

***

## Key Features

* **PG Approval Comparison**
  * Perform settlement comparison for records where the EC payment amount and the PG transaction amount are the same.
  * If the deposit amount, after considering the fee, does not match the EC expected deposit amount, adjust the other adjustment amount.
  * Deposit confirmation and confirmation cancellation processing are available.
  * Upon receiving PG settlement information, deposit confirmation is automatically processed.
* **PG Settlement Comparison**
  * From the PG approval list, perform settlement comparison for records where the EC payment amount and the PG transaction amount are the same.
  * If the deposit amount, after considering the fee, does not match the EC expected deposit amount, adjust the other adjustment amount.
  * Deposit confirmation and confirmation cancellation processing are available.
  * Upon receiving PG settlement information, deposit confirmation is automatically processed.

## Process Definition

Compares the site's payment/cancellation history with the PG company's approval/approval-cancellation history.

For records where the amount matches at approval, the deposit information and settlement information are compared.

<figure><img src="https://2999922013-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXTxKSWMmuxEkop1pvuwe%2Fuploads%2F3AwDgdMNsLjEXyWVwrMa%2F%E1%84%89%E1%85%B3%E1%86%BC%E1%84%8B%E1%85%B5%E1%86%AB.png?alt=media&#x26;token=72527f53-e2a6-4ae7-b64c-d113a896f1ca" alt=""><figcaption></figcaption></figure>

{% stepper %}
{% step %}

### PG Approval Comparison Summary Lookup

Look up summary information for the selected search conditions.

* Look up the EC approval history, PG approval history, and the difference between the two.
* Clicking each count displays the detail list.
  {% endstep %}

{% step %}

### PG Approval Comparison List Lookup

Look up the list for the selected search conditions.

* Look up information about the payment record, the EC/PG amount comparison result, and the reason for discrepancy.
* Clicking the order number navigates to the order claim processing screen.
  {% endstep %}

{% step %}

### Receive PG Approval Information

Call the Api-common server to receive the PG company's approval information.
{% endstep %}

{% step %}

### Receive PG Approval Comparison List

Retrieve and save the PG company's approval information via the PG company's API.

* Save the data if it has been received.
* Transaction numbers for which the deposit has been confirmed are excluded from saving.
  {% endstep %}

{% step %}

### Save PG Approval Comparison Discrepancy Reason

If the amount of the EC payment record and the PG company's approval record does not match (including omissions), register the reason for discrepancy.
{% endstep %}

{% step %}

### PG Settlement Comparison Summary Lookup

Look up summary information for the selected search conditions.

* Look up the EC system's payment amount, expected fee, and expected deposit amount, along with the sum of the PG company's approval amount, payment fee, and deposit amount, the sum of the adjustment amount, and the EC-PG difference.
  {% endstep %}

{% step %}

### PG Settlement Comparison List Lookup

Look up the list for the selected search conditions.

* Look up settlement information, the deposit amount difference, and the adjustment reason.
* Clicking the order number navigates to the order claim processing screen.
  {% endstep %}

{% step %}

### Receive PG Settlement Information

Call the Api-common server to receive the PG company's settlement information.
{% endstep %}

{% step %}

### Receive PG Settlement Comparison List

Retrieve and save the PG company's settlement information via the PG company's API.

* Save only valid data.
* Transaction numbers for which the deposit has been confirmed are excluded from saving.
  {% endstep %}

{% step %}

### Save PG Settlement Comparison Adjustment Reason

If a difference exists between the EC expected deposit amount and the PG deposit amount, save the adjustment reason and adjustment amount.

* The adjustment amount continues until the deposit amount difference reaches 0.
  {% endstep %}

{% step %}

### PG Settlement Comparison Deposit Confirmation/Deposit Confirmation Cancellation Processing

Deposit confirmation processing is available only for records where the deposit amount difference is 0.
{% endstep %}
{% endstepper %}

## API Function List\_PG Approval Comparison

<table><thead><tr><th width="123.4444580078125">API</th><th width="274.888916015625">Description</th><th width="93.5556640625" align="center">Server</th><th width="96.888916015625" align="center">Method</th><th>Remarks</th></tr></thead><tbody><tr><td>PG Approval Comparison Summary Lookup</td><td>Look up the summary count and total for the PG approval comparison list.</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%8A%B9%EC%9D%B8%EB%8C%80%EC%82%AC&#x26;path=getPgApprovalCompareSummary">🔗View API ></a></td></tr><tr><td>PG Approval Comparison List Lookup</td><td>Look up the PG approval comparison list.</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%8A%B9%EC%9D%B8%EB%8C%80%EC%82%AC&#x26;path=getPgApprovalCompareList">🔗View API ></a></td></tr><tr><td>Receive PG Approval Information</td><td>Receive the PG approval list for a specific date and PG company.<br>Receive PG Approval Comparison List - /api/common/v1/adjust/pgCompare/receivePgApprovalList</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%8A%B9%EC%9D%B8%EB%8C%80%EC%82%AC&#x26;path=savePgApprovalList">🔗View API ></a></td></tr><tr><td>Save PG Approval Comparison Discrepancy Reason</td><td>Save the reason for the comparison discrepancy between the PG approval record and the EC payment record.</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%8A%B9%EC%9D%B8%EB%8C%80%EC%82%AC&#x26;path=savePgApprovalCompareDscdCaus">🔗View API ></a></td></tr><tr><td>Receive PG Approval Comparison List</td><td>Receive the PG approval list for a specific date and PG company via the PG company's interface.<br>Receive PG Approval Comparison List - /api/common/v1/adjust/pgCompare/receivePgApprovalList</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%8A%B9%EC%9D%B8%EB%8C%80%EC%82%AC&#x26;path=savePgApprovalList">🔗View API ></a></td></tr></tbody></table>

## API Function List\_PG Settlement Comparison

<table><thead><tr><th width="129">API</th><th width="299.5556640625">Description</th><th width="92.4444580078125" align="center">Server</th><th width="90.22216796875" align="center">Method</th><th>Remarks</th></tr></thead><tbody><tr><td>PG Settlement Comparison Summary Lookup</td><td>Look up summary information for the PG settlement comparison list.</td><td align="center">BO</td><td align="center">POST</td><td><a href="https://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%A0%95%EC%82%B0%EB%8C%80%EC%82%AC&#x26;path=getPgAdjustCompareSummary">🔗View API ></a></td></tr><tr><td>PG Settlement Comparison List Lookup</td><td>Look up the PG settlement comparison list.</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%A0%95%EC%82%B0%EB%8C%80%EC%82%AC&#x26;path=getPgAdjustCompareList">🔗View API ></a></td></tr><tr><td>Save PG Settlement Comparison Adjustment Reason</td><td>Adjust the amount and save the reason for records with a mismatched deposit amount.</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%A0%95%EC%82%B0%EB%8C%80%EC%82%AC&#x26;path=savePgAdjustCompareAjstCaus">🔗View API ></a></td></tr><tr><td>Receive PG Settlement Information</td><td>Receive the PG settlement list for a specific date and PG company.<br>*Receive PG Settlement Comparison List - /api/common/v1/adjust/pgCompare/receivePgAdjustList</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%A0%95%EC%82%B0%EB%8C%80%EC%82%AC&#x26;path=savePgApprovalList_1">🔗View API ></a></td></tr><tr><td>PG Settlement Comparison Deposit Confirmation/Deposit Confirmation Cancellation<br>Processing</td><td>Process deposit confirmation or cancel deposit confirmation for records with a matching deposit amount.</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%A0%95%EC%82%B0%EB%8C%80%EC%82%AC&#x26;path=processDepositConfirmAndCancel">🔗View API ></a></td></tr><tr><td>Receive PG Settlement Comparison List</td><td>Receive the PG settlement list for a specific date and PG company via the PG company's interface.<br>*Receive PG Settlement Comparison List - /api/common/v1/adjust/pgCompare/receivePgAdjustList</td><td align="center">BO</td><td align="center">POST</td><td><a href="http://apibo.x2bee.com/content?bo=settlement&#x26;depth=PG%EC%A0%95%EC%82%B0%EB%8C%80%EC%82%AC&#x26;path=savePgApprovalList_1">🔗View API ></a></td></tr></tbody></table>

## Term Definitions

<table><thead><tr><th width="142.8887939453125">Term</th><th>Description</th><th data-hidden>Remarks</th></tr></thead><tbody><tr><td>PG (Payment Gateway)</td><td><p>Enables the use of various payment methods such as card payment, easy payment, bank transfer, virtual account (no-bankbook deposit), gift certificate payment, and mobile phone payment.</p><p>Stands for ‘electronic payment agency’.</p></td><td></td></tr></tbody></table>

## Other Notes

* Currently, the Inicis MID is not issued individually but a shared MID is used, so all test data is transmitted; therefore, to distinguish only X2BEE orders, only order numbers matching the X2BEE order regular expression pattern are saved when saving approval comparison and settlement comparison data.
  * Pattern.compile("^\d{4}(0\[1-9]|1\[0-2])(0\[1-9]|\[12]\d|3\[01])O\d{6}$")
* **PG Approval Comparison**
  * In the Api-common PG approval information reception API, approval information is retrieved for the MID registered at the “pg.compare” level in application.yml, for the PG company passed in the request.
  * Data and validity check by PG company upon receiving approval information
    * Inicis
      * Validity check: If the received data starts with **0001** (queried from an IP not registered on the merchant server) or **0003** (data items not configured on the merchant admin site), it is treated as an exception
      * Data: Since all records are transmitted as a String, split each approval record by \*\*"\
        "\*\* and then split each field by \*\*"|"\*\*.
  * For cancellations before settlement (same-day cancellations), no payment approval data exists in the PG approval list, so approval data is generated directly to reconcile with the EC system.
* **PG Settlement Comparison**
  * Data and validity check by PG company upon receiving settlement information
    * Inicis
      * Validity check: When the header of the received data is split, if the 21st field (error code) is “**02** (invalid date format), **03** (MID password error), **04** (IP authorization error), **99** (unknown error)”, it is treated as an exception
      * Data: Since all records are transmitted as a String, split each approval record by \*\*"\
        "\*\* and extract the actual data (rows starting with B), then split each field by \*\*"|"\*\*.
