Page 1 of 1

s2member API...

PostPosted: February 6th, 2011, 6:27 pm
by protesta
I purchased Post affiliate pro 4 and need to integrate it.

Step 1 I believe i have down. I will just use the button script below and set the correct pricing and subcription variables manually. If I am corrrect this will satisfy this part of the process. The javascriptatthe bottom does not need to be in the form just on the page. That ay i canhave multiple buttons on the same page.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="" />
<input type="hidden" name="cmd" value="_xclick-subscriptions" />
<!-- Instant Payment Notification & Return Page Details -->
<input type="hidden" name="notify_url" value="http://yoursite.com/?s2member_paypal_notify=1" />
<input type="hidden" name="cancel_return" value="http://yoursite.com" />
<input type="hidden" name="return" value="http://yoursite.com/?s2member_paypal_return=1" />
<input type="hidden" name="rm" value="2" />
<!-- Configures All Of The Checkout Fields -->
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="custom" value="yoursite.com" || id="xxxxxxxxxxx" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="page_style" value="paypal" />
<input type="hidden" name="item_name" value="Bronze description and pricing details here." />
<input type="hidden" name="item_number" value="1" />
<!-- Identifies/Updates An Existing Member After Checkout -->
<input type="hidden" name="on0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0; ?>" />
<input type="hidden" name="os0" value="<?php echo S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0; ?>" />
<input type="hidden" name="modify" value="0" />
<!-- Customizes Prices, Payments & Billing Cycle -->
<!--<input type="hidden" name="amount" value="0.01" />-->
<input type="hidden" name="src" value="1" />
<input type="hidden" name="sra" value="1" />
<input type="hidden" name="a1" value="0.00" />
<input type="hidden" name="p1" value="0" />
<input type="hidden" name="t1" value="D" />
<input type="hidden" name="a3" value="0.01" />
<input type="hidden" name="p3" value="1" />
<input type="hidden" name="t3" value="M" />
<!-- Displays The PayPal® Image Button -->
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal®" />
</form>

<script type="text/javascript">
document.write(unescape("%3Cscript id=%27pap_x2s6df8d%27 src=%27" + (("https:" == document.location.protocol) ? "https://" : "http://") + "yoursite.com/system/scripts/trackjs.js%27 type=%27text/javascript%27%3E%3C/script%3E"));
</script>
<script type="text/javascript">PostAffTracker.setAccountId('default1');
PostAffTracker.setAppendValuesToField('||');
PostAffTracker.writeCookieToCustomField('xxxxxxxxxxxx');
</script>

I need help with where to place the following...

Step 2

Integration with your IPN processing script - part 1
Now the IPN callback is pointed to your script. This callback has to be forwarded also to PAP paypal.php script, which url is http://www.yoursite.com/affiliate/plugins/PayPal/paypal.php. In case, your paypal processing script is in PHP, you can use following code to accomplish that. You can place it at the beginning of your processing file.

/* PAP integration */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://yoursite.com/system/plugins/PayPal/paypal.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
curl_exec($ch);
/* end of PAP integration */

Step 3

Integration with your IPN processing script - part 2
The custom parameter is in format 3rdPartySystemValue||PapValue. In order for 3rd party system to work correctly you need to parse 3rdPartySystemValue from the custom parameter. To do this add following code right after PayPal IPN verification.

<?php
$separator = '||';
if ($_POST['custom'] != '') {
$explodedCustomValue = explode($separator, $_POST['custom'], 2);
if (count($explodedCustomValue) == 2) {
$_REQUEST['custom'] = $_POST['custom'] = $explodedCustomValue[0];
}
}
?>


All I need to know is where to put it.
your help is greatly appreciated
Thsnkyou