Merchant Plan via API

As an alternative to managing your merchant plans via the Dashboard, you may wish to manage your merchants plans via usage of our plan APIs.

This will leverage 2 endpoints:

Adding a Plan

In order to send transactions each merchant will need to be assigned to a plan. Plans define which connections the transactions should go to and the routing rules that should apply.

Note that for a merchant to be assigned to a plan, the merchant must have active connections to the connections assigned in the plan. In preparation, you may want to get the latest merchant connection status by using the GET merchant endpoint.

In order to see your current plans, you can make a request to the following endpoint with your private key to return your platform's plans:

GET https://api.preczn.com/v1/plans/

[
  {
    "hasTransactions": true,
    "modifiedOn": "2023-06-29T05:00:13Z",
    "createdBy": "2vq6nwnk1f9yz85gym6n7kd21k",
    "isTestMode": false,
    "name": "Stripe Live ",
    "active": true,
    "description": "Stripe Live",
    "modifiedBy": "4e7xpggynk8b29a2zfw5gssbbj",
    "id": "pln_1tz9g0vbke89w9c7gw33arn3wq",
    "connections": [
      {
        "id": "midCon_3qwdyt4nwj8pka6fd17vk7z677",
        "name": "Stripe",
        "connection": "Stripe"
      }
    ],
    "createdOn": "2022-10-14T17:58:04Z",
  },
  {
    "hasTransactions": true,
    "modifiedOn": "2023-06-29T05:00:13Z",
    "createdBy": "2vq6nwnk1f9yz85gym6n7kd21k",
    "isTestMode": false,
    "name": "Braintree Live ",
    "active": true,
    "description": "Braintree and Stripe ",
    "modifiedBy": "4e7xpggynk8b29a2zfw5gssbbj",
    "id": "pln_1tz9g0vbke89w9c7gw33arn3wq",
    "connections": [
      {
        "id": "midCon_3qwdyt4nwj8pka6fd17vk7z677",
        "name": "Braintree",
        "connection": "Braintree"
      },
      {
        "id": "midCon_3qwdyt4nwj8pka6fd17vk7z677",
        "name": "Stripe",
        "connection": "Stripe"
      }
    ],
    "createdOn": "2022-10-14T17:58:04Z",
  }
]

To add assign a plan to a merchant, make a request to the following endpoint including which plan you want to assign the merchant to

PATCH https://api.preczn.com/v1/merchants/{merchantId}/

{
"plan": "pln_xFPtMdvOmWOb9xBHzS4Kde6ZMvR6GrIa"
}
{
    "id": "mid_test_1fq9yd3g409vbbaqkq9t8xbr87",
    "active": false,
    "name": "Testing API",
    "legalName": "Taboo Busines",
    "address": {
        "address": "Api Address 1",
        "address2": "Api Address 2",
        "city": "San Francisco",
        "region": "CA",
        "postal": "12345",
        "country": "USA"
    },
    "plan": "pln_xFPtMdvOmWOb9xBHzS4Kde6ZMvR6GrIa",
  ....
}
{
    "statusCode": 400,
    "message": "Plan requires merchant to have active connections with the following: StripeConnect, Braintree",
    "error": "Bad Request"
}