Pabbly Subscriptions API

:Down below you can access all the Pabbly Subscription API’s.

If you wish to integrate the Pabbly subscriptions on your software project or your SaaS application and are looking for the integration workflow you can check the link below.

https://www.pabbly.com/subscriptions/integration-guide


You can use the API’s below to get useful data from your account and use it to integrate Pabbly Subscriptions in the varied type of applications.

1. Create Customer:

Request Example:

POST https://payments.pabbly.com/api/v1/customer

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
    "first_name" : "Lance", 
    "last_name" : "Crews", 
    "email_id" : "LanceSCrews@teleworm.us",
	"company_name": "Omni Source",
	"website": "anstudios.com",
	"phone": "406-775-3868",
    "billing_address" : {
    	"attention" : "Mr. Lance Crews", 
        "street1" : "936 Tibbs Avenue", 
        "street2" : "Jenna Lane",
        "city" : "Ekalaka", 
        "state" : "MT", 
        "zip_code" : "59324", 
        "country" : "US"
     
    },
    "shipping_address" : {
       "attention" : "Mr. Lance Crews", 
        "street1" : "936 Tibbs Avenue", 
        "street2" : "Jenna Lane",
        "city" : "Ekalaka", 
        "state" : "MT", 
        "zip_code" : "59324", 
        "country" : "US"
    }
}

Response Example:

{
    "status": "success",
    "message": "Customer Created",
    "data": {
        "first_name": "Lance",
        "last_name": "Crews",
        "email_id": "LanceSCrews@teleworm.us",
        "company_name": "Omni Source",
        "website": "anstudios.com",
        "phone": "406-775-3868",
        "billing_address": {
            "attention": "Mr. Lance Crews",
            "street1": "936 Tibbs Avenue",
            "street2": "Jenna Lane",
            "city": "Ekalaka",
            "state": "MT",
            "zip_code": "59324",
            "country": "US"
        },
        "shipping_address": {
            "attention": "Mr. Lance Crews",
            "street1": "936 Tibbs Avenue",
            "street2": "Jenna Lane",
            "city": "Ekalaka",
            "state": "MT",
            "zip_code": "59324",
            "country": "US"
        },
        "createdAt": "2018-04-25T11:15:24.633Z",
        "updatedAt": "2018-04-25T11:15:24.633Z",
        "id": "5ae0634c9d60a124d9963d36"
    }
}

2. Create Subscription:

Request Example:

POST https://payments.pabbly.com/api/v1/subscription

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
   "first_name": "Lance",
   "last_name": "Crews",
   "email": "LanceSCrews@teleworm.us",
   "gateway_type":"Stripe", //Stripe|Test
   "card_number": "4111111111111111",
   "month": "11",
   "year": "2020",
   "cvv": "423",
   "street": "936 Tibbs Avenue",
   "city": "Ekalaka",
   "state": "MT",
   "zip_code": "59324",
   "country": "US",
   "plan_id": "5a4b65ddd5d7fc1d647cdd90"
}

Response Example:

{
    "status": "success",
    "message": "Subscription payment success",
    "data": {
        "customer": {
            "user_id": "5a4b5db47cfab6872a7feafa",
             "first_name": "Lance",
             "last_name": "Crews",
            "user_name": "LanceCrews",
            "email": "LanceSCrews@teleworm.us",
            "billing_address": {
                "street": "936 Tibbs Avenue",
                "city": "Ekalaka",
                "state": "MT",
                "zip_code": "59324",
                "country": "US",
            },
            "credit": {
                "remaining": 0
            },
            "createdAt": "2018-01-04T12:32:37.904Z",
            "updatedAt": "2018-01-04T12:32:37.904Z",
            "id": "5a4e1ee564bf311bfcda3627"
        },
        "subscription": {
            "customer_id": "5a4e1ee564bf311bfcda3627",
            "email_id": "LanceSCrews@teleworm.us",
            "product_id": "5a4b65cfd5d7fc1d647cdd8f",
            "plan_id": "5a4b65ddd5d7fc1d647cdd90",
            "user_id": "5a4b5db47cfab6872a7feafa",
            "status": "live",
            "quantity": "1",
            "amount": 99,
            "starts_at": "2018-01-04T12:32:43.434Z",
            "activation_date": "2018-01-04T12:32:43.434Z",
            "expiry_date": "",
            "trial_days": 0,
            "trial_expiry_date": "",
            "next_billing_date": "2019-01-04T12:32:43.434Z",
            "last_billing_date": "2018-01-04T12:32:43.474Z",
            "plan": {
                "product_id": "5a4b65cfd5d7fc1d647cdd8f",
                "user_id": "5a4b5db47cfab6872a7feafa",
                "plan_name": "Life Time Plan",
                "plan_code": "lifetime",
                "price": "99",
                "billing_period": "y",
                "billing_period_num": "1",
                "billing_cycle": "lifetime",
                "billing_cycle_num": null,
                "trial_period": null,
                "setup_fee": null,
                "plan_description": null,
                "createdAt": "2018-01-02T10:58:37.699Z",
                "updatedAt": "2018-01-02T10:58:37.699Z",
                "id": "5a4b65ddd5d7fc1d647cdd90"
            },
            "setup_fee": null,
            "payment_terms": "",
            "createdAt": "2018-01-04T12:32:43.468Z",
            "updatedAt": "2018-01-04T12:32:43.571Z",
            "payment_method": "5a4e1ee964bf311bfcda3628",
            "id": "5a4e1eeb64bf311bfcda362a"
        },
        "invoice": {
            "customer_id": "5a4e1ee564bf311bfcda3627",
            "user_id": "5a4b5db47cfab6872a7feafa",
            "status": "paid",
            "amount": 99,
            "due_date": "2018-01-04T12:32:43.434Z",
            "plan_id": [
                "5a4b65ddd5d7fc1d647cdd90"
            ],
            "subscription_id": "5a4e1eeb64bf311bfcda362a",
            "subscription": {
                "customer_id": "5a4e1ee564bf311bfcda3627",
                "email_id": "LanceSCrews@teleworm.us",
                "product_id": "5a4b65cfd5d7fc1d647cdd8f",
                "plan_id": "5a4b65ddd5d7fc1d647cdd90",
                "user_id": "5a4b5db47cfab6872a7feafa",
                "status": "live",
                "quantity": "1",
                "amount": 99,
                "starts_at": "2018-01-04T12:32:43.434Z",
                "activation_date": "2018-01-04T12:32:43.434Z",
                "expiry_date": "",
                "trial_days": 0,
                "trial_expiry_date": "",
                "next_billing_date": "2019-01-04T12:32:43.434Z",
                "last_billing_date": "2018-01-04T12:32:43.474Z",
                "plan": {
                    "product_id": "5a4b65cfd5d7fc1d647cdd8f",
                    "user_id": "5a4b5db47cfab6872a7feafa",
                    "plan_name": "Life Time Plan",
                    "plan_code": "lifetime",
                    "price": "99",
                    "billing_period": "y",
                    "billing_period_num": "1",
                    "billing_cycle": "lifetime",
                    "billing_cycle_num": null,
                    "trial_period": null,
                    "setup_fee": null,
                    "plan_description": null,
                    "createdAt": "2018-01-02T10:58:37.699Z",
                    "updatedAt": "2018-01-02T10:58:37.699Z",
                    "id": "5a4b65ddd5d7fc1d647cdd90"
                },
                "setup_fee": null,
                "payment_terms": "",
                "createdAt": "2018-01-04T12:32:43.468Z",
                "updatedAt": "2018-01-04T12:32:43.571Z",
                "payment_method": "5a4e1ee964bf311bfcda3628",
                "id": "5a4e1eeb64bf311bfcda362a"
            },
            "setup_fee": null,
            "createdAt": "2018-01-04T12:32:43.474Z",
            "updatedAt": "2018-01-04T12:32:43.583Z",
            "id": "5a4e1eeb64bf311bfcda362b"
        }
    }
}

