đŸ›Ŧ6. Complete payment

Complete the payment process by returning the result (success/failure) to the user.

In a typical PC-environment payment processed using an iframe, the payment response can be received via a callback function. When the result processing is completed on the merchant server, the result message is returned depending on the success of the payment as shown in the following example.

client-side
IMP.request_pay({
    /* ...Omitted... */
  }, function (rsp) { // callback
    if (rsp.success) { // payment successful: payment accepted or virtual account issued
        // jQuery HTTP request
        jQuery.ajax({
          /* ...Omitted... */
        }).done(function(data) { // response processing
          switch(data.status) {
            case: "vbankIssued":
              // Virtual account issued
              break;
            case: "success":
              // Payment successful
              break;
          }
        });
    } else {
      alert("Payment failed. Error message: " +  rsp.error_msg);
    }
  });

In a typical mobile environment payment processed by redirecting to a new page, process the payment complete message from the merchant endpoint URL set in the m_redirect_url parameter.

error_msg and error_code definitions

These parameters are returned as a response when the payment fails and they contains the same values returned from the PG without additional processing. Note that we don't yet provide definitions for the error codes and error messages that have accumulated in our system.

Last updated