curl --request POST \
--url https://coreapi.io/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"periods": [
{
"contractPeriod": "1M",
"cancellationPeriod": "1M"
}
],
"customer": "ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e",
"billingGroup": "b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b",
"billingStart": "2025-01-01T00:00:00+00:00",
"startDate": "2025-01-01T00:00:00+00:00",
"endDate": "2026-01-01T00:00:00+00:00",
"poNumber": "PO-2025-001",
"paymentMethod": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a",
"invoiceAddress": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a",
"name": "My subscription",
"number": "#12345678",
"externalId": "12345678",
"products": [
{
"product": "f1a2b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c",
"quantity": 1,
"customPricePlan": {
"type": "flat_fee",
"currencyCode": "EUR",
"price": {
"amount": 123
},
"internalName": "Exclusive pricing for partners.",
"applyTrial": true,
"payInAdvance": true,
"proRata": true,
"freeUnits": 1,
"billingInterval": "1M",
"showPricePerInterval": "1M"
},
"pricePlan": "a2b3c4d5-6e7f-4a8b-9c0d-1e2f3a4b5c6d",
"periods": [
{
"contractPeriod": "1M",
"cancellationPeriod": "1M"
}
],
"customName": "My custom name",
"customDescription": "My custom description",
"children": "<array>",
"discount": {
"name": "My discount",
"coupon": "https://example.com/",
"fixedAmount": {
"amount": 10.29,
"currency": "EUR"
},
"frequency": "once",
"frequencyInterval": 1,
"percentage": 10.29,
"type": "fixed_amount"
},
"contractDetails": {
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z"
},
"billingStart": "2025-01-01T00:00:00+00:00",
"productGroup": "e4f5a6b7-8c9d-4e0f-1a2b-3c4d5e6f7a8b",
"autoAssignProductGroup": false
}
],
"customFields": {
"field1": "value1",
"field2": "value2"
},
"deliveryAddress": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a"
}
'import requests
url = "https://coreapi.io/subscriptions"
payload = {
"periods": [
{
"contractPeriod": "1M",
"cancellationPeriod": "1M"
}
],
"customer": "ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e",
"billingGroup": "b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b",
"billingStart": "2025-01-01T00:00:00+00:00",
"startDate": "2025-01-01T00:00:00+00:00",
"endDate": "2026-01-01T00:00:00+00:00",
"poNumber": "PO-2025-001",
"paymentMethod": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a",
"invoiceAddress": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a",
"name": "My subscription",
"number": "#12345678",
"externalId": "12345678",
"products": [
{
"product": "f1a2b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c",
"quantity": 1,
"customPricePlan": {
"type": "flat_fee",
"currencyCode": "EUR",
"price": { "amount": 123 },
"internalName": "Exclusive pricing for partners.",
"applyTrial": True,
"payInAdvance": True,
"proRata": True,
"freeUnits": 1,
"billingInterval": "1M",
"showPricePerInterval": "1M"
},
"pricePlan": "a2b3c4d5-6e7f-4a8b-9c0d-1e2f3a4b5c6d",
"periods": [
{
"contractPeriod": "1M",
"cancellationPeriod": "1M"
}
],
"customName": "My custom name",
"customDescription": "My custom description",
"children": "<array>",
"discount": {
"name": "My discount",
"coupon": "https://example.com/",
"fixedAmount": {
"amount": 10.29,
"currency": "EUR"
},
"frequency": "once",
"frequencyInterval": 1,
"percentage": 10.29,
"type": "fixed_amount"
},
"contractDetails": {
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z"
},
"billingStart": "2025-01-01T00:00:00+00:00",
"productGroup": "e4f5a6b7-8c9d-4e0f-1a2b-3c4d5e6f7a8b",
"autoAssignProductGroup": False
}
],
"customFields": {
"field1": "value1",
"field2": "value2"
},
"deliveryAddress": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
periods: [{contractPeriod: '1M', cancellationPeriod: '1M'}],
customer: 'ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e',
billingGroup: 'b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b',
billingStart: '2025-01-01T00:00:00+00:00',
startDate: '2025-01-01T00:00:00+00:00',
endDate: '2026-01-01T00:00:00+00:00',
poNumber: 'PO-2025-001',
paymentMethod: 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a',
invoiceAddress: 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a',
name: 'My subscription',
number: '#12345678',
externalId: '12345678',
products: [
{
product: 'f1a2b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c',
quantity: 1,
customPricePlan: {
type: 'flat_fee',
currencyCode: 'EUR',
price: {amount: 123},
internalName: 'Exclusive pricing for partners.',
applyTrial: true,
payInAdvance: true,
proRata: true,
freeUnits: 1,
billingInterval: '1M',
showPricePerInterval: '1M'
},
pricePlan: 'a2b3c4d5-6e7f-4a8b-9c0d-1e2f3a4b5c6d',
periods: [{contractPeriod: '1M', cancellationPeriod: '1M'}],
customName: 'My custom name',
customDescription: 'My custom description',
children: '<array>',
discount: {
name: 'My discount',
coupon: 'https://example.com/',
fixedAmount: {amount: 10.29, currency: 'EUR'},
frequency: 'once',
frequencyInterval: 1,
percentage: 10.29,
type: 'fixed_amount'
},
contractDetails: {contractStart: '2023-11-07T05:31:56Z', contractEnd: '2023-11-07T05:31:56Z'},
billingStart: '2025-01-01T00:00:00+00:00',
productGroup: 'e4f5a6b7-8c9d-4e0f-1a2b-3c4d5e6f7a8b',
autoAssignProductGroup: false
}
],
customFields: {field1: 'value1', field2: 'value2'},
deliveryAddress: 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a'
})
};
fetch('https://coreapi.io/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'periods' => [
[
'contractPeriod' => '1M',
'cancellationPeriod' => '1M'
]
],
'customer' => 'ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e',
'billingGroup' => 'b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b',
'billingStart' => '2025-01-01T00:00:00+00:00',
'startDate' => '2025-01-01T00:00:00+00:00',
'endDate' => '2026-01-01T00:00:00+00:00',
'poNumber' => 'PO-2025-001',
'paymentMethod' => 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a',
'invoiceAddress' => 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a',
'name' => 'My subscription',
'number' => '#12345678',
'externalId' => '12345678',
'products' => [
[
'product' => 'f1a2b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c',
'quantity' => 1,
'customPricePlan' => [
'type' => 'flat_fee',
'currencyCode' => 'EUR',
'price' => [
'amount' => 123
],
'internalName' => 'Exclusive pricing for partners.',
'applyTrial' => true,
'payInAdvance' => true,
'proRata' => true,
'freeUnits' => 1,
'billingInterval' => '1M',
'showPricePerInterval' => '1M'
],
'pricePlan' => 'a2b3c4d5-6e7f-4a8b-9c0d-1e2f3a4b5c6d',
'periods' => [
[
'contractPeriod' => '1M',
'cancellationPeriod' => '1M'
]
],
'customName' => 'My custom name',
'customDescription' => 'My custom description',
'children' => '<array>',
'discount' => [
'name' => 'My discount',
'coupon' => 'https://example.com/',
'fixedAmount' => [
'amount' => 10.29,
'currency' => 'EUR'
],
'frequency' => 'once',
'frequencyInterval' => 1,
'percentage' => 10.29,
'type' => 'fixed_amount'
],
'contractDetails' => [
'contractStart' => '2023-11-07T05:31:56Z',
'contractEnd' => '2023-11-07T05:31:56Z'
],
'billingStart' => '2025-01-01T00:00:00+00:00',
'productGroup' => 'e4f5a6b7-8c9d-4e0f-1a2b-3c4d5e6f7a8b',
'autoAssignProductGroup' => false
]
],
'customFields' => [
'field1' => 'value1',
'field2' => 'value2'
],
'deliveryAddress' => 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"externalId": "<string>",
"paymentMethod": {
"id": "c1a2b3c4-d5e6-4f7a-8b9b-0c1d2e3f4a5b",
"default": true,
"status": "active",
"enabled": true,
"name": "Visa (4242)",
"creationDate": "2024-01-15T10:30:00+00:00",
"expirationDate": "2026-12-31T23:59:59+00:00",
"card": {
"brand": "Visa",
"last4": "4242",
"expMonth": 12,
"expYear": 2022,
"cardHolder": "Max Mustermann"
},
"sepaDebit": {
"iban": "DE8937*********3232",
"bic": "COBADEFFXXX",
"mandateReference": "MNDT-2021-123456",
"signingDate": "2021-01-01T00:00:00+00:00"
},
"paypal": {
"email": "max@mustermann.de",
"billingAgreementId": "I-1J5gqz2eZvKYlo2C2X2X2X2X"
}
},
"invoiceAddress": {
"id": "<string>",
"vatId": "DE123456789",
"type": "TYPE_DEFAULT",
"default": "true",
"status": "active",
"city": "Berlin",
"zip": "12345",
"street": "Musterstraße",
"houseNumber": "1a",
"countryCode": "DE",
"companyName": "ACME Inc.",
"salutation": "Herr",
"addition": "c/o John Doe",
"costCentre": "123456789",
"firstName": "John",
"lastName": "Doe"
},
"number": "S-00000001",
"customer": {
"id": "00000000-0000-0000-0000-000000000000",
"customerNumber": "CUSTOMER-000",
"timeZone": "Europe/Berlin",
"firstName": "John",
"lastName": "Doe",
"currencyCode": "EUR",
"companyName": "Acme Inc.",
"datevId": "123456789",
"status": "STATUS_ACTIVE"
},
"plan": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"family": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "basic-m2023",
"originProduct": {
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"taxGroup": {},
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"name": "Basic",
"description": "For small teams.",
"internalName": "Basic (Weekly)",
"costCentre": {},
"customFields": {
"field1": "value1",
"field2": "value2"
}
},
"allowCheckout": true,
"status": "draft",
"changeBehaviour": "upgradeable_and_downgradeable",
"changeApplyBehaviour": "end_of_period",
"createdAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"description": "<string>"
},
"name": "Fitness M",
"items": [
{
"id": "01F9ZQZJZJQZJZJZJZJZJZJZJZ",
"parent": "<unknown>",
"plan": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"family": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "basic-m2023",
"originProduct": {
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"taxGroup": {},
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"name": "Basic",
"description": "For small teams.",
"internalName": "Basic (Weekly)",
"costCentre": {},
"customFields": {
"field1": "value1",
"field2": "value2"
}
},
"allowCheckout": true,
"status": "draft",
"changeBehaviour": "upgradeable_and_downgradeable",
"changeApplyBehaviour": "end_of_period",
"createdAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"description": "<string>"
},
"measurementValues": [
{
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"quantity": 1,
"measuredAt": "2021-01-01T00:00:00+00:00"
}
],
"billing": {
"lastBilledAt": "2023-11-07T05:31:56Z",
"lastBilledTo": "2023-11-07T05:31:56Z",
"lastBilledFrom": "2023-11-07T05:31:56Z",
"nextBillingAt": "2023-11-07T05:31:56Z",
"billingInterval": "1M"
},
"name": "Fitness M",
"description": "Everything included",
"furtherInformation": "Additional agreements: The contract includes a free drink flatrate.",
"pricePlan": {
"type": "flat_fee",
"currencyCode": "EUR",
"price": {
"amount": 123,
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00",
"tenantId": "<string>"
},
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"internalName": "Exclusive pricing for partners.",
"status": "active",
"applyTrial": true,
"payInAdvance": true,
"proRata": true,
"freeUnits": 1,
"billingInterval": "1M",
"showPricePerInterval": "1M",
"custom": true,
"charge": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"productSetOption": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"inUse": true
},
"status": "active",
"product": {
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"taxGroup": {},
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"name": "Basic",
"description": "For small teams.",
"internalName": "Basic (Weekly)",
"costCentre": {},
"customFields": {
"field1": "value1",
"field2": "value2"
}
},
"appliedDiscounts": [
{
"id": "<string>",
"coupon": {
"code": "10OFF",
"name": "10% off",
"type": "percentage",
"frequency": "limited",
"id": "<string>",
"percentage": 10,
"fixedAmount": {},
"frequencyInterval": 3,
"isEnabled": true,
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"status": "active",
"discount": {
"name": "10% off",
"type": "percentage",
"frequency": "limited",
"percentage": 10,
"fixedAmount": {},
"frequencyInterval": 3
},
"appliedIntervals": 1
}
],
"periods": [
{
"id": "<string>",
"contractPeriodCount": 123,
"contractPeriod": {},
"cancellationPeriod": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"activatedAt": "2021-01-01T00:00:00+00:00",
"type": "addon",
"currentMeasurementValue": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"quantity": 1,
"measuredAt": "2021-01-01T00:00:00+00:00"
},
"inheritedPeriod": true
}
],
"billingGroup": {
"name": "Billing of payments at the end of the month",
"type": "end_of_month",
"id": "01F9ZQZJZJQZJZJZJZJZJZJZJZ",
"customDay": 31,
"customMonth": 12
},
"periods": [
{
"id": "<string>",
"contractPeriodCount": 123,
"contractPeriod": {},
"cancellationPeriod": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"status": "active",
"activatedAt": "2021-01-01T00:00:00+00:00",
"poNumber": "PO-00000001",
"contractDetails": {
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z"
},
"trialEndsOn": "2021-01-01T00:00:00+00:00",
"customFields": {
"field1": "value1",
"field2": "value2"
},
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00",
"defaultPaymentMethod": true,
"defaultInvoiceAddress": true,
"nextBillingDate": "2023-11-07T05:31:56Z",
"lastBillingAt": "2023-11-07T05:31:56Z",
"cancellationDate": "2023-11-07T05:31:56Z",
"cancelledAt": "2023-11-07T05:31:56Z",
"cancellationReason": {
"code": "<string>",
"name": "<string>",
"id": "<string>",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"isCancellationPending": true,
"nextPossibleCancellationDate": [
"<string>"
],
"partner": {
"id": "ad8f7e7d-3b3b-4b3b-8b3b-3b3b3b3b3b3b",
"name": "John Doe",
"number": "123456",
"email": "partner@example.com"
}
}Create subscription
Create a new subscription.
Required permissions:subscription:writecurl --request POST \
--url https://coreapi.io/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"periods": [
{
"contractPeriod": "1M",
"cancellationPeriod": "1M"
}
],
"customer": "ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e",
"billingGroup": "b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b",
"billingStart": "2025-01-01T00:00:00+00:00",
"startDate": "2025-01-01T00:00:00+00:00",
"endDate": "2026-01-01T00:00:00+00:00",
"poNumber": "PO-2025-001",
"paymentMethod": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a",
"invoiceAddress": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a",
"name": "My subscription",
"number": "#12345678",
"externalId": "12345678",
"products": [
{
"product": "f1a2b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c",
"quantity": 1,
"customPricePlan": {
"type": "flat_fee",
"currencyCode": "EUR",
"price": {
"amount": 123
},
"internalName": "Exclusive pricing for partners.",
"applyTrial": true,
"payInAdvance": true,
"proRata": true,
"freeUnits": 1,
"billingInterval": "1M",
"showPricePerInterval": "1M"
},
"pricePlan": "a2b3c4d5-6e7f-4a8b-9c0d-1e2f3a4b5c6d",
"periods": [
{
"contractPeriod": "1M",
"cancellationPeriod": "1M"
}
],
"customName": "My custom name",
"customDescription": "My custom description",
"children": "<array>",
"discount": {
"name": "My discount",
"coupon": "https://example.com/",
"fixedAmount": {
"amount": 10.29,
"currency": "EUR"
},
"frequency": "once",
"frequencyInterval": 1,
"percentage": 10.29,
"type": "fixed_amount"
},
"contractDetails": {
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z"
},
"billingStart": "2025-01-01T00:00:00+00:00",
"productGroup": "e4f5a6b7-8c9d-4e0f-1a2b-3c4d5e6f7a8b",
"autoAssignProductGroup": false
}
],
"customFields": {
"field1": "value1",
"field2": "value2"
},
"deliveryAddress": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a"
}
'import requests
url = "https://coreapi.io/subscriptions"
payload = {
"periods": [
{
"contractPeriod": "1M",
"cancellationPeriod": "1M"
}
],
"customer": "ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e",
"billingGroup": "b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b",
"billingStart": "2025-01-01T00:00:00+00:00",
"startDate": "2025-01-01T00:00:00+00:00",
"endDate": "2026-01-01T00:00:00+00:00",
"poNumber": "PO-2025-001",
"paymentMethod": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a",
"invoiceAddress": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a",
"name": "My subscription",
"number": "#12345678",
"externalId": "12345678",
"products": [
{
"product": "f1a2b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c",
"quantity": 1,
"customPricePlan": {
"type": "flat_fee",
"currencyCode": "EUR",
"price": { "amount": 123 },
"internalName": "Exclusive pricing for partners.",
"applyTrial": True,
"payInAdvance": True,
"proRata": True,
"freeUnits": 1,
"billingInterval": "1M",
"showPricePerInterval": "1M"
},
"pricePlan": "a2b3c4d5-6e7f-4a8b-9c0d-1e2f3a4b5c6d",
"periods": [
{
"contractPeriod": "1M",
"cancellationPeriod": "1M"
}
],
"customName": "My custom name",
"customDescription": "My custom description",
"children": "<array>",
"discount": {
"name": "My discount",
"coupon": "https://example.com/",
"fixedAmount": {
"amount": 10.29,
"currency": "EUR"
},
"frequency": "once",
"frequencyInterval": 1,
"percentage": 10.29,
"type": "fixed_amount"
},
"contractDetails": {
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z"
},
"billingStart": "2025-01-01T00:00:00+00:00",
"productGroup": "e4f5a6b7-8c9d-4e0f-1a2b-3c4d5e6f7a8b",
"autoAssignProductGroup": False
}
],
"customFields": {
"field1": "value1",
"field2": "value2"
},
"deliveryAddress": "ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
periods: [{contractPeriod: '1M', cancellationPeriod: '1M'}],
customer: 'ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e',
billingGroup: 'b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b',
billingStart: '2025-01-01T00:00:00+00:00',
startDate: '2025-01-01T00:00:00+00:00',
endDate: '2026-01-01T00:00:00+00:00',
poNumber: 'PO-2025-001',
paymentMethod: 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a',
invoiceAddress: 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a',
name: 'My subscription',
number: '#12345678',
externalId: '12345678',
products: [
{
product: 'f1a2b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c',
quantity: 1,
customPricePlan: {
type: 'flat_fee',
currencyCode: 'EUR',
price: {amount: 123},
internalName: 'Exclusive pricing for partners.',
applyTrial: true,
payInAdvance: true,
proRata: true,
freeUnits: 1,
billingInterval: '1M',
showPricePerInterval: '1M'
},
pricePlan: 'a2b3c4d5-6e7f-4a8b-9c0d-1e2f3a4b5c6d',
periods: [{contractPeriod: '1M', cancellationPeriod: '1M'}],
customName: 'My custom name',
customDescription: 'My custom description',
children: '<array>',
discount: {
name: 'My discount',
coupon: 'https://example.com/',
fixedAmount: {amount: 10.29, currency: 'EUR'},
frequency: 'once',
frequencyInterval: 1,
percentage: 10.29,
type: 'fixed_amount'
},
contractDetails: {contractStart: '2023-11-07T05:31:56Z', contractEnd: '2023-11-07T05:31:56Z'},
billingStart: '2025-01-01T00:00:00+00:00',
productGroup: 'e4f5a6b7-8c9d-4e0f-1a2b-3c4d5e6f7a8b',
autoAssignProductGroup: false
}
],
customFields: {field1: 'value1', field2: 'value2'},
deliveryAddress: 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a'
})
};
fetch('https://coreapi.io/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'periods' => [
[
'contractPeriod' => '1M',
'cancellationPeriod' => '1M'
]
],
'customer' => 'ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e',
'billingGroup' => 'b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b',
'billingStart' => '2025-01-01T00:00:00+00:00',
'startDate' => '2025-01-01T00:00:00+00:00',
'endDate' => '2026-01-01T00:00:00+00:00',
'poNumber' => 'PO-2025-001',
'paymentMethod' => 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a',
'invoiceAddress' => 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a',
'name' => 'My subscription',
'number' => '#12345678',
'externalId' => '12345678',
'products' => [
[
'product' => 'f1a2b3c4-5d6e-4f7a-8b9c-0d1e2f3a4b5c',
'quantity' => 1,
'customPricePlan' => [
'type' => 'flat_fee',
'currencyCode' => 'EUR',
'price' => [
'amount' => 123
],
'internalName' => 'Exclusive pricing for partners.',
'applyTrial' => true,
'payInAdvance' => true,
'proRata' => true,
'freeUnits' => 1,
'billingInterval' => '1M',
'showPricePerInterval' => '1M'
],
'pricePlan' => 'a2b3c4d5-6e7f-4a8b-9c0d-1e2f3a4b5c6d',
'periods' => [
[
'contractPeriod' => '1M',
'cancellationPeriod' => '1M'
]
],
'customName' => 'My custom name',
'customDescription' => 'My custom description',
'children' => '<array>',
'discount' => [
'name' => 'My discount',
'coupon' => 'https://example.com/',
'fixedAmount' => [
'amount' => 10.29,
'currency' => 'EUR'
],
'frequency' => 'once',
'frequencyInterval' => 1,
'percentage' => 10.29,
'type' => 'fixed_amount'
],
'contractDetails' => [
'contractStart' => '2023-11-07T05:31:56Z',
'contractEnd' => '2023-11-07T05:31:56Z'
],
'billingStart' => '2025-01-01T00:00:00+00:00',
'productGroup' => 'e4f5a6b7-8c9d-4e0f-1a2b-3c4d5e6f7a8b',
'autoAssignProductGroup' => false
]
],
'customFields' => [
'field1' => 'value1',
'field2' => 'value2'
],
'deliveryAddress' => 'ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"externalId": "<string>",
"paymentMethod": {
"id": "c1a2b3c4-d5e6-4f7a-8b9b-0c1d2e3f4a5b",
"default": true,
"status": "active",
"enabled": true,
"name": "Visa (4242)",
"creationDate": "2024-01-15T10:30:00+00:00",
"expirationDate": "2026-12-31T23:59:59+00:00",
"card": {
"brand": "Visa",
"last4": "4242",
"expMonth": 12,
"expYear": 2022,
"cardHolder": "Max Mustermann"
},
"sepaDebit": {
"iban": "DE8937*********3232",
"bic": "COBADEFFXXX",
"mandateReference": "MNDT-2021-123456",
"signingDate": "2021-01-01T00:00:00+00:00"
},
"paypal": {
"email": "max@mustermann.de",
"billingAgreementId": "I-1J5gqz2eZvKYlo2C2X2X2X2X"
}
},
"invoiceAddress": {
"id": "<string>",
"vatId": "DE123456789",
"type": "TYPE_DEFAULT",
"default": "true",
"status": "active",
"city": "Berlin",
"zip": "12345",
"street": "Musterstraße",
"houseNumber": "1a",
"countryCode": "DE",
"companyName": "ACME Inc.",
"salutation": "Herr",
"addition": "c/o John Doe",
"costCentre": "123456789",
"firstName": "John",
"lastName": "Doe"
},
"number": "S-00000001",
"customer": {
"id": "00000000-0000-0000-0000-000000000000",
"customerNumber": "CUSTOMER-000",
"timeZone": "Europe/Berlin",
"firstName": "John",
"lastName": "Doe",
"currencyCode": "EUR",
"companyName": "Acme Inc.",
"datevId": "123456789",
"status": "STATUS_ACTIVE"
},
"plan": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"family": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "basic-m2023",
"originProduct": {
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"taxGroup": {},
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"name": "Basic",
"description": "For small teams.",
"internalName": "Basic (Weekly)",
"costCentre": {},
"customFields": {
"field1": "value1",
"field2": "value2"
}
},
"allowCheckout": true,
"status": "draft",
"changeBehaviour": "upgradeable_and_downgradeable",
"changeApplyBehaviour": "end_of_period",
"createdAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"description": "<string>"
},
"name": "Fitness M",
"items": [
{
"id": "01F9ZQZJZJQZJZJZJZJZJZJZJZ",
"parent": "<unknown>",
"plan": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"family": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "basic-m2023",
"originProduct": {
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"taxGroup": {},
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"name": "Basic",
"description": "For small teams.",
"internalName": "Basic (Weekly)",
"costCentre": {},
"customFields": {
"field1": "value1",
"field2": "value2"
}
},
"allowCheckout": true,
"status": "draft",
"changeBehaviour": "upgradeable_and_downgradeable",
"changeApplyBehaviour": "end_of_period",
"createdAt": "2023-11-07T05:31:56Z",
"name": "<string>",
"description": "<string>"
},
"measurementValues": [
{
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"quantity": 1,
"measuredAt": "2021-01-01T00:00:00+00:00"
}
],
"billing": {
"lastBilledAt": "2023-11-07T05:31:56Z",
"lastBilledTo": "2023-11-07T05:31:56Z",
"lastBilledFrom": "2023-11-07T05:31:56Z",
"nextBillingAt": "2023-11-07T05:31:56Z",
"billingInterval": "1M"
},
"name": "Fitness M",
"description": "Everything included",
"furtherInformation": "Additional agreements: The contract includes a free drink flatrate.",
"pricePlan": {
"type": "flat_fee",
"currencyCode": "EUR",
"price": {
"amount": 123,
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00",
"tenantId": "<string>"
},
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"internalName": "Exclusive pricing for partners.",
"status": "active",
"applyTrial": true,
"payInAdvance": true,
"proRata": true,
"freeUnits": 1,
"billingInterval": "1M",
"showPricePerInterval": "1M",
"custom": true,
"charge": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"productSetOption": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"inUse": true
},
"status": "active",
"product": {
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"taxGroup": {},
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"name": "Basic",
"description": "For small teams.",
"internalName": "Basic (Weekly)",
"costCentre": {},
"customFields": {
"field1": "value1",
"field2": "value2"
}
},
"appliedDiscounts": [
{
"id": "<string>",
"coupon": {
"code": "10OFF",
"name": "10% off",
"type": "percentage",
"frequency": "limited",
"id": "<string>",
"percentage": 10,
"fixedAmount": {},
"frequencyInterval": 3,
"isEnabled": true,
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"status": "active",
"discount": {
"name": "10% off",
"type": "percentage",
"frequency": "limited",
"percentage": 10,
"fixedAmount": {},
"frequencyInterval": 3
},
"appliedIntervals": 1
}
],
"periods": [
{
"id": "<string>",
"contractPeriodCount": 123,
"contractPeriod": {},
"cancellationPeriod": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"activatedAt": "2021-01-01T00:00:00+00:00",
"type": "addon",
"currentMeasurementValue": {
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"measurement": {
"unit": {
"id": {},
"name": "Stück",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"code": "users",
"id": "ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b",
"description": "The number of users.",
"aggregationType": "sum",
"fairBilling": true,
"type": "recurring"
},
"quantity": 1,
"measuredAt": "2021-01-01T00:00:00+00:00"
},
"inheritedPeriod": true
}
],
"billingGroup": {
"name": "Billing of payments at the end of the month",
"type": "end_of_month",
"id": "01F9ZQZJZJQZJZJZJZJZJZJZJZ",
"customDay": 31,
"customMonth": 12
},
"periods": [
{
"id": "<string>",
"contractPeriodCount": 123,
"contractPeriod": {},
"cancellationPeriod": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
],
"status": "active",
"activatedAt": "2021-01-01T00:00:00+00:00",
"poNumber": "PO-00000001",
"contractDetails": {
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z"
},
"trialEndsOn": "2021-01-01T00:00:00+00:00",
"customFields": {
"field1": "value1",
"field2": "value2"
},
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00",
"defaultPaymentMethod": true,
"defaultInvoiceAddress": true,
"nextBillingDate": "2023-11-07T05:31:56Z",
"lastBillingAt": "2023-11-07T05:31:56Z",
"cancellationDate": "2023-11-07T05:31:56Z",
"cancelledAt": "2023-11-07T05:31:56Z",
"cancellationReason": {
"code": "<string>",
"name": "<string>",
"id": "<string>",
"createdAt": "2021-01-01T00:00:00+00:00",
"updatedAt": "2021-01-01T00:00:00+00:00"
},
"isCancellationPending": true,
"nextPossibleCancellationDate": [
"<string>"
],
"partner": {
"id": "ad8f7e7d-3b3b-4b3b-8b3b-3b3b3b3b3b3b",
"name": "John Doe",
"number": "123456",
"email": "partner@example.com"
}
}Autorisierungen
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The new Subscription resource
The contract period terms of the subscription.
1Show child attributes
Show child attributes
The customer who owns the subscription.
"ad8c7c0e-3b1a-4f5c-8b7a-5d5b6a4b2f1e"
The billing group of the subscription.
"b3e1f9a2-4c6d-4e8f-9a1b-2c3d4e5f6a7b"
The billing start date of the subscription. Fallback to the start date if not set.
"2025-01-01T00:00:00+00:00"
The start date of the subscription. If not set, the current date is used.
"2025-01-01T00:00:00+00:00"
The end date of the subscription. If not set, the subscription has no end date.
"2026-01-01T00:00:00+00:00"
The po number of the subscription.
255"PO-2025-001"
The payment method id to use for the subscription. If not set, the default payment method of the customer is used.
"ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a"
The invoice address of the customer. If not set, the default invoice address of the customer is used.
"ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a"
The name of the subscription. If not set, an empty string is used.
255"My subscription"
The number of the subscription. If not set, a unique number is generated. This number is used for the invoice and to display the subscription in the customer portal.
255"#12345678"
The external id of the subscription in the external system.
255"12345678"
The product selections which defines the items of the subscription.
Show child attributes
Show child attributes
Custom fields for the entity. The keys are the field names and the values are the field values. They need to be configured under "/custom-fields" in the API documentation. The input is validated against the configuration. For more details see Custom Fields Guide
Show child attributes
Show child attributes
{ "field1": "value1", "field2": "value2" }
The delivery address of the customer. If not set, the default address of the customer is used.
"ad8f1b9e-1b1a-4c5a-8b9a-0b9e1a8d1f8a"
Antwort
Subscription resource created
"ad8f1c2c-3b1c-4b0a-8b0a-0b0b0b0b0b0b"
The payment method of the subscription. If null, the default payment method of the customer is used.
Show child attributes
Show child attributes
The invoice address of the subscription. If null, the default invoice address of the customer is used.
Show child attributes
Show child attributes
The number of the subscription.
"S-00000001"
Show child attributes
Show child attributes
The plan this subscription is based on.
Show child attributes
Show child attributes
The name of the subscription. Defaults to the name of the plan. This will be used in the invoice for the grouping headers.
"Fitness M"
The selected items of the subscription. Can be charges or addons.
Show child attributes
Show child attributes
The billing group defines the billing cycle of the subscription.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The status of the subscription.
Possible values:
draft: The subscription is in draft mode and not active yet.active: The subscription is active and will be billed.paused: The subscription is paused and will not be billed.cancelled: The subscription is cancelled and will not be billed anymore.terminated: The subscription is terminated and will not be billed anymore.offer: The subscription is an offer and waiting for acceptance.
"active"
The date the subscription was activated.
"2021-01-01T00:00:00+00:00"
The po number of the subscription.
"PO-00000001"
The contract details of the subscription.
Show child attributes
Show child attributes
The date the trial period ends.
"2021-01-01T00:00:00+00:00"
Custom fields for the entity. The keys are the field names and the values are the field values. They need to be configured under "/custom-fields" in the API documentation. The input is validated against the configuration. For more details see Custom Fields Guide
Show child attributes
Show child attributes
{ "field1": "value1", "field2": "value2" }
The date and time when the resource was created.
"2021-01-01T00:00:00+00:00"
The date and time when the resource was last updated.
"2021-01-01T00:00:00+00:00"
The payment method is null, we use the default payment method of the customer.
The invoice address is null, we use the default invoice address of the customer.
The next billing date of the subscription.
The last billing date of the subscription.
The date the subscription will be cancelled.
The date when the subscription was cancelled.
The reason why the subscription was cancelled.
Show child attributes
Show child attributes
Indicates if the subscription is pending for cancellation. If true, the subscription will be cancelled in the future and the cancellation could be revoked.
The partner of the customer.
Show child attributes
Show child attributes
War diese Seite hilfreich?