3. Get Single Customer:

Request Example:

GET https://payments.pabbly.com/api/v1/customer/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Customer data",
    "data": {
        "user_id": "5a4b5db47cfab6872a7feafa",
         "first_name" : "Lance", 
         "last_name" : "Crews", 
         "user_name": "LanceCrews",
         "email_id" : "LanceSCrews@teleworm.us",
        "pcustomer_id": "5a4b776f7cfab6872a7feb06",
        "billing_address": {
            "street1": "",
            "city": null,
            "state": null,
            "zip_code": null,
            "country": null
        },
        "credit": {
            "remaining": 0
        },
        "createdAt": "2018-01-02T12:16:05.496Z",
        "updatedAt": "2018-01-02T12:16:05.496Z",
        "id": "5a4b78053152df337d841348"
    }
}

4. List All Customers:

Request Example:

GET https://payments.pabbly.com/api/v1/customers

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Customers data",
    "data": [
        {
            "user_id": "5a4b5db47cfab6872a7feafa",
            "first_name" : "Lance", 
            "last_name" : "Crews", 
            "user_name": "LanceCrews",
            "email_id" : "LanceSCrews@teleworm.us",
            "pcustomer_id": "5a4b776f7cfab6872a7feb06",
            "billing_address": {
                "street1": "",
                "city": null,
                "state": null,
                "zip_code": null,
                "country": null
            },
            "credit": {
                "remaining": 0
            },
            "createdAt": "2018-01-02T12:16:05.496Z",
            "updatedAt": "2018-01-02T12:16:05.496Z",
            "id": "5a4b78053152df337d841348"
        },
        {
            "user_id": "5a4b5db47cfab6872a7feafa",
             "first_name" : "Dominique", 
             "last_name" : "Pierce", 
             "user_name": "Dominique Pierce",
             "email_id" : "DominiqueDPierce@dayrep.com",
            "pcustomer_id": "5a4c539f7cfab6872a7feb08",
            "billing_address": {
                "street1": "1924 Ocello Street",
                "city": "Moundridge",
                "state": "KS",
                "zip_code": "67107",
                "country": "US"
            },
            "credit": {
                "remaining": 0
            },
            "createdAt": "2018-01-03T03:56:05.714Z",
            "updatedAt": "2018-01-03T03:56:05.714Z",
            "id": "5a4c5455da43ed35b70e88c2"
        }
    ]
}

5. Update Customer Detail:

Request Example:

PUT https://payments.pabbly.com/api/v1/customer/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
  	"first_name" : "Lance", 
        "last_name" : "Crews", 
	    "company_name": "Omni Source",
	    "website": "anstudios.com",
	    "phone": "406-775-3868",
    "billing_address" : {
    	"attention" : "Mr. Lance Crews", 
        "street1" : "936 Tibbs Avenue", 
        "street2" : "Jenna Lane",
        "city" : "Ekalaka", 
        "state" : "MT", 
        "zip_code" : "59324", 
        "country" : "US"
    },
    "shipping_address" : {
       "attention" : "Mr. Lance Crews", 
        "street1" : "936 Tibbs Avenue", 
        "street2" : "Jenna Lane",
        "city" : "Ekalaka", 
        "state" : "MT", 
        "zip_code" : "59324", 
        "country" : "US"
    }
  }

Response Example:

{
    "status": "success",
    "message": "Customer updated",
    "data": {
          "user_id": "5a4b5db47cfab6872a7feafa",
          "first_name" : "Lance", 
          "last_name" : "Crews", 
          "user_name": "LanceCrews",
          "email_id" : "LanceSCrews@teleworm.us",
        "credit": {
            "remaining": 0
        },
        "createdAt": "2018-01-06T09:49:28.522Z",
        "updatedAt": "2018-01-08T10:53:12.835Z",
        "company_name": "Omni Source",
	"website": "anstudios.com",
	"phone": "406-775-3868",
        "id": "5a509ba81e33641bec7dd4c9",
        "billing_address": {
    	      "attention" : "Mr. Lance Crews", 
              "street1" : "936 Tibbs Avenue", 
              "street2" : "Jenna Lane",
              "city" : "Ekalaka", 
              "state" : "MT", 
              "zip_code" : "59324", 
              "country" : "US"
        },
        "shipping_address": {
             "attention" : "Mr. Lance Crews", 
              "street1" : "936 Tibbs Avenue", 
              "street2" : "Jenna Lane",
              "city" : "Ekalaka", 
              "state" : "MT", 
              "zip_code" : "59324", 
              "country" : "US"
        }
    }
}

6. Create Subscription For Existing Customer:

Request Example:

POST https://payments.pabbly.com/api/v1/subscription/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
  "plan_id": "5ad1cec439fde06e87ea366a",
  "gateway_type":"test|stripe"
}

Response Example:

