Creating a pay plan

Nexio's subscription service allows you to run recurring transactions. These can be in the form of basic subscriptions or pay plans.

Pay plans set recurring transactions to run until the pre-specified balance is paid in full.

To create a pay plan, complete the following steps:

  1. Determine your Settings

    Determine the pay plan balance and schedule.
    Also determine whether you would like to provide an amount or a duration (not both).
    These may be pre-determined by the shopper's selections on your checkout page.

  2. Send a Request to Nexio

    Send a POST request to the Create a subscription endpoint.
    Include the balance, schedule and amount/duration as determined in step 1.

    The example below will create a pay plan with a balance of 100 USD. It will run a transaction once a month for 10 USD. After the 10th transaction, the balance will be paid in full and the pay plan with terminate.

    Pay Plan with Transaction Amount
    curl -X POST https://api.nexiopaysandbox.com/subscription/v3 \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -H 'Authorization: Basic [Base64_encoded_login]'
      -d '{
      "payment": {
        "data": {
          "amount": 10,
          "currency": "USD",
          "customer": {
            "customerRef": "RP006"
          }
        },
        "tokenex": {
          "token": "6ee140a0-05d1-4958-8325-b38a690dbb9d"
        }
      },
      "schedule": {
        "balance": 100,
        "interval": "month",
        "intervalCount": 1
      }
    }'
    

    The example below will create a pay plan with a balance of 100 USD that will run every month for 5 months. In order for the balance to be paid in full, each transaction will automatically be run for 20 USD.

    PAY PLAN WITH DURATION
    curl -X POST https://api.nexiopaysandbox.com/subscription/v3 \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -H 'Authorization: Basic [Base64_encoded_login]'
      -d '{
      "payment": {
        "data": {
          "currency": "USD",
          "customer": {
            "customerRef": "RP006"
          }
        },
        "tokenex": {
          "token": "6ee140a0-05d1-4958-8325-b38a690dbb9d"
        }
      },
      "schedule": {
        "balance": 100,
        "duration": 5,
        "interval": "month",
        "intervalCount": 1
      }
    }'
    

  3. Configure Webhooks (Optional)

    If desired, you may configure legacy webhooks to be sent every time a transaction is run through the
    subscription service.

    See the Legacy webhooks and event types tutorialin the Developer Tools section for step-by-step instructions on how to configure and receive webhooks.

    📘

    Note

    You will continue to receive webhooks for any previously configured transaction events.

    Example Request
    curl -X POST https://api.nexiopaysandbox.com/webhook/v3/config \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -H 'Authorization: Basic [Base64_encoded_login]'
      -d '{
      "merchantId": "100039",
      "webhooks": {
        "SUBSCRIPTION_DETAILS": {
          "url": "https://your-ecommerce-website.example.com"
        }
      }
    }'