Taking payments
Checkout links offer the quickest and simplest way to accept payments from your users.
- JS SDK
- Node SDK
- Fetch
- cURL
import { getCheckoutLink } from '@salable/js'
const { checkoutUrl } = await getCheckoutLink({
apiKey: 'your-salable-api-key',
planUuid: 'your-salable-plans-uuid',
successUrl: 'https://your.app/payment-success'
cancelUrl: 'https://your.app/payment-cancelled',
granteeId: 'your-grantees-id',
owner: 'your-grantees-organisation-id',
})
// Now you are free to present this `checkoutLink` to your user however you see
// fit.
// Don't forget to: npm install @salable/node-sdk
import { Salable } from '@salable/node-sdk';
const salable = new Salable('your-salable-api-key', 'v2');
const { checkoutUrl } = await salable.plans.getCheckoutLink('your-plan-uuid', {
successUrl: 'https://example.com/success',
cancelUrl: 'https://your.app/cancel',
granteeId: 'your-grantees-id',
owner: 'your-grantees-organisation-id',
});
const params = new URLSearchParams();
params.append("granteeId", "id-of-grantee");
params.append("owner", "id-of-the-grantees-organisation");
params.append("successUrl", "https://example.com/success");
params.append("cancelUrl", "https://example.com/cancel");
const response = await fetch(`https://api.salable.app/plans/your-plan-uuid/checkoutlink?${params}`, {
headers: {
"x-api-key": "your-salable-api-key",
version: "v2"
}
})
const checkout = await response.json();
curl
-XGET
-H 'x-api-key: your-salable-api-key'
-H 'version: v2'
'https://api.salable.app/plans/your-plan-uuid/checkoutlink?successUrl=https%3A%2F%2Fyour.app%2Fsuccess&cancelUrl=https%3A%2F%2Fyour.app%2Fcancel&granteeId=your-grantees-id&owner=your-grantees-organisation-id'
Option | Description | Required |
---|---|---|
successUrl | The url to redirect a customer after a successful checkout. | ✅ |
cancelUrl | The url to redirect a customer if they cancel the checkout. | ✅ |
granteeId | The ID of the grantee which will be assigned to the first seat of the subscription, for example the user ID or a board ID. If the subscription is per-seat all additional seats created will be unassigned. | ✅ |
owner | The ID of the customer's organisation. | ✅ |
For per-seat plans
On successful payment, the first seat will be assigned to the granteeId
provided - the rest will be unassigned.
To assign the rest of the seats, you can update seats.