{
    "status": "success",
    "message": "Subscription payment success",
    "data": {
        "customer": {
            "user_id": "5a4b5db47cfab6872a7feafa",
             "first_name": "Lance",
             "last_name": "Crews",
            "user_name": "LanceCrews",
            "email": "LanceSCrews@teleworm.us",
            "billing_address": {
                "street": "936 Tibbs Avenue",
                "city": "Ekalaka",
                "state": "MT",
                "zip_code": "59324",
                "country": "US",
            },
            "credit": {
                "remaining": 0
            },
            "createdAt": "2018-01-04T12:32:37.904Z",
            "updatedAt": "2018-01-04T12:32:37.904Z",
            "id": "5a4e1ee564bf311bfcda3627"
        },
        "subscription": {
            "customer_id": "5a4e1ee564bf311bfcda3627",
            "email_id": "LanceSCrews@teleworm.us",
            "product_id": "5a4b65cfd5d7fc1d647cdd8f",
            "plan_id": "5a4b65ddd5d7fc1d647cdd90",
            "user_id": "5a4b5db47cfab6872a7feafa",
            "status": "live",
            "quantity": "1",
            "amount": 99,
            "starts_at": "2018-01-04T12:32:43.434Z",
            "activation_date": "2018-01-04T12:32:43.434Z",
            "expiry_date": "",
            "trial_days": 0,
            "trial_expiry_date": "",
            "next_billing_date": "2019-01-04T12:32:43.434Z",
            "last_billing_date": "2018-01-04T12:32:43.474Z",
            "plan": {
                "product_id": "5a4b65cfd5d7fc1d647cdd8f",
                "user_id": "5a4b5db47cfab6872a7feafa",
                "plan_name": "Life Time Plan",
                "plan_code": "lifetime",
                "price": "99",
                "billing_period": "y",
                "billing_period_num": "1",
                "billing_cycle": "lifetime",
                "billing_cycle_num": null,
                "trial_period": null,
                "setup_fee": null,
                "plan_description": null,
                "createdAt": "2018-01-02T10:58:37.699Z",
                "updatedAt": "2018-01-02T10:58:37.699Z",
                "id": "5a4b65ddd5d7fc1d647cdd90"
            },
            "setup_fee": null,
            "payment_terms": "",
            "createdAt": "2018-01-04T12:32:43.468Z",
            "updatedAt": "2018-01-04T12:32:43.571Z",
            "payment_method": "5a4e1ee964bf311bfcda3628",
            "id": "5a4e1eeb64bf311bfcda362a"
        },
        "invoice": {
            "customer_id": "5a4e1ee564bf311bfcda3627",
            "user_id": "5a4b5db47cfab6872a7feafa",
            "status": "paid",
            "amount": 99,
            "due_date": "2018-01-04T12:32:43.434Z",
            "plan_id": [
                "5a4b65ddd5d7fc1d647cdd90"
            ],
            "subscription_id": "5a4e1eeb64bf311bfcda362a",
            "subscription": {
                "customer_id": "5a4e1ee564bf311bfcda3627",
                "email_id": "LanceSCrews@teleworm.us",
                "product_id": "5a4b65cfd5d7fc1d647cdd8f",
                "plan_id": "5a4b65ddd5d7fc1d647cdd90",
                "user_id": "5a4b5db47cfab6872a7feafa",
                "status": "live",
                "quantity": "1",
                "amount": 99,
                "starts_at": "2018-01-04T12:32:43.434Z",
                "activation_date": "2018-01-04T12:32:43.434Z",
                "expiry_date": "",
                "trial_days": 0,
                "trial_expiry_date": "",
                "next_billing_date": "2019-01-04T12:32:43.434Z",
                "last_billing_date": "2018-01-04T12:32:43.474Z",
                "plan": {
                    "product_id": "5a4b65cfd5d7fc1d647cdd8f",
                    "user_id": "5a4b5db47cfab6872a7feafa",
                    "plan_name": "Life Time Plan",
                    "plan_code": "lifetime",
                    "price": "99",
                    "billing_period": "y",
                    "billing_period_num": "1",
                    "billing_cycle": "lifetime",
                    "billing_cycle_num": null,
                    "trial_period": null,
                    "setup_fee": null,
                    "plan_description": null,
                    "createdAt": "2018-01-02T10:58:37.699Z",
                    "updatedAt": "2018-01-02T10:58:37.699Z",
                    "id": "5a4b65ddd5d7fc1d647cdd90"
                },
                "setup_fee": null,
                "payment_terms": "",
                "createdAt": "2018-01-04T12:32:43.468Z",
                "updatedAt": "2018-01-04T12:32:43.571Z",
                "payment_method": "5a4e1ee964bf311bfcda3628",
                "id": "5a4e1eeb64bf311bfcda362a"
            },
            "setup_fee": null,
            "createdAt": "2018-01-04T12:32:43.474Z",
            "updatedAt": "2018-01-04T12:32:43.583Z",
            "id": "5a4e1eeb64bf311bfcda362b"
        }
    }
}

7. Cancel Subscription For Existing Customer:

Request Example:

POST https://payments.pabbly.com/api/v1/subscription/{subscription_id}/cancel

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Note:
Subscription can be either canceled immediately or at the end of the current term based on the value of `cancel_at_end`.
If `cancel_at_end` is set to true then the `status` of the subscription is changed to non_renewing and if it is false, the `status` would be canceled.

Form data- Cancel at the end of the term:

{
	"cancel_at_end":"true"
}

Response Example:

{
"status": "success",
"message": "Your suscription would be cancelled at the end of the term",
"data": null
}

Form data- Immediate cancellation :

{
"cancel_at_end":"false"
}

Response Example:

{
   "status": "success",
   "message": "Your suscription has been cancelled",
   "data": null
}

8. Get Single Subscription:

Request Example:

GET https://payments.pabbly.com/api/v1/subscription/{subscription_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
"status": "success",
"message": "Subscription data",
"data": {
         "customer_id": "5a4b78053152df337d841348",
         "email_id": "LanceSCrews@teleworm.us",
         "product_id": "5a4b5e6ecb9bc82fd2b4bfef",
         "plan_id": "5a4b5e7fcb9bc82fd2b4bff0",
         "user_id": "5a4b5db47cfab6872a7feafa",
         "status": "live",
         "quantity": "1",
         "amount": 99,
         "starts_at": "2018-01-02T12:16:05.055Z",
         "activation_date": "2018-01-02T12:16:05.055Z",
         "expiry_date": "",
         "trial_days": 0,
         "trial_expiry_date": "",
         "next_billing_date": "",
         "last_billing_date": "2018-01-02T12:16:05.508Z",
         "plan": {
                "product_id": "5a4b5e6ecb9bc82fd2b4bfef",
                "user_id": "5a4b5db47cfab6872a7feafa",
                "plan_name": "Life Time Plan",
                "plan_code": "lifetime",
                "price": "99",
                "billing_period": "y",
                "billing_period_num": "1",
                "billing_cycle": "lifetime",
                "billing_cycle_num": null,
                "trial_period": null,
                "setup_fee": null,
                "plan_description": null,
                "createdAt": "2018-01-02T10:27:11.365Z",
                "updatedAt": "2018-01-02T10:27:11.365Z",
                "id": "5a4b5e7fcb9bc82fd2b4bff0"
                 },
        "setup_fee": null,
        "payment_terms": "",
        "pcustomer_id": "5a4b776f7cfab6872a7feb06",
        "createdAt": "2018-01-02T12:16:05.503Z",
        "updatedAt": "2018-01-02T12:16:05.535Z",
        "payment_method": "5a4b78053152df337d841346",
        "id": "5a4b78053152df337d841349"
       }
}

9. List All Subscriptions By Customer Id:

Request Example:

