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

# Payment And Subscription

#### ***This API is in beta testing and not fully tested/released. Follow the Welkin release note for full feature availability.***

## Add payment method

> Attaches a Stripe payment method to a patient, creating a Stripe customer for the patient if one does not already exist, and creates a card SetupIntent for future off-session use. Requires the tenant to have the Stripe integration license enabled. Confirmed against \`welikan-payment-service\` (\`PaymentMethodController.attachPaymentMethod\`), routed via \`welikan-api-gateway-service\` with no field-level transformation.

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Payment and Subscription","description":"### _**This API is in beta testing and not fully tested/released. Follow the Welkin release note for full feature availability.**_"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}},"PatientId":{"name":"patientId","in":"path","required":true,"description":"UUID of the patient record","schema":{"type":"string","format":"uuid"}}},"schemas":{"AttachPaymentMethodResponse":{"type":"object","properties":{"paymentMethodId":{"type":"string"}}},"AttachPaymentMethodRequest":{"type":"object","required":["paymentMethodId"],"properties":{"paymentMethodId":{"type":"string","description":"Stripe PaymentMethod ID (e.g. `pm_...`)."}}}},"responses":{"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/payment/patients/{patientId}/payment-methods":{"post":{"summary":"Add payment method","tags":["Payment and Subscription"],"operationId":"Add_payment_method","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"},{"$ref":"#/components/parameters/PatientId"}],"responses":{"200":{"description":"Payment method attached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachPaymentMethodResponse"}}}},"400":{"description":"Invalid request, or the Stripe API call failed (e.g. invalid or expired paymentMethodId)."},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller lacks UPDATE permission on payment methods for this patient."},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"Attaches a Stripe payment method to a patient, creating a Stripe customer for the patient if one does not already exist, and creates a card SetupIntent for future off-session use. Requires the tenant to have the Stripe integration license enabled. Confirmed against `welikan-payment-service` (`PaymentMethodController.attachPaymentMethod`), routed via `welikan-api-gateway-service` with no field-level transformation.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachPaymentMethodRequest"}}}}}}}}
```

## Create subscription

> This endpoint allows you to create a new subscription for payment within a specific tenant and instance.\
> \
> \### Request Body\
> \
> \- \`name\` (string, required): The name of the subscription.\
> &#x20;   \
> \- \`billingPeriod\` (string, required): The billing period for the subscription.\
> &#x20;   \
> \- \`careMember\` (object, required): An object containing the ID of the care member.\
> &#x20;   \
> &#x20;   \- \`id\` (string): The ID of the care member.\
> &#x20;       \
> \- \`patient\` (object, required): An object containing the ID of the patient.\
> &#x20;   \
> &#x20;   \- \`id\` (string): The ID of the patient.\
> &#x20;       \
> \- \`paymentTypeInfo\` (object, required): An object containing the type of payment.\
> &#x20;   \
> &#x20;   \- \`paymentType\` (string): The type of payment for the subscription.\
> &#x20;       \
> \- \`price\` (object, required): An object containing the amount and currency of the subscription.\
> &#x20;   \
> &#x20;   \- \`amount\` (number): The amount of the subscription.\
> &#x20;       \
> &#x20;   \- \`currency\` (string): The currency of the subscription.\
> &#x20;       \
> \- \`startDate\` (string, required): The start date of the subscription.\
> &#x20;   \
> \- \`numberOfCycles\` (number, required): The number of billing cycles for the subscription.\
> &#x20;   \
> \
> \### Response\
> \
> Upon successful creation of the subscription, the response will contain the details of the newly created subscription.

```json
{"openapi":"3.0.3","info":{"title":"Welkin Health API","version":"1.0.0"},"tags":[{"name":"Payment and Subscription","description":"### _**This API is in beta testing and not fully tested/released. Follow the Welkin release note for full feature availability.**_"}],"servers":[{"url":"https://api.live.welkincloud.io","description":"Welkin Health production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Bearer token obtained from `POST /{tenantName}/admin/api_clients/{clientName}`. Valid for 60 minutes."}},"parameters":{"TenantName":{"name":"tenantName","in":"path","required":true,"description":"Your organization (tenant) name, e.g. `acme-health`","schema":{"type":"string"}},"InstanceName":{"name":"instanceName","in":"path","required":true,"description":"Your environment name: `live`, `sandbox`, or a custom name","schema":{"type":"string"}}},"schemas":{"Subscription":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"status":{"type":"string","description":"Commonly one of: NEW, ACTIVE, CANCELED, INCOMPLETE, INCOMPLETE_EXPIRED, PAST_DUE, PAUSED, TRIALING, UNPAID, COMPLETED, NOT_STARTED, RELEASED."},"pauseCollection":{"$ref":"#/components/schemas/PauseCollectionDetails","nullable":true}}},"PauseCollectionDetails":{"type":"object","properties":{"resumesAt":{"type":"string","format":"date-time","nullable":true,"description":"null means paused indefinitely."}}}},"responses":{"BadRequest":{"description":"Bad request — the request could not be understood or was missing required parameters."},"Unauthorized":{"description":"Unauthorized — the Bearer token is missing, expired, or invalid."},"Forbidden":{"description":"Forbidden — the API client role does not have permission for this resource. Check the role and security policy in Admin."},"NotFound":{"description":"Not found — the requested resource does not exist."},"TooManyRequests":{"description":"Too many requests — rate limit exceeded. Implement exponential backoff."},"InternalError":{"description":"Internal server error."}}},"paths":{"/{tenantName}/{instanceName}/payment/subscriptions":{"post":{"summary":"Create subscription","tags":["Payment and Subscription"],"operationId":"Create_subscription","parameters":[{"$ref":"#/components/parameters/TenantName"},{"$ref":"#/components/parameters/InstanceName"}],"responses":{"201":{"description":"Created subscription.\n\n**⚠️ Unverified:** no create/POST implementation for subscriptions was found in the backend — only a GET-by-id client to an external payment-service exists. The response schema is inferred from that client; the request body shape is unconfirmed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}},"description":"This endpoint allows you to create a new subscription for payment within a specific tenant and instance.\n\n### Request Body\n\n- `name` (string, required): The name of the subscription.\n    \n- `billingPeriod` (string, required): The billing period for the subscription.\n    \n- `careMember` (object, required): An object containing the ID of the care member.\n    \n    - `id` (string): The ID of the care member.\n        \n- `patient` (object, required): An object containing the ID of the patient.\n    \n    - `id` (string): The ID of the patient.\n        \n- `paymentTypeInfo` (object, required): An object containing the type of payment.\n    \n    - `paymentType` (string): The type of payment for the subscription.\n        \n- `price` (object, required): An object containing the amount and currency of the subscription.\n    \n    - `amount` (number): The amount of the subscription.\n        \n    - `currency` (string): The currency of the subscription.\n        \n- `startDate` (string, required): The start date of the subscription.\n    \n- `numberOfCycles` (number, required): The number of billing cycles for the subscription.\n    \n\n### Response\n\nUpon successful creation of the subscription, the response will contain the details of the newly created subscription.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"billingPeriod":{"type":"string"},"careMember":{"type":"object","properties":{"id":{"type":"string"}}},"patient":{"type":"object","properties":{"id":{"type":"string"}}},"paymentTypeInfo":{"type":"object","properties":{"paymentType":{"type":"string"}}},"price":{"type":"object","properties":{"amount":{"type":"integer"},"currency":{"type":"string"}}},"startDate":{"type":"string"},"numberOfCycles":{"type":"integer"}}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.welkinhealth.com/api-reference/payment-and-subscription.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
