# Notify URL with IPN

**Direct payment status notification** is a **back-end instant update mechanism** that sends over the payment status notification from gateway directly to the merchant server or system, without relying on any user agent such as web browser or mobile application.

**Notify URL script is similar to return URL script but,** no output is required for front-end user interface. This is also known as background URL.

## Implementation:

**Step 1:** Login to merchant admin and go to merchant profile, fill in the Notify URL. Notify URL with IPN can be activated for better merchant-payment system communication. Choose “Yes” to “Enable Notify URL with IPN”, as shown:-

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

**Step 2:** Merchant to prepare a Notify URL script, which is similar to return URL script.

**Step 3:** If IPN is disable please ignore this step. Merchants have to echo back all the POST variables with one additional variable, i.e. “treq” with value 1. PHP sample code is provided below.

**URL:** [https://pg.e2pay.co.id/RMS/API/chkstat/returnipn.php](https://pay.merchant.razer.com/RMS/API/chkstat/returnipn.php)

### Notification Parameters (via POST method)

| Variable / Parameter | Type Format / Max Length              | Description / Example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| -------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| nbcb                 | 1 digit numeric                       | Always equal to 2, which indicates this is a notification from PG                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| amount               | 2 decimal points numeric value        | The total amount paid or to be paid for Fiuu Cash payment request                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| orderid              | alphanumeric, 32 characters           | Invoice or order number from merchant system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| tranID               | integer, 10 digits                    | Unique transaction ID for tracking purpose                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| domain               | alphanumeric, 32 chars                | Merchant ID in PG system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| status               | 2-digit numeric value                 | <p>00 for Successful payment</p><p>11 for failed status</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| appcode              | alphanumeric, 16 chars                | Bank approval code. Mandatory for card payment. Certain channels return empty value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| error\_code          | alphanumeric                          | Refer to the Error Codes section.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| error\_desc          | text                                  | Error message or description.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| skey                 | 32 chars hexadecimal string           | This is the data integrity protection hash string. Refer skey section for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| currency             | 2 or 3 chars (ISO-4217) currency code | Default currency is IDR (indicating Indonesia Rupiah) for Indonesia channels                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| channel              | predefined string in system           | Channel references for merchant system                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| paydate              | Date/Time( YYYY-MM-DD HH:mm:ss)       | Date/Time of the transaction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| extraP\*             | optional (on request)                 | <p>JSON encoded string or array</p><p><br></p><p>token: 16-digit card token for merchant to store for recurring MIT (merchant initiated transaction)</p><p><br></p><p>fraudscreen: 1-digit integer, i.e. 1=Unknown, 2=Passed, 3=Alert, 4=Suspicious, 5=Fraud</p><p><br></p><p>ccbrand: Visa, MasterCard, AMEX</p><p><br></p><p>cclast4: Last 4-digit of card number<br><br>cctype: Credit, Debit, Prepaid</p><p><br></p><p>ProcessorResponseCode : Authorization response code</p><p><br></p><p>ProcessorCCVResponse : Credit Card validation response code</p><p><br></p><p>AvsStreet : Street validation status</p><p>AvsZip : Zip/Postcode validation status</p><p>AvsResponse : Association validation status   </p><p>ECI : Electronic commerce indicator </p> |

\*Note: Values are not URL encoded

### Example of Notify URL with IPN script for PHP

```php
<?php

$sec_key ="xxxxxxxxxx"; //Replace xxxxxxxxxx with Secret_Key

$_POST[treq]    =	1; // Additional parameter for IPN. Value always set to 1. 

/********************************
*Don't change below parameters
********************************/
$nbcb 	        =	$_POST['nbcb'];
$tranID 	=	$_POST['tranID'];
$orderid 	=	$_POST['orderid'];
$status 	=	$_POST['status'];
$domain 	=	$_POST['domain'];
$amount 	=	$_POST['amount'];
$currency 	=	$_POST['currency'];
$appcode 	=	$_POST['appcode'];
$paydate 	                  =	$_POST['paydate'];
$skey 	                  =	$_POST['skey'];
 
/***********************************************************
* Snippet code in purple color is the enhancement required
* by merchant to add into their notification script in order to
* implement backend acknowledge method for IPN
************************************************************/
while ( list($k,$v) = each($_POST) ) {
  $postData[]= $k."=".$v;
}
$postdata	= implode("&",$postData);
$url 		= "https://pg.e2pay.co.id/RMS/API/chkstat/returnipn.php";
$ch 		= curl_init();
curl_setopt($ch, CURLOPT_POST			, 1         );
curl_setopt($ch, CURLOPT_POSTFIELDS		, $postdata );
curl_setopt($ch, CURLOPT_URL			, $url      );
curl_setopt($ch, CURLOPT_HEADER		        , 1         );
curl_setopt($ch, CURLINFO_HEADER_OUT            , TRUE      );
curl_setopt($ch, CURLOPT_RETURNTRANSFER 	, 1         );
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER 	, FALSE     );
curl_setopt($ch, CURLOPT_SSLVERSION             , 6         );  // use only TLSv1.2
$result = curl_exec( $ch );
curl_close( $ch );

/***********************************************************
* To verify the data integrity sending by PG
************************************************************/
$key0 = md5( $tranID.$orderid.$status.$domain.$amount.$currency );
$key1 = md5( $paydate.$domain.$key0.$appcode.$sec_key );
if( $skey != $key1 ) $status= -1; // Invalid transaction
if ( $status == "00" ) {
  if ( check_cart_amt($orderid, $amount) ) {
    // write your script here .....
  }
} else {
  // failure action
}

?>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://e2payprod.gitbook.io/payment-gateway/api-documentation/technical-doc-of-fiuu-id/payment-response-parameter/payment-status-notification-merchant-webhook-or-the-3-endpoints/notify-url-with-ipn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