GET https://payments.pabbly.com/api/v1/subscriptions/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
"status": "success",
"message": "Subscriptions data",
"data": [
        {
         "customer_id": "5af96449ee385519983441b3",
         "email_id": "LanceSCrews@teleworm.us",
         "product_id": "5ac6059c1947441b76cb3e1d",
         "plan_id": "5ac605f11947441b76cb3e1e",
         "status": "live",
         "quantity": 1,
         "amount": 30,
         "starts_at": "2018-05-14T00:00:00.000Z",
         "activation_date": "2018-05-14T10:26:40.404Z",
         "expiry_date": "2018-06-14T00:00:00.000Z",
         "trial_days": 0,
         "trial_expiry_date": "",
         "next_billing_date": "",
         "last_billing_date": "2018-05-14T00:00:00.000Z",
         "plan": {
                 "product_id": "5ac6059c1947441b76cb3e1d",
                 "user_id": "5a5c8d8811e026d5150704cf",
                 "plan_name": "Life Time Plan",
                 "plan_code": "lifetime",
                 "price": 30,
                 "billing_period": "m",
                 "billing_period_num": "1",
                 "billing_cycle": "specific",
                 "billing_cycle_num": "1",
                 "trial_period": 0,
                 "setup_fee": 8,
                 "plan_description": "<p>This is a plan for 1 cycle.</p>",
                 "redirect_link": null,
                 "bump_offer": {
                              "plan_id": null,
                              "title_label": null,
                              "tag_line": null,
                              "description": null
                               },
                "createdAt": "2018-04-05T11:18:09.908Z",
                "updatedAt": "2018-04-07T05:32:31.220Z",
                "id": "5ac605f11947441b76cb3e1e"
               },
       "setup_fee": 8,
       "payment_terms": "net0",
       "currency_symbol": "$",
       "coupon": {
                "discount_amount": 0
                 },
       "payment_method": "5aec48a2ed1eda3e5ee19c5e",
       "createdAt": "2018-05-14T10:26:39.924Z",
       "updatedAt": "2018-05-14T10:26:40.040Z",
       "cron_process": "done",
       "id": "5af9645fee385519983441b4"
      },
     {
      "customer_id": "5af96449ee385519983441b3",
      "email_id": "LanceSCrews@teleworm.us",
      "product_id": "5a78432f3596331d04f40ec4",
      "plan_id": "5a829709e4c7af6e6120f727",
      "status": "live",
      "quantity": 1,
      "amount": 30.99,
      "starts_at": "2018-05-14T00:00:00.000Z",
      "activation_date": "2018-05-14T10:26:58.585Z",
      "expiry_date": "2019-05-14T00:00:00.000Z",
      "trial_days": 0,
      "trial_expiry_date": "",
      "next_billing_date": "2019-05-14T00:00:00.000Z",
      "last_billing_date": "2018-05-14T00:00:00.000Z",
      "plan": {
             "product_id": "5a78432f3596331d04f40ec4",
             "user_id": "5a5c8d8811e026d5150704cf",
             "plan_name": "Recurring Plan",
             "plan_code": "recurring",
             "price": 30.99,
             "billing_period": "y",
             "billing_period_num": "1",
             "billing_cycle": "lifetime",
             "billing_cycle_num": null,
             "trial_period": 0,
             "setup_fee": 30,
             "plan_description": "<p>This is a plan for recurring cycle.</p>",
             "createdAt": "2018-02-13T07:43:05.426Z",
             "updatedAt": "2018-04-04T10:56:46.044Z",
             "id": "5a829709e4c7af6e6120f727"
             },
       "setup_fee": 30,
       "payment_terms": "net0",
       "currency_symbol": "$",
       "coupon": {
                "discount_amount": 0
                 },
      "payment_method": "offline",
      "createdAt": "2018-05-14T10:26:58.811Z",
      "updatedAt": "2018-05-14T10:26:58.910Z",
      "cron_process": "done",
      "id": "5af96472ee385519983441b8"
      }
     ]
}

10. Update Subscription:

Request Example:

PUT https://payments.pabbly.com/api/v1/subscription/:subscription_id/update

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
   "plan_id": "5a7b12c0f2c1ed4c26e05247",
   "customer_id": "5a7b12c0f225sd4c26e05247",
   "payment_term": "net0",
   "activated_at_val": "immediately"
}

Here, payment_term and activated_at_val are optional fields.

Possible values of payment_term are net0/net15/net30/net45/net60/neteom/neteonm.

  • net0: Net payment is due on day 0. Due date is calculated from the invoice generation date.
  • net45: Net payment is due on day 45. Due date is calculated from the invoice generation date. Similarly net15, net30, and net60 are calculated.
  • neteom: Net payment is due at end of current month.
  • neteonm: Net payment is due at end of next month.

If the “payment_term” field is not used, the default value as “net 0” is applied automatically.

Possible values of activated_at_val are immediately/eot.

If the “activated_at_val” field is not used, the default value as “immediately” is applied automatically.

Response Example:

{
"status": "success",
"message": "Subscription payment success",
"data": {
         "customer": {
         "user_id": "5a4c75ec65558d6f0748344f",
         "first_name" : "Lance",
         "last_name" : "Crews",
         "user_name": "LanceCrews",
         "email_id": "LanceSCrews@teleworm.us",
         "billing_address" : {
                           "attention" : "Mr. Lance Crews",
                           "street1" : "936 Tibbs Avenue",
                           "street2" : "Jenna Lane",
                           "city" : "Ekalaka",
                           "state" : "MT",
                           "zip_code" : "59324",
                           "country" : "US"
                           },
         "credit": {
                   "remaining": 746
                   },
        "createdAt": "2018-01-11T11:57:46.627Z",
        "updatedAt": "2018-01-16T07:23:43.662Z",
        "company_name": "",
        "website": "",
        "phone": "406-775-3868",
        "shipping_address": {
                            "attention": "",
                            "street1": "",
                            "street2": "",
                            "city": "",
                            "state": "",
                            "zip_code": "",
                            "country": ""
                            },
        "other_detail": {
        "portal_language": "",
        "client_portal": true,
        "payment_term": "Net 15",
        "currency": "",
        "twitter": "",
        "facebook": ""
        },
     "role": "",
     "api": "",
     "id": "5a57513abb01c005f479b0d8"
 },
"subscription": {
         "customer_id": "5a57513abb01c005f479b0d8",
         "email_id": "LanceSCrews@teleworm.us",
         "product_id": "5a575094bb01c005f479b0d6",
         "plan_id": "5a5750c5bb01c005f479b0d7",
         "user_id": "5a4c75ec65558d6f0748344f",
         "status": "live",
         "quantity": "1",
         "amount": 51,
         "starts_at": "2018-01-15T07:33:46.464Z",
         "activation_date": "2018-01-15T00:00:00.000Z",
         "expiry_date": "2018-07-14T18:30:00.000Z",
         "trial_days": 0,
         "trial_expiry_date": "",
         "next_billing_date": "2018-02-16T07:23:46.464Z",
         "last_billing_date": "2018-01-16T07:23:43.686Z",
         "plan": {
                "trial_period": 0,
                "billing_period": "m",
                "billing_period_num": "1",
                "billing_cycle": "lifetime",
                "billing_cycle_num": "",
                "product_id": "5a575094bb01c005f479b0d6",
                "id": "5a5750c5bb01c005f479b0d7",
                "price": "51",
                "user_id": "5a4c75ec65558d6f0748344f"
                 },
         "setup_fee": null,
         "payment_terms": "net30",
         "createdAt": "2018-01-15T07:33:46.316Z",
         "updatedAt": "2018-01-16T07:23:46.361Z",
         "payment_method": "5a575160bb01c005f479b0da",
         "id": "5a5c595ab61d331010af0a5b"
          },
"invoice": {
         "customer_id": "5a57513abb01c005f479b0d8",
         "user_id": "5a4c75ec65558d6f0748344f",
         "status": "paid",
         "payment_term": "net0",
         "amount": 0,
         "used_credits": 51,
         "due_amount": "0",
         "due_date": "2018-01-16T07:23:43.434Z",
         "subscription_id": "5a5c595ab61d331010af0a5b",
         "subscription": {
                "customer_id": "5a57513abb01c005f479b0d8",
                "email_id": "LanceSCrews@teleworm.us",
                "product_id": "5a575094bb01c005f479b0d6",
                "plan_id": "5a5750c5bb01c005f479b0d7",
                "user_id": "5a4c75ec65558d6f0748344f",
                "status": "live",
                "quantity": "1",
                "amount": 51,
                "starts_at": "2018-01-15T07:33:46.464Z",
                "activation_date": "2018-01-15T00:00:00.000Z",
                "expiry_date": "2018-07-14T18:30:00.000Z",
                "trial_days": 0,
                "trial_expiry_date": "",
                "next_billing_date": "2018-02-16T07:23:46.464Z",
                "last_billing_date": "2018-01-16T07:23:43.686Z",
                "plan": {
                     "trial_period": 0,
                     "billing_period": "m",
                     "billing_period_num": "1",
                     "billing_cycle": "lifetime",
                     "billing_cycle_num": "",
                     "product_id": "5a575094bb01c005f479b0d6",
                     "id": "5a5750c5bb01c005f479b0d7",
                     "price": "51",
                     "user_id": "5a4c75ec65558d6f0748344f"
                        },
                "setup_fee": null,
                "payment_terms": "net30",
                "createdAt": "2018-01-15T07:33:46.316Z",
                "updatedAt": "2018-01-16T07:23:46.361Z",
                "payment_method": "5a575160bb01c005f479b0da",
                "id": "5a5c595ab61d331010af0a5b"
                },
        "plan_id": [
                  "5a5750c5bb01c005f479b0d7"
                   ],
       "createdAt": "2018-01-16T07:23:43.686Z",
       "updatedAt": "2018-01-16T07:23:46.374Z",
       "id": "5a5da87f9e9312130c8b4d38"
       }
   }
}

