Create a subscription
Creates a subscription without a payment.
tip
If you'd like to receive payment for a subscription, create a checkout link.
- Node SDK
- Fetch
- cURL
import { Salable } from '@salable/node-sdk';
const salable = new Salable('your-salable-api-key', 'v2');
const subscription = await salable.subscriptions.create({
planUuid: 'your-plan-uuid',
owner: 'orgId_1234',
granteeId: 'userId_1',
});
const response = await fetch("https://api.salable.app/subscriptions", {
method: "POST",
headers: {
"x-api-key": "your-salable-api-key",
version: "v2"
},
body: JSON.stringify({
planUuid: "a-plan-uuid",
granteeId: "id-of-grantee",
owner: "id-of-the-grantees-organisation"
});
})
const subscription = await response.json();
curl
-XPOST
-H 'x-api-key: your-salable-api-key'
-H 'version: v2'
-d '{ "planUuid": "a-plan-uuid", "granteeId": "id-of-grantee", "owner": "id-of-the-grantees-organisation" }'
'https://api.salable.app/subscriptions'