# vcode

<mark style="color:red;">**vcode**</mark> is to ensure the data integrity passed from merchant-end (either website or mobile APP) to the payment page to avoid man-in-the-middle (MITM) attack. It uses “Verify Key”(like a public key) in combination with the data string for hashing purposes.<br>

It becomes mandatory for each transaction if “Enable Verify Payment” is activated in merchant profile as shown:-

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXepFZH4vz_ea4Abj3MtxYoikPq_A7M8BEQ1hrwUggH86zdnnKfe0173nUxBl6skhrhs8LemuhotBI6s_ulF4ycRftFIOyJNcxUVPJHveWdA_B8awwfJ_G0K1irafdcKh-k0RTECHQSp6Pp5McMWJJMdiqYaFt0ZFgkdS9DjchWNqjACwTKfslk?key=YOQU3AbjLOhXrKaT0sW92g" alt=""><figcaption></figcaption></figure>

<mark style="color:red;">**vcode**</mark> was encrypted using MD5 encryption hash function and consists of the following information (must be set in the following orders) :

1. Transaction amount
2. Merchant ID
3. Order ID
4. Verify Key

Formula to generate <mark style="color:red;">**vcode**</mark>

vcode = md5( amount & merchantID & orderID & verify\_key )<br>

**Example to generate vcode for PHP developer**

```php
<?php
 
$amount 	= “27.60”;
$merchantID = “ACME”;
$orderid    = “OD8842”;
$verifykey = “xxxxxxxxxxxxxxxxxx”;
// Replace xxxxxxxxxxxxxxxxxx with your Verify Key
 
// vcode formula
$vcode  	= md5( $amount.$merchantID.$orderid.$verifykey );
 
// output of the vcode based on above information equals to :
$vcode  	= “ec7f2c6e85769728a5e9b75893ee6bc1”;
 
?>
```

**Verification tool for vcode**

To verify whether the <mark style="color:red;">**vcode**</mark> generated is correct, merchant may check on this URL:-

<https://api.e2pay.co.id/RMS/query/vcode.php>

<br>

**What happens if a merchant passes in an incorrect&#x20;***<mark style="color:red;">**vcode**</mark>***?**&#x20;

An error will be displayed on the payment page as shown:-

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdGaT9kJyKT62PQk_h8ws1NkFRQ5RLddbXJPtSXsJ1fxOlivX-aFBe1-FO5tfldLYXU8GtX85tm7FUN5-yMNsHvNLbTvxAx0JkoUgKb7OmEb-a_LFnfL-4ifTbd4lVdO07nJsfoZwRLdfnCB_p89G_3WYhzhEXj5rti9T6WtfZBzyoJNbwX-mY?key=YOQU3AbjLOhXrKaT0sW92g" alt=""><figcaption></figcaption></figure>
