Create savings plan subscription
To create a savings plan subscription, perform the following request:
POST
/v1/savings/business/account-investment-plansRequest
The body must be sent in snake_case.
Headers
| Field | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Access token in Bearer ACCESS_TOKEN format |
Content-Type | string | Yes | Must be application/json |
Not applicable: Path Parameters, Query Parameters.
Body
Account identifier depends on plan currency
Exactly one of cvu or account_number must be provided, depending on the plan's currency:
- ARS plans: provide
cvu - USD plans: provide
account_number
Sending both fields or neither will result in a validation error.
| Field | Type | Required | Description |
|---|---|---|---|
cvu | number | Conditional | Account CVU. Required for ARS plans. |
account_number | number | Conditional | Account number. Required for USD plans. |
subscription_name | string | No | Subscription name. |
plan_id | number | Yes | Plan identifier. |
merchant | string | Yes | Merchant identifier. |
target_amount | number | Yes | Target amount for the plan. |
Response
2XX Success
| Field | Type | Description |
|---|---|---|
id | number | ID of the created subscription. |
message | string | Message confirming the result of the operation. |
Error Codes
Errors return the following body:
{
"code": "invalid_request",
"description": "Error description."
}
| Status | Code | Condition |
|---|---|---|
400 | invalid_request | The account already has an active subscription to the specified plan. |
400 | invalid_request | The merchant field was not sent in the request. |
400 | invalid_request | The account has no unused terms and conditions acceptance for this plan. Accept them first (each subscription needs its own acceptance) using the Accept terms and conditions endpoint with the same plan_id. |
400 | plan_not_accessible | The specified plan is not accessible for the authenticated merchant. |
403 | — | The token does not have the required role to operate this endpoint. |
Code Example
- cURL (ARS)
- cURL (USD)
- JavaScript
- Python
- Node.js
curl -X POST https://b2b.allaria.dev/v1/savings/business/account-investment-plans \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"cvu": 0000003100010000000001,
"subscription_name": "Monthly savings plan",
"plan_id": 10,
"merchant": "string",
"target_amount": 250000.00
}'
curl -X POST https://b2b.allaria.dev/v1/savings/business/account-investment-plans \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"account_number": 12345678,
"subscription_name": "Monthly savings plan",
"plan_id": 20,
"merchant": "string",
"target_amount": 1000.00
}'
const response = await fetch('https://b2b.allaria.dev/v1/savings/business/account-investment-plans', {
method: 'POST',
headers: {
'Authorization': 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
// For ARS plans use cvu, for USD plans use account_number
cvu: 0000003100010000000001,
subscription_name: 'Monthly savings plan',
plan_id: 10,
merchant: 'string',
target_amount: 250000.00
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
'https://b2b.allaria.dev/v1/savings/business/account-investment-plans',
headers={
'Authorization': 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
},
json={
# For ARS plans use cvu, for USD plans use account_number
'cvu': 0000003100010000000001,
'subscription_name': 'Monthly savings plan',
'plan_id': 10,
'merchant': 'string',
'target_amount': 250000.00
}
)
data = response.json()
print(data)
const axios = require('axios');
const response = await axios.post(
'https://b2b.allaria.dev/v1/savings/business/account-investment-plans',
{
// For ARS plans use cvu, for USD plans use account_number
cvu: 0000003100010000000001,
subscription_name: 'Monthly savings plan',
plan_id: 10,
merchant: 'string',
target_amount: 250000.00
},
{
headers: {
Authorization: 'Bearer ACCESS_TOKEN',
'Content-Type': 'application/json'
}
}
);
console.log(response.data);
2XX Success
{
"id": 1,
"message": "Subscription created successfully"
}