Using the Ontraport API for a Taxable Monthly Subscription with a Trial Period and Recurring Invoice

I recently had to work out how I would use the Ontraport API (specifically the process Manual endpoint:!/transactions/processManual) to process a taxable monthly subscription with a first month trial period at a reduced rate, and included the new feature of being able to send a recurring invoice each time the subscriber is charged. The trick is specifying the json input string in the correct way.

I’m posting the json input string I found to work as an example for others because I was unable to find an example that was anywhere near what I was trying to do, and it required a lot of trial-and-error to find a string that worked.

Please note that you will have to replace variables you see in { braces } with the actual value of the number or string you want to use.

Here is the json input string:

  "contact_id": {contact id},
  "chargeNow": "chargeNow",
  "invoice_template": {invoice id},
  "gateway_id": {gateway id},
  "offer": {
    "send_recurring_invoice": true,
    "products": [
        "quantity": 1,
        "shipping": false,
	"hasTaxes": true,
        "tax": true,
	"taxable": true,
        "price": [
            "payment_count": 1,
            "unit": "month"
        "trial": {
            "payment_count": "1",
        "type": "subscription",
        "delay_start": 0,
        "id": {subscription product id}
        "name": {e.g., "NY Sales"},
	"id": {tax id}

In my PHP script that applies this input toward the Ontraport API processManual endpoint, I make the tax ID = 1 if their billing state is New York (we have a NY Sales tax defined in Ontraport, and it’s ID is 1); otherwise, I set the tax ID to 0 and no tax is charged.

I hope someone else finds this helpful!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.