curl -X POST 'https://api.weir.ai/org/subscribe' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"cardId": "card_123456789",
"amount": 99.99,
"subscriptionId": "sub_plan_123"
}'
{
"data": {
"subscriptionId": "sub_123456789",
"planId": "sub_plan_123",
"status": "active",
"startDate": "2024-01-22T00:00:00Z",
"nextBillingDate": "2024-02-22T00:00:00Z",
"amount": 99.99,
"currency": "USD"
},
"message": "Subscription created successfully",
"status": "success"
}
Console APIs - Organization
Subscribe to Plan
Subscribe to a subscription plan
POST
/
org
/
subscribe
curl -X POST 'https://api.weir.ai/org/subscribe' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"cardId": "card_123456789",
"amount": 99.99,
"subscriptionId": "sub_plan_123"
}'
{
"data": {
"subscriptionId": "sub_123456789",
"planId": "sub_plan_123",
"status": "active",
"startDate": "2024-01-22T00:00:00Z",
"nextBillingDate": "2024-02-22T00:00:00Z",
"amount": 99.99,
"currency": "USD"
},
"message": "Subscription created successfully",
"status": "success"
}
Subscribe to Plan
Subscribe your organization to a subscription plan using a payment method.curl -X POST 'https://api.weir.ai/org/subscribe' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"cardId": "card_123456789",
"amount": 99.99,
"subscriptionId": "sub_plan_123"
}'
{
"data": {
"subscriptionId": "sub_123456789",
"planId": "sub_plan_123",
"status": "active",
"startDate": "2024-01-22T00:00:00Z",
"nextBillingDate": "2024-02-22T00:00:00Z",
"amount": 99.99,
"currency": "USD"
},
"message": "Subscription created successfully",
"status": "success"
}
Request Body
string
required
Payment card ID to use for the subscription.
number
required
Subscription amount.
string
required
Subscription plan ID to subscribe to.
Usage Examples
const subscribe = async (subscriptionData, accessToken) => {
const response = await fetch('https://api.weir.ai/org/subscribe', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'x-source': 'console'
},
body: JSON.stringify(subscriptionData)
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
};
import requests
def subscribe(subscription_data, access_token):
response = requests.post(
'https://api.weir.ai/org/subscribe',
headers={
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json',
'x-source': 'console'
},
json=subscription_data
)
response.raise_for_status()
return response.json()
Was this page helpful?