> For the complete documentation index, see [llms.txt](https://docs.asyncpay.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.asyncpay.io/api-reference/subscription-plans.md).

# Subscription Plans

The subscription plan API allows you to manage the plans that you can subscribe customers to in your business.

## Create Subscription Plan

> This endpoint creates a new subscription plan. You can then create subscribe your customers to these plans and Asyncpay would automatically charge them at the next billing cycle; so you don't need to run any cronjobs or schedulers on your end.\
> \
> We offer several flexible options for creating recurring charges for your customers. We offer different intervals such as \`daily\`, \`weekly\`, \`monthly\`, \`quarterly\`, \`biannually\` and \`annually\`.\
> \
> You can also specify a custom trial period if you want customers subscribed in trial mode to have a different duration from the regular billing cycle period. You can set the number of days you want trials to run with the \`trial\_period\` field.\
> \
> You can also build on top of our intervals to create truly flexible interval periods with the \`interval\_count\` field. We calculate your customer's billing cycle by multiplying the \`interval\_count\` by the \`interval\` duration. e.g, if you want your customer's subscription to run every two months, instead of monthly, you can use an \`interval\` of monthly, and \`interval\_count\` of 2. Asyncpay would calculate the billing cycle as 2 \* 30, meaning we would charge this customer every 60 days.

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans":{"post":{"summary":"Create Subscription Plan","deprecated":false,"description":"This endpoint creates a new subscription plan. You can then create subscribe your customers to these plans and Asyncpay would automatically charge them at the next billing cycle; so you don't need to run any cronjobs or schedulers on your end.\n\nWe offer several flexible options for creating recurring charges for your customers. We offer different intervals such as `daily`, `weekly`, `monthly`, `quarterly`, `biannually` and `annually`.\n\nYou can also specify a custom trial period if you want customers subscribed in trial mode to have a different duration from the regular billing cycle period. You can set the number of days you want trials to run with the `trial_period` field.\n\nYou can also build on top of our intervals to create truly flexible interval periods with the `interval_count` field. We calculate your customer's billing cycle by multiplying the `interval_count` by the `interval` duration. e.g, if you want your customer's subscription to run every two months, instead of monthly, you can use an `interval` of monthly, and `interval_count` of 2. Asyncpay would calculate the billing cycle as 2 * 30, meaning we would charge this customer every 60 days.","tags":["Subscription Plans"],"parameters":[{"name":"Authentication","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"The name of the subscription plan. Subscription plan names must be unique within the same business."},"interval":{"type":"string","description":"How frequently we should charge subscribers to this plan. Supported values are `daily`, `weekly`, `monthly`, `quarterly`, `biannually` and `annually`"},"amount":{"anyOf":[{"type":"string"},{"type":"number"}],"description":"The amount we should charge at every billing cycle."},"currency":{"type":["string","null"],"description":"The currency of the amount we should charge. If this is not set, we would default to the business' base currency"},"trial_period":{"type":"integer","description":"The number of days you want a trial period of this plan to run. If this value is not set, then a trial subscription would run for the default interval period. e.g a monthly plan in trial mode will run in trial for 30 days."},"initial_amount":{"anyOf":[{"type":"string"},{"type":"number"}],"description":"The amount we should charge the customer the first time. After the first billing cycle, we would charge the value you set for the amount on all subsequent billing cycles. An example usecase for this can be domain name registration; where the first year is cheaper than subsequent years."},"interval_count":{"type":"string","description":"This field allows you to create very flexible subscription plans. When this field is set, we multiply this value by the interval period to get the next billing date. For instance, if you want to charge your customers every two months; you can set `interval_count` to 2, and `interval` to monthly. When we want to calculate the next billing date, we would multiply the `interval_count` by the `interval` period, resulting in 60 days. Meaning we would charge the customer every 60 days. The same rule applies to all the intervals."},"meta_data":{"type":"object","properties":{},"description":"An arbitrary object to store additional data for the payment request"}},"required":["name","interval","amount","trial_period","interval_count","meta_data"]}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"subscription_plan":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"name":{"type":"string"},"tags":{"type":"null"},"send_subscription_mails":{"type":"integer"},"initial_amount":{"type":"null"},"initial_amount_to_usd":{"type":"null"},"trial_period":{"type":"null"},"amount":{"type":"string"},"amount_to_usd":{"type":"null"},"currency":{"type":"string"},"interval":{"type":"string"},"interval_count":{"type":"null"},"link_id":{"type":"string"},"meta_data":{"type":"null"},"status":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"total_subscribers":{"type":"integer"},"total_subscription_payments":{"type":"integer"},"number_of_subscription_payments":{"type":"integer"}},"required":["uuid","env_mode","name","tags","send_subscription_mails","initial_amount","initial_amount_to_usd","trial_period","amount","amount_to_usd","currency","interval","interval_count","link_id","meta_data","status","deleted_at","created_at","updated_at","total_subscribers","total_subscription_payments","number_of_subscription_payments"]}},"required":["subscription_plan"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```

## List Subscription Plans

> This endpoint provides a paginated list of all the subscription plans that a business has.

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans":{"get":{"summary":"List Subscription Plans","deprecated":false,"description":"This endpoint provides a paginated list of all the subscription plans that a business has.","tags":["Subscription Plans"],"parameters":[{"name":"page","in":"query","description":"Defines the page of the subscription plans to fetch","required":false,"schema":{"type":"string"}},{"name":"per_page","in":"query","description":"Defines the number of items to return on each page","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"subscription_plans":{"type":"array","items":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"name":{"type":"string"},"tags":{"type":"null"},"send_subscription_mails":{"type":"integer"},"initial_amount":{"type":"null"},"initial_amount_to_usd":{"type":"string"},"trial_period":{"type":"null"},"amount":{"type":"string"},"amount_to_usd":{"type":"string"},"currency":{"type":"string"},"interval":{"type":"string"},"interval_count":{"type":["integer","null"]},"link_id":{"type":"string"},"meta_data":{"type":"null"},"status":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"total_subscribers":{"type":"integer"},"total_subscription_payments":{"type":"integer"},"number_of_subscription_payments":{"type":"integer"}},"required":["uuid","env_mode","name","tags","send_subscription_mails","initial_amount","initial_amount_to_usd","trial_period","amount","amount_to_usd","currency","interval","interval_count","link_id","meta_data","status","deleted_at","created_at","updated_at","total_subscribers","total_subscription_payments","number_of_subscription_payments"]}}},"required":["subscription_plans"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```

## Fetch Subscription Plan

> This endpoint fetches a single subscription plan from the subscription plan UUID

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans/{SubscriptionUUID}":{"get":{"summary":"Fetch Subscription Plan","deprecated":false,"description":"This endpoint fetches a single subscription plan from the subscription plan UUID","tags":["Subscription Plans"],"parameters":[{"name":"SubscriptionUUID","in":"path","description":"The UUID of the subscription plan you want to fetch","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"subscription_plan":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"name":{"type":"string"},"tags":{"type":"null"},"send_subscription_mails":{"type":"integer"},"initial_amount":{"type":"null"},"initial_amount_to_usd":{"type":"string"},"trial_period":{"type":"null"},"amount":{"type":"string"},"amount_to_usd":{"type":"string"},"currency":{"type":"string"},"interval":{"type":"string"},"interval_count":{"type":["integer","null"]},"link_id":{"type":"string"},"meta_data":{"type":"null"},"status":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"total_subscribers":{"type":"integer"},"total_subscription_payments":{"type":"integer"},"number_of_subscription_payments":{"type":"integer"}},"required":["uuid","env_mode","name","tags","send_subscription_mails","initial_amount","initial_amount_to_usd","trial_period","amount","amount_to_usd","currency","interval","interval_count","link_id","meta_data","status","deleted_at","created_at","updated_at","total_subscribers","total_subscription_payments","number_of_subscription_payments"]}},"required":["subscription_plan"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```

## Fetch Subscription Plan Subscriptions

> This endpoint fetches a paginated list of all the subscriptions (or subscribers) that a subscription plan has.

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans/{SubscriptionUUID}/subscriptions":{"get":{"summary":"Fetch Subscription Plan Subscriptions","deprecated":false,"description":"This endpoint fetches a paginated list of all the subscriptions (or subscribers) that a subscription plan has.","tags":["Subscription Plans"],"parameters":[{"name":"SubscriptionUUID","in":"path","description":"The UUID of the subscription plan that you want to fetch the subscriptions for","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"subscriptions":{"type":"array","items":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"status":{"type":"string"},"cancelled_at":{"type":["string","null"]},"cancellation_completed":{"type":"integer"},"cancellation_reason":{"type":["string","null"]},"next_payment_at":{"type":"string"},"last_successful_payment_at":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"last_termination_id":{"type":"null"},"payments_count":{"type":"integer"},"customer":{"type":"object","properties":{"customer_id":{"type":"string"},"uuid":{"type":"string"},"env_mode":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"name":{"type":"null"},"external_customer_ids":{"type":"object","properties":{"paystack":{"type":"integer"}},"required":["paystack"]},"email":{"type":"string"},"phone_code":{"type":"string"},"phone_number":{"type":"string"},"address_line_1":{"type":"string"},"address_line_2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"},"country":{"type":"string"},"meta_data":{"type":"object","properties":{"uid":{"type":"string"},"status":{"type":"string"}},"required":["uid","status"]},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"full_name":{"type":"string"}},"required":["customer_id","uuid","env_mode","first_name","last_name","name","external_customer_ids","email","phone_code","phone_number","address_line_1","address_line_2","city","state","zip","country","meta_data","deleted_at","created_at","updated_at","full_name"]}},"required":["uuid","env_mode","status","cancelled_at","cancellation_completed","cancellation_reason","next_payment_at","last_successful_payment_at","deleted_at","created_at","updated_at","last_termination_id","payments_count","customer"]}}},"required":["subscriptions"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```

## Activate subscription plan

> This endpoint activates a previously deactivated subscription plan.\
> \
> You cannot subscribe your customers to an inactive subscription plan.

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans/{SubscriptionUUID}/activate":{"patch":{"summary":"Activate subscription plan","deprecated":false,"description":"This endpoint activates a previously deactivated subscription plan.\n\nYou cannot subscribe your customers to an inactive subscription plan.","tags":["Subscription Plans"],"parameters":[{"name":"SubscriptionUUID","in":"path","description":"The UUID of the subscription plan you want to activate.","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"subscription_plan":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"name":{"type":"string"},"tags":{"type":["array","null"],"items":{"type":"string"}},"send_subscription_mails":{"type":"integer"},"initial_amount":{"type":["string","null"]},"initial_amount_to_usd":{"type":"string"},"trial_period":{"type":["string","null"]},"amount":{"type":"string"},"amount_to_usd":{"type":"string"},"currency":{"type":"string"},"interval":{"type":"string"},"interval_count":{"type":"integer"},"link_id":{"type":"string"},"meta_data":{"type":["object","null"],"properties":{}},"status":{"type":"string"},"deleted_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"total_subscribers":{"type":"integer"},"total_subscription_payments":{"type":"integer"},"number_of_subscription_payments":{"type":"integer"},"active_subscriptions":{"type":"array","items":{"type":"string"}}},"required":["uuid","env_mode","name","tags","send_subscription_mails","initial_amount","initial_amount_to_usd","trial_period","amount","amount_to_usd","currency","interval","interval_count","link_id","meta_data","status","deleted_at","created_at","updated_at","total_subscribers","total_subscription_payments","number_of_subscription_payments","active_subscriptions"]}},"required":["subscription_plan"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```

## Deactivate Subscription Plan

> This endpoint deactivates a subscription plan. When a subscription plan is inactive, you cannot subscribe a customer to the subscription plan.

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans/{SubscriptionUUID}/deactivate":{"patch":{"summary":"Deactivate Subscription Plan","deprecated":false,"description":"This endpoint deactivates a subscription plan. When a subscription plan is inactive, you cannot subscribe a customer to the subscription plan.","tags":["Subscription Plans"],"parameters":[{"name":"SubscriptionUUID","in":"path","description":"The UUID of the subscription plan you want to deactivate","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"subscription_plan":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"name":{"type":"string"},"tags":{"type":["array","null"],"items":{"type":"string"}},"send_subscription_mails":{"type":"integer"},"initial_amount":{"type":["string","null"]},"initial_amount_to_usd":{"type":"string"},"trial_period":{"type":["string","null"]},"amount":{"type":"string"},"amount_to_usd":{"type":"string"},"currency":{"type":"string"},"interval":{"type":"string"},"interval_count":{"type":"null"},"link_id":{"type":"string"},"meta_data":{"type":"null"},"status":{"type":"string"},"deleted_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"total_subscribers":{"type":"integer"},"total_subscription_payments":{"type":"integer"},"number_of_subscription_payments":{"type":"integer"},"active_subscriptions":{"type":"array","items":{"type":"string"}}},"required":["uuid","env_mode","name","tags","send_subscription_mails","initial_amount","initial_amount_to_usd","trial_period","amount","amount_to_usd","currency","interval","interval_count","link_id","meta_data","status","deleted_at","created_at","updated_at","total_subscribers","total_subscription_payments","number_of_subscription_payments","active_subscriptions"]}},"required":["subscription_plan"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```

## Update Subscription Plan

> This endpoint updates a subscription plan.\
> \
> If a plan already has subscriptions attached to it, then updates such as amount, interval, etc, would only take effect on the next billing cycle of the subscribed customer. \
> \
> N.B. This means that different customers can have the effect of this change at different times, since the change would only take effect when that particular customer's next billing cycle reaches.

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans/{SubscriptionUUID}":{"put":{"summary":"Update Subscription Plan","deprecated":false,"description":"This endpoint updates a subscription plan.\n\nIf a plan already has subscriptions attached to it, then updates such as amount, interval, etc, would only take effect on the next billing cycle of the subscribed customer. \n\nN.B. This means that different customers can have the effect of this change at different times, since the change would only take effect when that particular customer's next billing cycle reaches.","tags":["Subscription Plans"],"parameters":[{"name":"SubscriptionUUID","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"Authentication","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":["string","null"],"description":"The name of the subscription plan. Subscription plan names must be unique within the same business."},"interval":{"type":["string","null"],"description":"How frequently we should charge subscribers to this plan. Supported values are `daily`, `weekly`, `monthly`, `quarterly`, `biannually` and `annually`"},"amount":{"anyOf":[{"type":"string"},{"type":"number"}],"description":"The amount we should charge at every billing cycle."},"currency":{"type":["string","null"],"description":"The currency of the amount we should charge. If this is not set, we would default to the business' base currency"},"trial_period":{"type":["integer","null"],"description":"The number of days you want a trial period of this plan to run. If this value is not set, then a trial subscription would run for the default interval period. e.g a monthly plan in trial mode will run in trial for 30 days."},"initial_amount":{"anyOf":[{"type":"string"},{"type":"number"}],"description":"The amount we should charge the customer the first time. After the first billing cycle, we would charge the value you set for the amount on all subsequent billing cycles. An example usecase for this can be domain name registration; where the first year is cheaper than subsequent years."},"interval_count":{"type":["string","null"],"description":"This field allows you to create very flexible subscription plans. When this field is set, we multiply this value by the interval period to get the next billing date. For instance, if you want to charge your customers every two months; you can set `interval_count` to 2, and `interval` to monthly. When we want to calculate the next billing date, we would multiply the `interval_count` by the `interval` period, resulting in 60 days. Meaning we would charge the customer every 60 days. The same rule applies to all the intervals."},"meta_data":{"type":["object","null"],"properties":{},"description":"An arbitrary object to store additional data for the payment request"}}}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"subscription_plan":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"name":{"type":"string"},"tags":{"type":"null"},"send_subscription_mails":{"type":"integer"},"initial_amount":{"type":"null"},"initial_amount_to_usd":{"type":"string"},"trial_period":{"type":"null"},"amount":{"type":"string"},"amount_to_usd":{"type":"string"},"currency":{"type":"string"},"interval":{"type":"string"},"interval_count":{"type":"integer"},"link_id":{"type":"string"},"meta_data":{"type":"null"},"status":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"total_subscribers":{"type":"integer"},"total_subscription_payments":{"type":"integer"},"number_of_subscription_payments":{"type":"integer"}},"required":["uuid","env_mode","name","tags","send_subscription_mails","initial_amount","initial_amount_to_usd","trial_period","amount","amount_to_usd","currency","interval","interval_count","link_id","meta_data","status","deleted_at","created_at","updated_at","total_subscribers","total_subscription_payments","number_of_subscription_payments"]}},"required":["subscription_plan"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```

## Cancel all subscriptions

> This endpoint cancels all the subscriptions on a subscription plan.\
> \
> When a subscription plan is cancelled, it is not immediately terminated. It just means that the subscriptions on this plan will be queued to be terminated when the current billing cycle ends for each subscription on this plan.

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans/{SubscriptionUUID}/cancel-all-subscriptions":{"post":{"summary":"Cancel all subscriptions","deprecated":false,"description":"This endpoint cancels all the subscriptions on a subscription plan.\n\nWhen a subscription plan is cancelled, it is not immediately terminated. It just means that the subscriptions on this plan will be queued to be terminated when the current billing cycle ends for each subscription on this plan.","tags":["Subscription Plans"],"parameters":[{"name":"SubscriptionUUID","in":"path","description":"The UUID of the subscription plan whose subscritions you want to cancel","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"subscriptionPlan":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"name":{"type":"string"},"amount":{"type":"string"},"currency":{"type":"string"},"interval":{"type":"string"},"collect_phone_numbers":{"type":"integer"},"link_id":{"type":"string"},"status":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"total_subscribers":{"type":"integer"},"total_subscription_payments":{"type":"integer"},"number_of_subscription_payments":{"type":"integer"},"active_subscriptions":{"type":"array","items":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"status":{"type":"string"},"cancelled_at":{"type":"string"},"cancellation_completed":{"type":"integer"},"cancellation_reason":{"type":"string"},"next_payment_at":{"type":"string"},"last_successful_payment_at":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer":{"type":"object","properties":{"customer_id":{"type":"string"},"uuid":{"type":"string"},"env_mode":{"type":"string"},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":"string"},"phone_code":{"type":["string","null"]},"phone_number":{"type":["string","null"]},"address_line_1":{"type":["string","null"]},"address_line_2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"zip":{"type":["string","null"]},"country":{"type":["string","null"]},"meta_data":{"type":["object","null"],"properties":{"uid":{"type":"string"},"status":{"type":"string"}},"required":["uid","status"]},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["customer_id","uuid","env_mode","first_name","last_name","email","phone_code","phone_number","address_line_1","address_line_2","city","state","zip","country","meta_data","deleted_at","created_at","updated_at"]}},"required":["uuid","env_mode","status","cancelled_at","cancellation_completed","cancellation_reason","next_payment_at","last_successful_payment_at","deleted_at","created_at","updated_at","customer"]}}},"required":["uuid","env_mode","name","amount","currency","interval","collect_phone_numbers","link_id","status","deleted_at","created_at","updated_at","total_subscribers","total_subscription_payments","number_of_subscription_payments","active_subscriptions"]},"affected_subscriptions":{"type":"array","items":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"status":{"type":"string"},"cancelled_at":{"type":"string"},"cancellation_completed":{"type":"integer"},"cancellation_reason":{"type":"string"},"next_payment_at":{"type":"string"},"last_successful_payment_at":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"customer":{"type":"object","properties":{"customer_id":{"type":"string"},"uuid":{"type":"string"},"env_mode":{"type":"string"},"first_name":{"type":["string","null"]},"last_name":{"type":["string","null"]},"email":{"type":"string"},"phone_code":{"type":["string","null"]},"phone_number":{"type":["string","null"]},"address_line_1":{"type":["string","null"]},"address_line_2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"zip":{"type":["string","null"]},"country":{"type":["string","null"]},"meta_data":{"type":["object","null"],"properties":{"uid":{"type":"string"},"status":{"type":"string"}},"required":["uid","status"]},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["customer_id","uuid","env_mode","first_name","last_name","email","phone_code","phone_number","address_line_1","address_line_2","city","state","zip","country","meta_data","deleted_at","created_at","updated_at"]}},"required":["uuid","env_mode","status","cancelled_at","cancellation_completed","cancellation_reason","next_payment_at","last_successful_payment_at","deleted_at","created_at","updated_at","customer"]}}},"required":["subscriptionPlan","affected_subscriptions"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```

## Fetch Subscription Plan Payments

> This endpoint fetches all the payments that have been made for a subscription plan.

```json
{"openapi":"3.1.0","info":{"title":"Public APIs","version":"1.0.0"},"tags":[{"name":"Subscription Plans"}],"security":[{"apikey-header-Authentication":[]}],"components":{"securitySchemes":{"apikey-header-Authentication":{"type":"apiKey","in":"header","name":"Authentication"}}},"paths":{"/v1/subscription-plans/{SubscriptionUUID}/payments":{"get":{"summary":"Fetch Subscription Plan Payments","deprecated":false,"description":"This endpoint fetches all the payments that have been made for a subscription plan.","tags":["Subscription Plans"],"parameters":[{"name":"SubscriptionUUID","in":"path","description":"The UUID of the subscription plan whose payments you want to fetch.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"string"},"data":{"type":"object","properties":{"payments":{"type":"array","items":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"amount_charged":{"type":"string"},"amount_charged_to_usd":{"type":"string"},"was_successful":{"type":"boolean"},"failure_message":{"type":"null"},"currency":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"deleted_at":{"type":"null"},"subscription":{"type":"object","properties":{"uuid":{"type":"string"},"env_mode":{"type":"string"},"status":{"type":"string"},"cancelled_at":{"type":"string"},"cancellation_completed":{"type":"integer"},"cancellation_reason":{"type":"string"},"next_payment_at":{"type":"string"},"last_successful_payment_at":{"type":"string"},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"last_termination_id":{"type":"null"},"payments_count":{"type":"integer"},"customer":{"type":"object","properties":{"customer_id":{"type":"string"},"uuid":{"type":"string"},"env_mode":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"name":{"type":"null"},"external_customer_ids":{"type":"object","properties":{"paystack":{"type":"integer"}},"required":["paystack"]},"email":{"type":"string"},"phone_code":{"type":"string"},"phone_number":{"type":"string"},"address_line_1":{"type":"string"},"address_line_2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"},"country":{"type":"string"},"meta_data":{"type":"object","properties":{"uid":{"type":"string"},"status":{"type":"string"}},"required":["uid","status"]},"deleted_at":{"type":"null"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"full_name":{"type":"string"}},"required":["customer_id","uuid","env_mode","first_name","last_name","name","external_customer_ids","email","phone_code","phone_number","address_line_1","address_line_2","city","state","zip","country","meta_data","deleted_at","created_at","updated_at","full_name"]}},"required":["uuid","env_mode","status","cancelled_at","cancellation_completed","cancellation_reason","next_payment_at","last_successful_payment_at","deleted_at","created_at","updated_at","last_termination_id","payments_count","customer"]}},"required":["uuid","env_mode","amount_charged","amount_charged_to_usd","was_successful","failure_message","currency","created_at","updated_at","deleted_at","subscription"]}}},"required":["payments"]}},"required":["message","status","data"]}}},"headers":{}}}}}}}
```
