🔦5. Verify payment information
Verify the payment information for secure payment service implementation.
Based on the payment information from the client, the server verifies the payment amount for fraud and saves the payment information in the database if needed. The following are the steps for verifying the payment information.
Server receives the i'mport payment ID (imp_uid) and order ID (merchant_uid)
Call the Get payment API to get the payment details.
Based on the response, compare the actual payment amount with the payment request amount (from merchant's database).
STEP 01 Server receives payment result
Example of receiving a POST request to the merchant endpoint URL that receives the payment information
STEP 02 Get payment details
Example of calling the Get payment API with the i'mport payment ID (imp_uid) to retrieve the payment info.
STEP 03 Verify payment information
Why fraud detection is necessary
Since the payment request is made on the client side, a payment request can be forged or falsified by manipulating the client script. Therefore, you must compare the original requested amount with the actual processed amount after the payment process is complete.
For example, when paying for a product that costs 100,000 won, an attacker can manipulate the client script to change the
amount
property to a value lower than the actual amount.Since you cannot prevent script manipulation on the client, you must check for fraud on the server after the payment is processed.
Example of comparing the actual payment amount with the payment request amount, performing fraud check on the payment amount, and saving the data in the DB.
The original requested amount is queried from the database with the merchant_uid
, and the actual processed amount is retrieved from the i'mport server with the imp_uid
. The two values are compared to verify that they match. If the verification is successful, the payment information is saved in the database and a response is returned based on the payment status (status
). Otherwise, an error message is returned.
The payment result must be processed on the database based on the data received through a webhook for stable processing without any missing result data.
Last updated