Stripe integration
A suite of APIs that powers commerce for businesses of all sizes.
Stripe makes it easy to start accepting credit cards on the web today. The integration method uses our built in plugin for notification handling.
The integration handles orders, recurring orders and refunds as well. It also supports lifetime commissions and coupon handling.
Cookie data – order form
Each customer account in stripe has an extra field called ‘description‘. In this integration method, we are using it. The task is to add the (tracking) cookie value into the description field found in your order form. The easiest way is to add this code to your payment form:
<input type="hidden" name="pap_custom" value="" id="pap_tdx8v2s5a" />
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
PostAffTracker.writeCookieToCustomField('pap_tdx8v2s5a');
</script>
When the form is submitted (customer is ordering), you can process the form data the standard way and before creating a charge and a customer account (with Stripe_Customer::create), you have to use the pap_custom data from the submitted form and set the value as a customer description – “description” => $_POST[‘pap_custom’].
Cookie data – Stripe Checkout
If you are using the Stripe Checkout then instead of the step above you need to do this one. Essentially, what needs to be done is to add a tracking cookie value into the client-reference-id variable of Stripe’s session object. Take a look here on how to get the tracking cookie value (visitor ID).
Here is an example of a Stripe Checkout button:
<script async src="https://js.stripe.com/v3/buy-button.js">
</script>
<stripe-buy-button
buy-button-id="buy_btn_BBBBBBBBBBBBBB"
publishable-key="pk_test_XXXXXXXXXXXXXXXXXXX"
>
</stripe-buy-button>
This is how an integrated buttons would look like (the stripe button code gets added using JavaScript now):
<script async src="https://js.stripe.com/v3/buy-button.js">
</script>
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
var papCookie = '';
PostAffTracker.setAccountId('Account_ID');
try {
PostAffTracker.track();
} catch (err) { }
papCookie = PostAffTracker._getAccountId() + PostAffTracker._cmanager.getVisitorIdOrSaleCookieValue();
document.write('<stripe-buy-button buy-button-id="buy_btn_BBBBBBBBBBBBBB" publishable-key="pk_test_XXXXXXXXXXXXXXXXXXX" client-reference-id="' + papCookie + '"></stripe-buy-button>');
</script>
Cookie data – Stripe payment links
If you are using Stripe payment links then you need to pass the tracking cookie value as client_reference_id
query string parameter to the link. To be able to do that you need to assign an ID to the <a> link element, so for example you’d assign “papCookie” as the link ID so it would be:
<a id="papCookie" href="https://buy.stripe.com/2wM8yP31J6vF6wodQZ">Pay now</a>
Once you have the ID you need to execute the PostAffTracker.writeCookieToLink(‘papCookie‘, ‘client_reference_id
‘); function of the click tracking code with the link’s ID (in our example papCookie) and the name of the query string parameter which should be added (client_reference_id
), so for example like this:
<script id="pap_x2s6df8d" src="https://URL_TO_PostAffiliatePro/scripts/trackjs.js" type="text/javascript"></script>
<script type="text/javascript">
try {
PostAffTracker.setAccountId('Account_ID');
PostAffTracker.track();
PostAffTracker.writeCookieToLink('papCookie', 'client_reference_id');
} catch (err) { }
</script>
Another category of Stripe payment tools are Stripe pricing tables. It supports the use of client-reference-id so the integration of it is possible as well.
Sale tracking
The sale tracking will happen automatically, both for standard and for recurring charges. The last step is to set your Stripe to inform your Post Affiliate Pro about each charge. This is done by Stripe webhooks.
To set a webhook navigate to Developers menu section (top right) and then navigate to Webhooks. Clicking Add endpoint reveals a form to add a new URL for receiving webhooks. Enter this URL there for live notifications:
https://URL_TO_PostAffiliatePro/plugins/Stripe/stripe.php?AccountId=Account_ID
In case of events to listen to you can add invoice.payment_succeeded, charge.succeeded and charge.refunded. If you are using Stripe Checkout or Stripe payment links then you will also need checkout.session.completed event.
If you wish to track test payments as well set up the same webhook in the test mode too.
Plugin activation
The last step is to activate the built-in plugin in your Post Affiliate Pro. Do not forget to configure it after activation by adding the Secret API key or a Restricted API key. In case you’d like to use a Restricted API key you need to allow read access for these resources: Charges, Subscriptions, Checkout Sessions, Customers and Invoices.
That’s it, you are done. All the transactions will now be tracked.
Do not forget to integrate your site with the click tracking code to make it all working.
Threads by Instagram Growth Hack
To succeed on Instagram Threads, consistency, engaging with creators in your niche, interacting with followers, trying new content styles, and following successful strategies are essential. These tips can also impact the affiliate marketing industry. Start implementing them to grow your personal brand.
Instagram affiliate marketing for beginners
Instagram affiliate marketing is a lucrative way to promote products on Instagram for a commission. With the right strategies, it can create a steady income, but generally, at least 10,000 followers are recommended for maximum revenue potential. It has revolutionized the affiliate marketing industry and provides opportunities for businesses and individuals to earn income.
Learn about affiliate marketing from industry experts and access masterclasses for maximizing native ad campaigns, scaling affiliate marketing, and leveraging AI tools. Gain insights on SEO, chatGPT plugins, Facebook and Google ads, and effective copywriting strategies for successful affiliate marketing.