11. : Create Product:

Request Example:

POST https://payments.pabbly.com/api/v1/product/create

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
	"product_name":"Product 1",
	"description":"product description",
	"notification_email":"example@domain.com",
	"redirect_url":"www.exampledomain.com"
}

Response Example:

{
    "status": "success",
    "message": "Product Created",
    "data": {
        "createdAt": "2018-11-02T07:35:54.163Z",
        "updatedAt": "2018-11-02T07:35:54.163Z",
        "id": "5bdbfe5af6836f03dcab1643",
        "product_name": "Product 1",
        "description": "product description",
        "notification_email": "example@domain.com",
        "redirect_url": "www.exampledomain.com",
        "hostedPage": null
    }
}

12. List All Products:

Request Example:

GET https://payments.pabbly.com/api/v1/products

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Product data",
    "data": [
        {
            "user_id": "5a4b5db47cfab6872a7feafa",
            "product_name": "Pabbly Payments",
            "description": null,
            "notification_email": null,
            "redirect_url": "https://payments.pabbly.com/",
            "createdAt": "2018-01-02T10:26:54.630Z",
            "updatedAt": "2018-01-02T10:26:54.630Z",
            "id": "5a4b5e6ecb9bc82fd2b4bfef"
        }
    ]
}

13. Update Product:

Request Example:

PUT https://payments.pabbly.com/api/v1/product/update/product_id

Authorization Type: Basic auth

User Name:apikey

Password:secretkey

Form data:

{
	"product_name":"Product 1",
	"Description":"edit product description",
	"notification_email":"example@domain.com",
	"redirect_url":"www.exampledomain.com"
}

Response Example:

{
    "status": "success",
    "message": "Product Updated",
    "data": {
        "createdAt": "2018-11-02T07:30:23.655Z",
        "updatedAt": "2018-11-02T07:30:23.655Z",
        "id": "5bdbfd0fffa2cf0884fcf5d4",
        "user_id": "5ac2096ec57c2c5107dea058",
        "product_name": "Product 1",
        "description": "edit product description",
        "notification_email": "example@domain.com",
        "redirect_url": "www.exampledomain.com",
        "hostedPage": null
    }
}

14. Create Plan:

Request Example:

POST https://payments.pabbly.com/api/v1/plan/create

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
"product_id":"5b80e4a5352ca81c942c2841",
"plan_name":"plan1",
"plan_code":"plan1",
"billing_cycle":"lifetime",
"setup_fee" : 2,
"billing_cycle_num":"2",
"price":10,
"billing_period":"m",
"billing_period_num":"1",
"plan_active" : "true",
"plan_description" : "",	
"trial_period" : 2,
"redirect_link" : null
}

Response Example:

{
    "status": "success",
    "message": "Plan Created",
    "data": {
        "plan_active": "true",
        "redirect_link": null,
        "createdAt": "2018-11-02T10:31:14.308Z",
        "updatedAt": "2018-11-02T10:31:14.308Z",
        "id": "5bdc2772f05a0218ccd949b3",
        "product_id": "5b80e4a5352ca81c942c2841",
        "plan_name": "plan1",
        "plan_code": "plan1",
        "price": 10,
        "billing_period": "m",
        "billing_period_num": "1",
        "billing_cycle": "lifetime",
        "billing_cycle_num": null,
        "trial_period": 2,
        "setup_fee": 2,
        "plan_description": ""
    }
}

15. List All Plans:

Request Example:

GET https://payments.pabbly.com/api/v1/plans

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Plan data",
    "data": [
        {
            "product_id": "5a4b5e6ecb9bc82fd2b4bfef",
            "user_id": "5a4b5db47cfab6872a7feafa",
            "plan_name": "Life Time Plan",
            "plan_code": "lifetime",
            "price": "99",
            "billing_period": "y",
            "billing_period_num": "1",
            "billing_cycle": "lifetime",
            "billing_cycle_num": null,
            "trial_period": null,
            "setup_fee": null,
            "plan_description": null,
            "createdAt": "2018-01-02T10:27:11.365Z",
            "updatedAt": "2018-01-02T10:27:11.365Z",
            "id": "5a4b5e7fcb9bc82fd2b4bff0"
        }
    ]
}

16. List All Plans By Product Id:

Request Example:

GET https://payments.pabbly.com/api/v1/plans/{product_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Plan data",
    "data": [
        {
            "product_id": "5a4b5e6ecb9bc82fd2b4bfef",
            "user_id": "5a4b5db47cfab6872a7feafa",
            "plan_name": "Life Time Plan",
            "plan_code": "lifetime",
            "price": "99",
            "billing_period": "y",
            "billing_period_num": "1",
            "billing_cycle": "lifetime",
            "billing_cycle_num": null,
            "trial_period": null,
            "setup_fee": null,
            "plan_description": null,
            "createdAt": "2018-01-02T10:27:11.365Z",
            "updatedAt": "2018-01-02T10:27:11.365Z",
            "id": "5a4b5e7fcb9bc82fd2b4bff0"
        }
    ]
}

17. Update Plan:

Request Example:

PUT https://payments.pabbly.com/api/v1/plan/update/plan_id

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
"Product_id":"5b80e4a5352ca81c942c2841",
"plan_name":"plan1",
"plan_code":"plan1",
"billing_cycle":"lifetime",
"setup_fee" : 2,
"billing_cycle_num":"2",
"price":10,
"billing_period":"m",
"billing_period_num":"1",
"plan_active" : "true",
"plan_description" : "",	
"trial_period" : 2,
"redirect_link" : null
}

