💸Payment cancellation (refund)
Learn how to cancel a payment using the i'mport payment cancel API.
STEP 01. Request cancellation
<button onclick="cancelPay()">Request Refund</button>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script><!-- jQuery CDN --->
<script>
function cancelPay() {
jQuery.ajax({
"url": "{URL to receive refund request}", // Example: http://www.myservice.com/payments/cancel
"type": "POST",
"contentType": "application/json",
"data": JSON.stringify({
"merchant_uid": "{Order ID}", // Example: ORD20180131-0000011
"cancel_request_amount": 2000, // Refund amount
"reason": "Testing payment refund" // Reason for the refund
"refund_holder": "Jone Doe", // [required for virtual account refund] refund account holder's name
"refund_bank": "88" // [required for virtual account refund] refund account bank code (e.g. Shinhan Bank is 88 for KG Inicis)
"refund_account": "56211105948400" // [required for virtual account refund] refund account number
}),
"dataType": "json"
});
}
</script>STEP 02. Get payment information
STEP 03. Request refund to i'mport server
The following example requests a refund.
STEP 04. Save refund result
After the refund process is completed, save the result in the database as follows:
STEP 04. Handle response for refund request
Last updated