Home Integration Methods SafePay (IPN used by other script)

SafePay (IPN used by other script)

SafePay integrates using IPN callback. Use this integration if you have your own script to handle IPN callback from SafePay.
1
Enable and setup plugin
First you must enable and setup SafePay plugin in PAP4. Go to Start menu->plugins and click Enable for SafePay plugin. When enabled, click Configure. Now you must setup number of custom field you will use to sending custom cookie. Next you must set your secret passphrase from your SafePay merchant panel.
2
SafePay buttons
Now add the following code into EVERY SafePay button form
<input type="hidden" name="notifyURL" value="http://www.yoursite.com/affiliate/plugins/SafePay/notify.php">
<input type="hidden" name="custom2" value="" id="pap_dx8vc2s5">

Red number is number of custom field you entered in last step.

After form add this code:

<script id="pap_x2s6df8d" src="http://www.yoursite.com/affiliate/scripts/notifysale.php" type="text/javascript">
</script>


3
Example form button
<form action="https://www.safepaysolutions.com/index.php" method="post">
<input type="hidden" name="_ipn_act" value="_ipn_payment">
<input type="hidden" name="fid" value="a8966ef75849cd589a5c2e80310986">
<input type="hidden" name="itestmode" value="off">
<input type="hidden" name="notifyURL" value="http://www.yoursite.com/affiliate/plugins/SafePay/notify.php">
<input type="hidden" name="returnURL" value="https://mydomain.com/thankyou.html">
<input type="hidden" name="cancelURL" value="https://mydomain.com/cancelled.html">
<input type="hidden" name="notifyEml" value="webmaster@mycompany.com">
<input type="hidden" name="iowner" value="MerchantSupplierUsername">
<input type="hidden" name="ireceiver" value="MerchantSupplierUsername">
<input type="hidden" name="iamount" value="199.95">
<input type="hidden" name="itemName" value="Test E-Product">
<input type="hidden" name="itemNum" value="1">
<input type="hidden" name="idescr" value="The perfect description for my product!">
<input type="hidden" name="idelivery" value="3">
<input type="hidden" name="iquantity" value="1">
<input type="hidden" name="imultiplyPurchase" value="n">
<input type="hidden" name="custom2" value="" id="pap_dx8vc2s5">
<input type="hidden" name="colortheme" value="LightBlueYellow">
<input type="image" src="https://www.safepaysolutions.com/images/xpmt_paybutton_2.gif" alt="Pay through SafePay Solutions">
</form>
<script id="pap_x2s6df8d" src="http://www.yoursite.com/affiliate/scripts/notifysale.php" type="text/javascript">
</script>
4
Integration script
Now the IPN callback is pointed to your script. This callback has to be forwarded also to PAP4 safepay.php script, which url is http://www.yoursite.com/affiliate/plugins/SafePay/safepay.php. In case, your safepay processing script is in PHP, you can use following code to accomplish that. You can place it at the beginning of your processing file.
This will ensure that whole IPN callback will be forwarded without affecting your original script.