Actalink Docs
Acta billings/Subscription

New Subscription

API endpoint that is used to create subscription.

POST
/api/newsubscription

Authorization

acta-session<token>

Session key to identify user session.

In: cookie

Request Body

application/jsonRequired
titleRequiredstring

Title of the subscription.

tokensRequiredarray<string>

ERC20 tokens allowed for subscription payments.

plansRequiredarray<object>

Plans for subscription.

receiversRequiredarray<object>

The recipient's address for receiving subscription payments.

linktreestring

Linktree URL

Format: "uri"
trialDaysinteger

The number of allowed trial days during which the consumer will not be charged.

curl -X POST "http://localhost:4000/api/newsubscription" \
  -H "acta-session: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Hooli music",
    "tokens": [
      "<ERC20 token address>"
    ],
    "plans": [
      {
        "name": "plan1",
        "frequency": "week",
        "volume": 15,
        "price": 1
      }
    ],
    "receivers": [
      {
        "address": "<Receiver address>",
        "networkId": 137
      }
    ],
    "linktree": "https://example.linktree.com",
    "trialDays": 30
  }'

New Subscription created successfully

{
  "message": "new subscription cretaed successfully",
  "paymentlinkId": "e980d5dd-2e82-45ef-80c9-f74ed0531c43",
  "subscriptionId": "9db33829-a3ae-4f03-a5a3-36411bd49d3b"
}