ReCharge (Shopify) integration
Specific integration for ReCharge is no longer needed. Please use the regular Shopify integration instead!
ReCharge platform allows you to add recurring subscription products to your Shopify store. This guide explains how to integrate ReCharge with Post Affiliate Pro to track these recurring payments.
To track recurring payments you either need the Recurring Commissions feature or the Lifetime Commissions plugin activated in your Post Affiliate Pro!
The integration process depends on if the store uses ReCharge Checkout on Shopify or Shopify Checkout.
Customers who installed ReCharge after November 2nd 2020 use Shopify Checkout and customers who installed ReCharge before November 2nd 2020 use ReCharge Checkout on Shopify. You can confirm your store’s checkout type also directly in the ReCharge admin panel in your store -> Settings (wrench icon) -> Store (My account) -> Account status. Click here for more details.
If your store uses Shopify Checkout you need to create an API token as described in step 1. and configure the ReCharge webhook handling plugin as described in step 2. Then proceed to integrate your Shopify store as described in this guide. You don’t need to do steps 3. and 4. below.
If your store uses ReCharge Checkout on Shopify you need to follow all four steps described below.
Create API token
As a first step, you’ll need to contact ReCharge to request access to API. Click here for more details.
Once you are granted API access, you can create your API token. To do so, log in to your Shopify admin panel, go to the Apps section and click on Recurring Billing by ReCharge so you get to the ReCharge panel.
Once there, click on the Integrations tab in the top menu, in this section click on Enabled integrations, and then on API tokens. On the right edge of the page. Afterward, click on Create an API token.
Name the API token however you want, add an email where you will be notified if the webhook should be failing, and most importantly make sure you add Read access permission to Orders. If you can also see the Webhooks permission there, please set it to Read and Write access, however this might have been removed and therefore is no longer needed to be set.
Save the token and copy its API key.
Configure ReCharge webhook handling plugin
The next step is to log into your Post Affiliate Pro merchant panel, go to Configuration -> Plugins and activate the plugin called ReCharge webhook handling. Once it’s active, click the Configure button and add the Recharge API key on the plugin configuration page. On this page, you can also configure what exactly will be tracked as Product ID, and you can also choose if you want to track any additional order data in the extra data fields. When you are finished, save the plugin config at the bottom of the page.
Edit your thank you page
If your store uses ReCharge Checkout on Shopify as described above, log in to your Shopify admin panel, go to the Apps section and click on Recurring Billing by ReCharge to get to the ReCharge admin panel. Once there, click on the Settings (wrench icon) in the upper right corner and go to the Checkout section. Scroll down to the Thank you page section and paste the following code into the Additional & scripts and trackers field:
<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 discountMultiplier = 1 - {{total_discounts}} / ({{subtotal_price}} + {{total_discounts}});
{% for item in line_items %}
var itemPrice = {{item.price}} * {{item.quantity}};
var sale{{ loop.index }} = PostAffTracker.createSale();
sale{{ loop.index }}.setTotalCost(itemPrice * discountMultiplier);
var subscriptionId = '{{item.subscription_id}}';
if (subscriptionId != '') {
sale{{ loop.index }}.setOrderID(subscriptionId);
} else {
sale{{ loop.index }}.setOrderID('{{id}}({{ loop.index }})');
}
sale{{ loop.index }}.setProductID('{{item.product_id}}');
sale{{ loop.index }}.setCoupon('{{discount_code}}');
{% endfor %}
PostAffTracker.register();
</script>
If you wish to save customer name or email you can add the following lines:
sale{{ loop.index }}.setData1('{{email}}');
sale{{ loop.index }}.setData2('{{first_name}} {{last_name}}');
under the:
sale{{ loop.index }}.setCoupon('{{discount_code}}');
You can find more available variables in ReCharge knowledgebase.
Click tracking
Log in to your Shopify admin panel, go to the Online store section, and click on Themes. In this section click on the Actions button in your Live theme preview, and choose Edit code from the drop-down menu.
In the Layout directory, find a file called theme/liquid. Insert the click tracking code from your Post Affiliate Pro merchant panel -> Tools -> Integration -> Clicks tracking right above </BODY> tag in this file and save it.
Effortlessly integrate Shopware with Post Affiliate Pro to enhance your e-commerce platform. Our easy-to-use plugins for Shopware 5 and 6 simplify click and sale tracking. Benefit from per-product commissions, discount coupons, and lifetime commissions. Download, install, and configure quickly to boost your affiliate marketing strategy. Visit us now to learn more!
Effortlessly integrate your e-commerce site with Post Affiliate Pro and boost your affiliate program's success. Our expert team ensures seamless integration with your payment processor, handling technical issues along the way. Enjoy a free trial and free integration service, saving you time and maximizing your ROI. Join now and experience top-notch affiliate management with over 500 integration options.