This integration is for payment buttons of gateway called PayU (former PagosOnline). The integration is achieved by using extra field and notification URL.

The notifications are handled by PayU PagosOnline plugin, which you have to activate in Post Affiliate Pro merchant panel, in Plugins section.

1.

Modify your button

The integration is performed by adding an extra code to your existing button, so there has to be one already placed somewhere at your website. The gateway allows you to use two extra fields. If you already use both of them for other purpose, please skip to step 2.
Using the unused extra field (extra1, extra2 or extra3), add this code to your button code:

<input type="hidden" name="extra1" value="" id="pap_dx8vc2s5" />

<script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/notifysale.php" type="text/javascript">
</script>

In case you are using more than one button at the same page, please the script code only once at the page. You will decrease page load that way.

2.

In case you already use both extra fields

In case you already use all extra fields, you have to use different approach instead of the one from step 1 - add id="pap_ab78y5t4a" to an existing extra data field and then add this code to the button (once per page):

<script id="pap_x2s6df8d" src="http://URL_TO_PostAffiliatePro/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
PostAffTracker.setAppendValuesToField('||');
PostAffTracker.writeCookieToCustomField('pap_ab78y5t4a');
</script>

Make sure you define the same extra data number in your plugin and also the same separator value. As you can see, in this example we are using double pipe: ||

3.

Notification URL

If your button is already using a parameter confirmationUrl then you can skip this step.

Add this code to your button:

<input type="hidden" name="confirmationUrl" value="http://URL_TO_PostAffiliatePro/plugins/PagosOnline/pagosonline.php" />

4.

If you skipped step 3

If you skipped step 3 it means you already have the notification URL defined in your button. To make sure all response data will be sent to your Post Affiliate Pro plugin, edit the file which confirmationUrl points to. Add this code to the place which is processed in the file as first:

/* PAP integration */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
"http://URL_TO_PostAffiliatePro/plugins/PagosOnline/pagosonline.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
curl_exec($ch);
/* end of PAP integration */

5.

In case you followed step 2

In case you followed step 2, it means you are already using extra fields for other applications. The final step is to ensure your application will not use data which Post Affiliate Pro appended there using separator you've chosen.
Place the code to a place where your script did not use the extra value yet, so you can modify it first and then let the script use correct value:

$separator = '||';
    if ($_POST['extra1'] != '') {
      $explodedCustomValue = explode($separator, $_POST['extra1'], 2);
          if (count($explodedCustomValue) == 2) {
            $_REQUEST['extra1'] = $_POST['extra1'] = $explodedCustomValue[0];   
      }
    }

In our example we are using extra1 field and the same separator value as from the step 2 - two pipes. Make sure you use the correct values in your code.


Do not forget to integrate your website with the click tracking code to make it all working.