Activate your Subscription

The final step is to activate the subscription. When this is done Upodi will start billing the subscription according to the setup in Product Plan and Product Plan Charges and the quantities supplied to the subscription charges.

curl -X PUT \
  https://api.upodi.io/v3/subscriptions/{SubscriptionID}/activate \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {Base64EncodedAPIKey' \
  -H 'Content-Type: application/json' \
//Step 1 - set up Upodi client (If you haven't done so already)
UpodiService Upodi = new UpodiService("{APIKey}");

//Step 2 - activate the subscription using the SubscriptionID from the previous step.
Upodi.Subscriptions.Activate("{SubscriptionID}");

In just a short while you should be able to fetch the invoice:

curl -X GET \
  'https://api.upodi.io/v3/invoices/query?$filter=SubscriptionID eq guid'{SubscriptionID}'&$expand=InvoiceLines' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {Base64EncodedAPIKey}' \
  -H 'Content-Type: application/json' \
//Step 1 - set up Upodi client (If you haven't done so already)
UpodiService Upodi = new UpodiService("{APIKey}");

//Step 2 - look up the most recent invoice by SubscriptionID
var invoice = upodi.Invoices.List(all: true).Where(inv => inv.SubscriptionID == '{SubscriptionID}').FirstOrDefault();

The returned invoice should look something like this:

{
    "Items": [
        {
            "InvoiceLines": [
                {
                    "Title": "Product A",
                    "Description": "\r\n1 - 5\r\n5 stk.",
                    "SubscriptionChargeID": "guid",
                    "ProductPlanChargeID": "guid",
                    "LineNumber": 1,
                    "Quantity": 1,
                    "TaxExempt": false,
                    "TotalVat": 2.5,
                    "UnitPrice": 10,
                    "TotalPrice": 12.5,
                    "SKU": "1",
                    "Unit": "stk.",
                    "Discount": 0,
                    "DiscountAmount": 0,
                    "TotalPriceBaseCurrency": 12.5,
                    "TotalPriceExchangeRate": 1,
                    "PeriodStart": "2019-03-31T22:01:00Z",
                    "PeriodEnd": "2019-06-29T22:01:00Z",
                    "ID": "guid",
                    ...
                }
            ],
            "CustomerID": "guid",
            "SubscriptionID": "guid",
            "CurrencyCode": "DKK",
            "TotalAmount": 12.5,
            "Total": 10,
            "TotalVat": 2.5,
            "InvoiceDate": "2019-05-03T09:23:57Z",
            "InvoiceStatus": 10,
            "PaymentStatus": 20,
            "DueDate": "2019-05-04T09:23:57Z",
            "InvoiceNumber": "INV-049797",
            "ID": "guid",
            ...
        }
      ]
}