Response Example:

{
    "status": "success",
    "message": "Plan Updated",
    "data": {
        "plan_active": "true",
        "redirect_link": null,
        "createdAt": "2018-11-02T10:31:14.308Z",
        "updatedAt": "2018-11-02T10:31:14.308Z",
        "id": "5bdc2772f05a0218ccd949b3",
        "product_id": "5b80e4a5352ca81c942c2841",
        "plan_name": "plan1",
        "plan_code": "plan1",
        "price": 10,
        "billing_period": "m",
        "billing_period_num": "1",
        "billing_cycle": "lifetime",
        "billing_cycle_num": null,
        "trial_period": 2,
        "setup_fee": 2,
        "plan_description": ""
    }
}

18. Create Coupon:

Request Example:  

POST https://payments.pabbly.com/api/v1/coupon/{product_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data arguments explanation:

1. coupon_name : display name of the coupon
2. coupon_code : unique code for the coupon
3. discount_type: flat/percent, type of discount in the coupon
4. redemption_type : onetime/forever/number_time
5. redemption_cycle : add a numeric value in case of redemption_type -> number_time
6. associate_plans: all_plans/none/selected_plans
7. plans_array:	["plan_id_1","plan_id_2"] (in case of selected_plans).
8. valid_upto: you can add a coupon end date in the format yyyy-mm-dd. coupon will expire on this date.
9. apply_to: true/false (true if you want to apply coupon Only in Plan Price(Excluding the SetUp fee).
10. maximum_redemption : eg. 10 (Maximum number of subscriptions for which this coupon can be used).

Form data:

{
  "coupon_name": "TestNew2",
  "coupon_code" : "test123456",
  "discount": 25,
  "discount_type": "flat",
  "redemption_type": "number_time",
  "redemption_cycle": 2,
  "associate_plans": "selected_plans",
  "plans_array": ["5b03b6b77fd11b1634f15f0f","5b03b6cc7fd11b1634f15f10"],
  "valid_upto": "2022-10-02",
  "apply_to":false,
  "maximum_redemption":10,
  "status": "active"
}

Response Example:

{
    "status": "success",
    "message": "Coupon created",
    "data": {
        "product_id": "5b03b6837fd11b1634f15f0e",
        "coupon_name": "TestNew2",
        "coupon_code": "test123456",
        "discount": 25,
        "discount_type": "flat",
        "redemption_type": "number_time",
        "redemption_cycle": 2,
        "associate_plans": "selected_plans",
        "status": "active",
        "plans_array": [
            "5b03b6b77fd11b1634f15f0f",
            "5b03b6cc7fd11b1634f15f10"
        ],
        "valid_upto": "2018-10-01T18:30:00.000Z",
        "apply_to": "total_amount",
        "maximum_redemption": 10,
        "used_redemption": 0,
        "createdAt": "2018-07-03T05:29:08.011Z",
        "updatedAt": "2018-07-03T05:29:08.011Z",
        "id": "5b3b09a4f6c77706ccb2cdf2"
    }
}

19. Get Coupon

Request Example:

GET https://payments.pabbly.com/api/v1/coupon/{product_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Get Coupon",
    "data": [
        {
            "product_id": "5b03b6837fd11b1634f15f0e",
            "coupon_name": "test",
            "coupon_code": "test24",
            "discount": 25,
            "discount_type": "flat",
            "redemption_type": "onetime",
            "redemption_cycle": 0,
            "associate_plans": "all_plans",
            "status": "active",
            "plans_array": "",
            "valid_upto": "2018-10-01T18:30:00.000Z",
            "apply_to": "total_amount",
            "maximum_redemption": 10,
            "used_redemption": 0,
            "createdAt": "2018-07-02T13:06:32.773Z",
            "updatedAt": "2018-07-02T13:06:32.773Z",
            "id": "5b3a23586dd1621234e0d99f"
        },
        {
            "product_id": "5b03b6837fd11b1634f15f0e",
            "coupon_name": "TestNew",
            "coupon_code": "test1234",
            "discount": 25,
            "discount_type": "flat",
            "redemption_type": "number_time",
            "redemption_cycle": 2,
            "associate_plans": "selected_plans",
            "status": "active",
            "plans_array": [
                "5b03b6b77fd11b1634f15f0f",
                "5b03b6cc7fd11b1634f15f10"
            ],
            "valid_upto": "2018-10-01T18:30:00.000Z",
            "apply_to": "total_amount",
            "maximum_redemption": 10,
            "used_redemption": 0,
            "createdAt": "2018-07-03T05:18:51.021Z",
            "updatedAt": "2018-07-03T05:18:51.021Z",
            "id": "5b3b073babb4e618c4ed4259"
        }
 ]
}

20. Get Single Invoice:

Request Example:

GET https://payments.pabbly.com/api/v1/invoice/{invoice_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Invoice data",
    "data": {
        "customer_id": "5a4b78053152df337d841348",
        "user_id": "5a4b5db47cfab6872a7feafa",
        "status": "paid",
        "amount": 99,
        "due_date": "2018-01-02T12:16:05.055Z",
        "plan_id": [
            "5a4b5e7fcb9bc82fd2b4bff0"
        ],
        "subscription_id": "5a4b78053152df337d841349",
        "subscription": {
            "customer_id": "5a4b78053152df337d841348",
            "email_id": "LanceSCrews@teleworm.us",
            "product_id": "5a4b5e6ecb9bc82fd2b4bfef",
            "plan_id": "5a4b5e7fcb9bc82fd2b4bff0",
            "user_id": "5a4b5db47cfab6872a7feafa",
            "status": "live",
            "quantity": "1",
            "amount": 99,
            "starts_at": "2018-01-02T12:16:05.055Z",
            "activation_date": "2018-01-02T12:16:05.055Z",
            "expiry_date": "",
            "trial_days": 0,
            "trial_expiry_date": "",
            "next_billing_date": "",
            "last_billing_date": "2018-01-02T12:16:05.508Z",
            "plan": {
                "product_id": "5a4b5e6ecb9bc82fd2b4bfef",
                "user_id": "5a4b5db47cfab6872a7feafa",
                "plan_name": "Life Time Plan",
                "plan_code": "lifetime",
                "price": "99",
                "billing_period": "y",
                "billing_period_num": "1",
                "billing_cycle": "lifetime",
                "billing_cycle_num": null,
                "trial_period": null,
                "setup_fee": null,
                "plan_description": null,
                "createdAt": "2018-01-02T10:27:11.365Z",
                "updatedAt": "2018-01-02T10:27:11.365Z",
                "id": "5a4b5e7fcb9bc82fd2b4bff0"
            },
            "setup_fee": null,
            "payment_terms": "",
            "pcustomer_id": "5a4b776f7cfab6872a7feb06",
            "createdAt": "2018-01-02T12:16:05.503Z",
            "updatedAt": "2018-01-02T12:16:05.535Z",
            "payment_method": "5a4b78053152df337d841346",
            "id": "5a4b78053152df337d841349"
        },
        "setup_fee": null,
        "pcustomer_id": "5a4b776f7cfab6872a7feb06",
        "createdAt": "2018-01-02T12:16:05.508Z",
        "updatedAt": "2018-01-02T12:16:05.541Z",
        "id": "5a4b78053152df337d84134a"
    }
}

