Was bored tonight so I decided to learn PHP and make a script to work with the OfficeAutopilot API.

I was inspired by some of Jermaine Griggs stuff over at automationclinic.com

So I created a Customer Value Calculator script that does 3 things:

  • increments a custom field called ‘Number of Purchases’ by 1.
  • updates lifetime value (amount of money spent with you) by the last transaction amount
  • calculates the average transaction value (LTV divided by # of Transactions)

Admittedly simple.  But for a first stab I am pleased because it is handling something that was previously setup with a step sequence.

I made a short video here: http://screencast.com/t/F4LJuJ5vPeg It is just a quick overview of what it does.

What you’ll need to do:

1. In the OAP Field Editor create a custom Section called ‘Buying Cycles’ and add the following fields:

‘Number of Purchases’ as a numeric type.

‘Lifetime Value’ as a currency type

‘Average Transaction Value’ also as a currency type.

2. Copy the code from pastebin http://pastebin.com/m5yStBr4 and add it as a .php script to your server.

3. Add your OAP App ID and App Key (around line 63).

4. Create an Active Response rule in OAP when a contact makes a purchase to ping the url.  The script has an example of what it should be.



I make no warranty with this script.  As I said I’m just beginning to really get into PHP and Javascript programming.  That being said, the formatting is ugly and I will get that cleaned up but it is 12:40am right now and I have a conference-call filled day starting at 8AM.  Yikes!

I’d love to hear feedback on how I can make this better, more efficient and what you are doing with scripts like this for Office Autopilot or Infusionsoft.


2 thoughts on “Customer Value Calculator with OfficeAutopilot API”

    1. In the transaction info it shows ‘Last Amount’… however, I am not sure if that would be updated if you are not using the OAP payment gateway system. If you are using a 3rd party integration like UltraCart or Nanacast you might have to make a custom field to push that dollar amount into… and adjust the variable in the Ping URL.

Leave a Comment

Your email address will not be published. Required fields are marked *