Creating an organization
Objective
The following guide is an introduction on how to create organization in Payments AI.
Organization
To create an organization inside the Payments AI for you you need to send an authenticated request to the PaymentsAI API
curl --location --request POST 'https://staging-api.payments.ai/v1/access-permits?accountId={{YOUR_ACCOUNT_ID}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: {{YOUR_API_KEY}}'
The response will be a JSON object with the following structure:
{
"type": "object",
"data": {
"redirectUrl": "https://staging.payments.ai/?sessionToken={{SESSION_TOKEN}}",
"organizationId": "6f326525-1586-479b-8176-55ba802caea4"
}
}
Organization is successfully created in Payments AI. You can now use it in your other requests.
organizationId
- is the identifier of the organization that you have created. Please store this value for future use.redirectUrl
- is the URL where you can redirect the user to create account in Payments AI app and assign it to the organization.
NOTE If you don't plan to create users in Payments AI, you can ignore
redirectUrl
field.
Creating user in Payments AI and assigning it to the organization
When you create organization in Payments AI, the response will contain a redirectUrl
field.
You can redirect the user to this URL to create an account in Payments AI and assign it to the organization.
This is a one-time URL and can be used only once. It includes a short-lived session token.
The user will be asked to either sign in or create an account in Payments AI. User will be automatically assigned to the organization that you have created.
Assigning user to already existing organization
If you have created organization and later want to assign a user to it, you can do it by sending an authenticated request to the PaymentsAI API
curl --location 'https://staging-api.payments.ai/v1/access-permits?accountId={{YOUR_ACCOUNT_ID}}' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: {{YOUR_API_KEY}}' \
--data '{
"organizationId": "{{ORGANIZATION_ID}}"
}'
The response will be a JSON object with the following structure:
{
"type": "object",
"data": {
"redirectUrl": "https://staging.payments.ai/?sessionToken={{SESSION_TOKEN}}",
"organizationId": "{{ORGANIZATION_ID}}"
}
}
You can redirect the user to this URL to create an account in Payments AI and assign it to the organization. This is a one-time URL and can be used only once. It includes a short-lived session token. The user will be asked to either sign in or create an account in Payments AI. User will be automatically assigned to the organization that you have created.