21. List All Invoices By Customer Id:

Request Example:

GET https://payments.pabbly.com/api/v1/invoices/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Invoice data",
    "data": [
        {
            "customer_id": "5a4b78053152df337d841348",
            "user_id": "5a4b5db47cfab6872a7feafa",
            "status": "paid",
            "amount": 99,
            "due_date": "2018-01-02T12:16:05.055Z",
            "plan_id": [
                "5a4b5e7fcb9bc82fd2b4bff0"
            ],
            "subscription_id": "5a4b78053152df337d841349",
            "subscription": {
                "customer_id": "5a4b78053152df337d841348",
                "email_id": "LanceSCrews@teleworm.us",
                "product_id": "5a4b5e6ecb9bc82fd2b4bfef",
                "plan_id": "5a4b5e7fcb9bc82fd2b4bff0",
                "user_id": "5a4b5db47cfab6872a7feafa",
                "status": "live",
                "quantity": "1",
                "amount": 99,
                "starts_at": "2018-01-02T12:16:05.055Z",
                "activation_date": "2018-01-02T12:16:05.055Z",
                "expiry_date": "",
                "trial_days": 0,
                "trial_expiry_date": "",
                "next_billing_date": "",
                "last_billing_date": "2018-01-02T12:16:05.508Z",
                "plan": {
                    "product_id": "5a4b5e6ecb9bc82fd2b4bfef",
                    "user_id": "5a4b5db47cfab6872a7feafa",
                    "plan_name": "Life Time Plan",
                    "plan_code": "lifetime",
                    "price": "99",
                    "billing_period": "y",
                    "billing_period_num": "1",
                    "billing_cycle": "lifetime",
                    "billing_cycle_num": null,
                    "trial_period": null,
                    "setup_fee": null,
                    "plan_description": null,
                    "createdAt": "2018-01-02T10:27:11.365Z",
                    "updatedAt": "2018-01-02T10:27:11.365Z",
                    "id": "5a4b5e7fcb9bc82fd2b4bff0"
                },
                "setup_fee": null,
                "payment_terms": "",
                "pcustomer_id": "5a4b776f7cfab6872a7feb06",
                "createdAt": "2018-01-02T12:16:05.503Z",
                "updatedAt": "2018-01-02T12:16:05.535Z",
                "payment_method": "5a4b78053152df337d841346",
                "id": "5a4b78053152df337d841349"
            },
            "setup_fee": null,
            "pcustomer_id": "5a4b776f7cfab6872a7feb06",
            "createdAt": "2018-01-02T12:16:05.508Z",
            "updatedAt": "2018-01-02T12:16:05.541Z",
            "id": "5a4b78053152df337d84134a"
        }
    ]
}

22. Create Payment Method:

Request Example:

POST https://payments.pabbly.com/api/v1/paymentmethod/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form Data:

{
	"gateway_type":"stripe",
	"first_name":"Akash",
	"last_name":"Agrsh",
	"email":"akash@domain.com",
	"card_number":"4111111111111111",
	"month":"01",
	"year":"2029",
	"cvv":"864",
	"street":"",
	"city":"",
	"state":"",
	"zip_code":"",
	"country":""
}

Response Example:

{
    "status": "success",
    "message": "Payment method created successfully"
}

23. List All Payment Methods By Customer Id:

Request Example:

GET https://payments.pabbly.com/api/v1/paymentmethods/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
   "status": "success",
   "message": "PaymentMethod data",
   "data": [
       {
           "customer_id": "5ad1ce8039fde06e87ea3668",
           "type": "credit_card",
           "gateway": {
               "id": "5adaeba584f8f1033e1e4b41",
               "name": "Test",
               "type": "test"
           },
           "createdAt": "2018-04-21T07:44:34.743Z",
           "updatedAt": "2018-04-21T07:46:09.528Z",
           "id": "5adaebe284f8f1033e1e4b46"
       }
   ]
}

24. Update Payment Method For Existing Customer:

Request Example:

PUT https://payments.pabbly.com/api/v1/paymentmethod/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
  "card_number": "4012888888881881",
  "month": "11",
  "year": "2020",
  "cvv" : "423",
  "mid":"5a5070fbf6fb701824c6fc78"
}

Response Example:

{
    "status": "success",
    "message": "Payment method updated",
    "data": null
}

25. Get Checkout Page By Product Id:

Request Example:

GET https://payments.pabbly.com/api/v1/checkoutpage/{product_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Checkout Page data",
    "data": [
        {
            "plan_name": "Life Time Plan",
            "plan_code": "lifetime",
            "id": "5a4b5e7fcb9bc82fd2b4bff0",
            "checkout_page": "http://payments.pabbly.com/subscribe/61536d6cdf00dc6240bbb55203c9e73d:87f6481a976660736d3b46deee0f01960ef2a6873a97f091bf06346c9a715bba/lifetime"
        }
    ]
}

26. Verify Hosted Page:

Request Example:

POST https://payments.pabbly.com/api/v1/verifyhosted

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

You will be getting the hostedpage query string value from the success URL.

When a customer makes a purchase he is redirected to a success page with the hosted page query string. You can capture the value of the query string and pass it in the API below to validate the purchase. You will be getting a success status if the query string is validated.

Form data:

{
	"hostedpage": "c9e3330c134941ab88fc7d44a566ffa4:091bf4dc53f6a842f0a5d1efbe91533b38538197d4b90134180f862879db373f62866ad6488112e8965d4df666884608ca16cb547414a9ef4e4fe049e55f81456b9435e7da33e6465707aeb16deb8ce4f5acd8dc533814e58e8c5df2a91417ad6a29c0a2f796a4057d70c782765c642515b414bd2b0f66a196f36043df722d981192336af1c02ee8cea81c56964f8669"
}

Response Example:

{
    "status": "success",
    "message": "Valid hosted page data",
    "data": {
        "customer_id": "5a509776081e5316d84a21e0",
        "email_id": "LanceSCrews@teleworm.us",
        "product_id": "5a4dc33d8f40f61da0091c1b",
        "plan_id": "5a4dc3548f40f61da0091c1c",
        "user_id": "5a4b60497cfab6872a7feafb",
        "status": "live",
        "quantity": "1",
        "amount": 50,
        "starts_at": "2018-01-09T07:40:27.272Z",
        "activation_date": "2018-01-09T07:40:27.272Z",
        "expiry_date": "",
        "trial_days": 0,
        "trial_expiry_date": "",
        "next_billing_date": "2018-02-09T07:40:27.272Z",
        "last_billing_date": "2018-01-09T07:40:27.857Z",
        "plan": {
            "product_id": "5a4dc33d8f40f61da0091c1b",
            "user_id": "5a4b60497cfab6872a7feafb",
            "plan_name": "10,000 Subscribers Plan",
            "plan_code": "10k-subscribers",
            "price": "50",
            "billing_period": "m",
            "billing_period_num": "1",
            "billing_cycle": "lifetime",
            "billing_cycle_num": null,
            "trial_period": null,
            "setup_fee": null,
            "plan_description": null,
            "createdAt": "2018-01-04T06:01:56.743Z",
            "updatedAt": "2018-01-06T05:56:27.865Z",
            "id": "5a4dc3548f40f61da0091c1c"
        },
        "setup_fee": null,
        "payment_terms": "",
        "createdAt": "2018-01-09T07:40:27.852Z",
        "updatedAt": "2018-01-09T07:40:27.862Z",
        "payment_method": "5a5471eaa872a21608b06104",
        "id": "5a5471eba872a21608b06106"
    }
}

