Dwolla integration
Secure, ready-to-use payment tool that simplify how you send or receive money from anyone in the U.S.
Say goodbye to plastic cards, ATM fees, hidden charges and fine print. Dwolla empowers anyone with an internet connection to safely send money to friends or businesses.
The integration with Dwolla is similar to integration with PayPal (using callback URL). There are two main ways of using Dwolla – payment buttons and off-site gateway.
Payment buttons
Integration with payment buttons is really easy. The only need is to enable and use ‘data-redirect’ parameter. When creating a button, there is an option to set a Redirect URL. Use it to redirect customers to a PHP thank you page. As we will need to process transactions details, it must be PHP (or ASP) based.
When your thank you page is ready, place this code to it, to a part which handles output code (HTML):
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.setAccountId('Account_ID');
var sale = PostAffTracker.createSale();
sale.setTotalCost('<?php $_REQUEST['amount']; ?>');
sale.setOrderID('<?php $_REQUEST['transaction']; ?>');
sale.setProductID('<?php $_REQUEST['orderId']; ?>');
sale.setData1('<?php $_REQUEST['checkoutId']; ?>');
PostAffTracker.register();
</script>
This is all. Save your changes and your site is integrated now.
Off-site gateway
In this case, you can rely on redirect URL again, with the same params. If you do not want to rely on it you can use ‘callback’ parameter.
There are two steps to be taken. The first one is to activate the Dwolla plugin in your Post Affiliate Pro merchant panel.
The second step is to add this code to your Off-site payment form:
<input id="callback" name="callback" type="hidden" value="//URL_TO_PostAffiliatePro/plugins/Dwolla/dwolla.php" />
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.writeCookieToCustomField('callback', '', 'pap_custom');
</script>
The code goes directly to the payment form code. As you can see the callback field contains an URL pointing to your Dwolla plugin within Post Affiliate Pro. In case you already use ‘callback‘ field to point to a different URL, continue to the next step.
Off-site gateway with callback URL already used
In case your callback URL is already used for a third party application, you can use the same code from the previous step, just do not use the callback field, simply keep the original one.
To make it communicate with Post Affiliate Pro you will have to add this code to your custom callback script:
/* Post Affiliate Pro integration snippet */
$ch = curl_init();
$input = file_get_contents('php://input');
curl_setopt($ch, CURLOPT_URL, "http://URL_TO_PostAffiliatePro/plugins/Dwolla/dwolla.php?pap_custom=".$_GET['pap_custom']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json','Content-Length: '.strlen($input)));
curl_exec($ch);
/* /Post Affiliate Pro integration snippet */
This code will simply resend all the received data from Dwolla to your Post Affiliate Pro plugin for Dwolla. Make sure it is active.
Do not forget to integrate your website with the click tracking code to make it all working.