27. List All Transactions By Customer Id:

Request Example:

GET https://payments.pabbly.com/api/v1/transactions/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
    "status": "success",
    "message": "Transactions data",
    "data": [
        {
            "user_id": "5a4b5db47cfab6872a7feafa",
            "type": "payment",
            "status": "success",
            "amount": "99",
            "description": "Payment create",
            "transaction": {
                "on_test_gateway": true,
                "created_at": "2018-01-02T12:16:05Z",
                "updated_at": "2018-01-02T12:16:05Z",
                "succeeded": true,
                "state": "succeeded",
                "token": "IPvlssXzEuAMs6cTeZrtvRppbrJ",
                "transaction_type": "Purchase",
                "order_id": null,
                "ip": null,
                "description": null,
                "email": null,
                "merchant_name_descriptor": null,
                "merchant_location_descriptor": null,
                "gateway_specific_fields": null,
                "gateway_specific_response_fields": {},
                "gateway_transaction_id": "51",
                "gateway_latency_ms": 0,
                "amount": 9900,
                "currency_code": "USD",
                "retain_on_success": false,
                "payment_method_added": false,
                "message_key": "messages.transaction_succeeded",
                "message": "Succeeded!",
                "gateway_token": "Pbape1Z3LswxvIbWa23P26Q5x74",
                "gateway_type": "test",
                "response": {
                    "success": true,
                    "message": "Successful purchase",
                    "avs_code": null,
                    "avs_message": null,
                    "cvv_code": null,
                    "cvv_message": null,
                    "pending": false,
                    "result_unknown": false,
                    "error_code": "",
                    "error_detail": null,
                    "cancelled": false,
                    "fraud_review": null,
                    "created_at": "2018-01-02T12:16:05Z",
                    "updated_at": "2018-01-02T12:16:05Z"
                },
                "shipping_address": {
                    "name": null,
                    "address1": null,
                    "address2": null,
                    "city": null,
                    "state": null,
                    "zip": null,
                    "country": null,
                    "phone_number": null
                },
                "api_urls": [
                    {
                        "referencing_transaction": []
                    }
                ],
                "payment_method": {
                    "token": "IVjOg56CBsPn5sse1xRULxUTG6D",
                    "created_at": "2018-01-02T12:16:05Z",
                    "updated_at": "2018-01-02T12:16:05Z",
                    "gateway_type": "test",
                    "storage_state": "retained",
                    "third_party_token": "test_vault:4111111111111111",
                    "payment_method_type": "third_party_token",
                    "errors": []
                }
            },
            "pcustomer_id": "5a4b776f7cfab6872a7feb06",
            "createdAt": "2018-01-02T12:16:05.491Z",
            "updatedAt": "2018-01-02T12:16:05.503Z",
            "customer_id": "5a4b78053152df337d841348",
            "id": "5a4b78053152df337d841347"
        },
        {
            "user_id": "5a4b5db47cfab6872a7feafa",
            "customer_id": "5a4b78053152df337d841348",
            "type": "invoice",
            "status": "paid",
            "reference_number": "5a4b78053152df337d84134a",
            "amount": "99",
            "description": "Invoice paid",
            "pcustomer_id": "5a4b776f7cfab6872a7feb06",
            "createdAt": "2018-01-02T12:16:05.547Z",
            "updatedAt": "2018-01-02T12:16:05.547Z",
            "id": "5a4b78053152df337d84134b"
        }
    ]
}

28. List All Refund By Customer Id:

Request Example:

GET https://payments.pabbly.com/api/v1/refund/{customer_id}

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Response Example:

{
   "status": "success",
   "message": "Refund data",
   "data": [
       {
           "customer_id": "5b02662c7f65100c0c4fbd53",
           "subscription_id": "5b02662c7f65100c0c4fbd54",
           "invoice_id": "5b0266787f65100c0c4fbd5c",
           "plan_id": "5afaaef21dc9a63cbd50c44f",
           "product_id": "5afaaecf1dc9a63cbd50c44e",
           "type": "refund",
           "type_formated": "Refund",
           "status": "success",
           "status_formatted": "Success",
           "amount": 105,
           "reference_id": "5b0266797f65100c0c4fbd5e",
           "description": "Refund created",
           "gateway_type": "Stripe",
           "createdAt": "2018-05-21T06:36:22.004Z",
           "updatedAt": "2018-05-21T06:36:22.004Z",
           "id": "5b0268e67f65100c0c4fbd61"
       },
       {
           "customer_id": "5b02662c7f65100c0c4fbd53",
           "subscription_id": "5b02662c7f65100c0c4fbd54",
           "invoice_id": "5b02665a7f65100c0c4fbd59",
           "plan_id": "5afaaef21dc9a63cbd50c44f",
           "product_id": "5afaaecf1dc9a63cbd50c44e",
           "type": "refund",
           "type_formated": "Refund",
           "status": "success",
           "status_formatted": "Success",
           "amount": 60,
           "reference_id": "5b02665b7f65100c0c4fbd5b",
           "description": "Refund created",
           "gateway_type": "Stripe",
           "createdAt": "2018-05-21T06:36:41.312Z",
           "updatedAt": "2018-05-21T06:36:41.312Z",
           "id": "5b0268f97f65100c0c4fbd62"
       }
   ]
}

29. Create Client Portal API Session:

Request Example:

POST https://payments.pabbly.com/api/v1/portal_sessions/

Authorization Type: Basic auth

User Name: apikey

Password: secretkey

Form data:

{
	"customer_id":"5b59717ef3d917676e219db1"
}

Response Example:

{
    "status": "success",
    "message": "Portal token created successfully",
    "data": {
        "token": "$2a$10$Vel9B9FMpmY2LhEgslgu/OzLy56SBqK8dK745J18CAL8comddS1oS",
        "status": "created",
        "customer_id": "5b59717ef3d917676e219db1",
        "access_url": "http://localhost:5000/portal/access/magnetbrains?tk=$2a$10$Vel9B9FMpmY2LhEgslgu/OzLy56SBqK8dK745J18CAL8comddS1oS",
        "expires_at": "2018-07-29T12:15:44.444Z",
        "createdAt": "2018-07-28T12:15:44.323Z",
        "updatedAt": "2018-07-28T12:15:44.323Z",
        "id": "5b5c5e70d98aa73767aa8e1b"
    }
}

Note: After the successful response, you have to redirect to the {access_url} that will be logged in on customer portal without asking user’s email and password.