#Customers

This part of the API allows you to retrieve and update all your subscribers' information.

#Get a customer

  • Route: /customers/:customerId
  • Method: GET
Retrieves a customer's information.
⚠️ Some information may not be present in the response depending on the type of subscription attached to the customer.
Parameters
customerId
Type: String
Required
Customer ID
Example
curl https://api.poool.fr/api/v3/subscribe/customers/627e5c10e04d6671b9aa937a -G \
-d clientId="<your client id>" \
-d clientSecret="<your client secret>"
Result
{
"id": "627e5c10e04d6671b9aa937a",
"updatedAt": "2022-05-19T15:52:32.911Z",
"createdAt": "2022-05-13T13:24:32.641Z",
"sandbox": false,
"externalId": "627e5c11cf611adcdf27d80b",
"external": true,
"lastSignin": "2022-05-13T13:24:32.641Z",
"locale": "fr",
"lastName": "dupont",
"firstName": "françois",
"username": "fdupont@provider.fr",
"email": "fdupont@provider.fr",
"stripe": {
"id": "cus_LhTlgl0DfwdE9u"
},
"paymentMethod": {
"type": "card",
"number": "4242",
"expMonth": 11,
"expYear": 2022,
"brand": "visa",
"paymentMethodId": "pm_1L1VX9DLuAtgK44f7Z0Z0Z0Z",
},
"subscription": {
"id": "62825e0f51531d3d352c63a2",
"updatedAt": "2022-05-16T14:22:12.264Z",
"gateway": "stripe",
"status": "active",
"renewal": "automatic",
"renewedAt": "2022-05-16T14:22:07.097Z",
"createdAt": "2022-05-16T14:05:54.327Z",
"endAt": "2022-06-16T14:22:07.097Z",
"nextRenewal": "2022-06-16T14:22:07.097Z",
"sandbox": false,
"interval": "monthly",
"active": true,
"offer": {
"id": "6202400e76efa9210a2786e4",
"price": 1100,
"slug": "offre_starter",
"name": "offre starter"
},
"owner": "627e5c10e04d6671b9aa937a"
}
}

#Update a customer

  • Route: /customers/:customerId
  • Method: POST
Updates a customer's information.
⚠️ Some information may not be present in the response depending on the type of subscription attached to the customer.
Parameters
customerId
Type: String
Required
Customer ID
Body parameters
firstName
Type: String
First name
lastName
Type: String
Last name
email
Type: String
Email address
password
Type: String
Password
passwordRepeat
Type: String
Required
Password repeat (if password is set, this field is required)
Example
curl https://api.poool.fr/api/v3/subscribe/customers/627e5c10e04d6671b9aa937a \
-X POST \
-H "Content-Type: application/json" \
-d \
"
{
\"firstName\": \"John\",
\"lastName\": \"Doe\",
\"clientId\": \"<your client id>\",
\"clientSecret\": \"<your client secret>\"
}
"
Result
{
"id": "627e5c10e04d6671b9aa937a",
"updatedAt": "2022-05-19T15:52:32.911Z",
"createdAt": "2022-05-13T13:24:32.641Z",
"sandbox": false,
"externalId": "627e5c11cf611adcdf27d80b",
"external": true,
"lastSignin": "2022-05-13T13:24:32.641Z",
"locale": "fr",
"lastName": "doe",
"firstName": "john",
"username": "fdupont@provider.fr",
"email": "fdupont@provider.fr",
"stripe": {
"id": "cus_LhTlgl0DfwdE9u"
},
"paymentMethod": {
"type": "card",
"number": "4242",
"expMonth": 11,
"expYear": 2022,
"brand": "visa",
"paymentMethodId": "pm_1L1VX9DLuAtgK44f7Z0Z0Z0Z",
},
"subscription": {
"id": "62825e0f51531d3d352c63a2",
"updatedAt": "2022-05-16T14:22:12.264Z",
"gateway": "stripe",
"status": "active",
"renewal": "automatic",
"renewedAt": "2022-05-16T14:22:07.097Z",
"createdAt": "2022-05-16T14:05:54.327Z",
"endAt": "2022-06-16T14:22:07.097Z",
"nextRenewal": "2022-06-16T14:22:07.097Z",
"sandbox": false,
"interval": "monthly",
"active": true,
"offer": {
"id": "6202400e76efa9210a2786e4",
"price": 1100,
"slug": "offre_starter",
"name": "offre starter"
},
"owner": "627e5c10e04d6671b9aa937a"
}
}

#Link an existing subscription to a customer

  • Route: /subscribe/customers/:customerId/subscriptions/:gateway/add/external
  • Method: POST
Links a subscription that has already been created on your payment gateway (stripe, paypal, etc. ) to a customer.
Parameters
customerId
Type: String
Required
Customer ID
gateway
Type: String
Required
Payment gateway (stripe, paypal, etc..)
Body parameters for Stripe gateway
subscriptionId
Type: String
Required
Stripe subscription ID
priceId
Type: String
Required
Stripe price ID
Example
curl https://api.poool.fr/api/v3/subscribe/customers/627e5c10e04d6671b9aa937a/subscriptions/stripe/add/external \
-X POST \
-H "Content-Type: application/json" \
-d \
"
{
\"subscriptionId\": \"sub_1L1VX9DLuAtgK44fr82uvrZz\",
\"priceId\": \"price_1KQqYEDLuAtgK44ffEcFhtsP\",
\"clientId\": \"<your client id>\",
\"clientSecret\": \"<your client secret>\"
}
"
Result
{
"id": "627e5c10e04d6671b9aa937a",
"updatedAt": "2022-05-20T13:09:11.484Z",
"createdAt": "2022-05-13T13:24:32.641Z",
"sandbox": false,
"externalId": "627e5c11cf611adcdf27d80b",
"external": true,
"lastSignin": "2022-05-13T13:24:32.641Z",
"locale": "fr",
"lastName": "Doe",
"firstName": "John",
"username": "fdupont@provider.fr",
"email": "fdupont@provider.fr",
"stripe": {
"id": "cus_LixSMk8dQyach2"
},
"paymentMethod": {
"type": "card",
"number": "4242",
"expMonth": 11,
"expYear": 2022,
"brand": "visa",
"paymentMethodId": "pm_1L1VX9DLuAtgK44f7Z0Z0Z0Z",
},
"subscription": {
"id": "628792f6c5c5e12cbe9be8fd",
"updatedAt": "2022-05-20T13:09:11.161Z",
"renewedAt": "2022-05-20T13:09:11.160Z",
"gateway": "stripe",
"status": "active",
"createdAt": "2022-05-20T09:33:04.734Z",
"endAt": "2022-06-16T14:22:07.097Z",
"nextRenewal": "2022-06-16T14:22:07.097Z",
"sandbox": false,
"interval": "monthly",
"active": true,
"offer": {
"id": "6202400e76efa9210a2786e4",
"createdAt": "2022-02-08T10:03:58.207Z",
"stripe": {
"priceId": "price_1KQqYEDLuAtgK44ffEcFhtsP",
"productId": "prod_L74hJahNMWUVxk"
},
"advantages": [
"avantage 1",
"avantage 2"
],
"archived": false,
"taxRate": 20,
"currency": "eur",
"price": 1100,
"slug": "offre_starter",
"name": "offre starter"
},
"owner": "627e5c10e04d6671b9aa937a"
}
}

#Switch a subscription to a new offer

  • Route: /subscribe/customers/:customerId/subscriptions/:subscriptionId/change
  • Method: POST
Switches a customer's subscription to a new offer.
Parameters
customerId
Type: String
Required
Customer ID
subscriptionId
Type: String
Required
Subscription ID
Body parameters
offer
Type: String
Required
Offer ID or slug
opts.priceId
Type: String
Offer price (ID)
Example
curl https://api.poool.fr/api/v3/subscribe/customers/627e5c10e04d6671b9aa937a/subscriptions/628792f6c5c5e12cbe9be8fd/change \
-X POST \
-H "Content-Type: application/json" \
-d \
"
{
\"offer\": \"premium-offer\",
\"opts\": \"{\"price\":\"price_id\"}\",
\"clientId\": \"<your client id>\",
\"clientSecret\": \"<your client secret>\"
}
"
Result
{
"subscription": {
"id": "6287995c604e316f47c3b21e",
"updatedAt": "2022-05-20T13:39:37.316Z",
"gateway": "stripe",
"status": "active",
"renewal": "automatic",
"renewedAt": "2022-05-20T13:36:28.503Z",
"createdAt": "2022-05-20T13:32:52.613Z",
"endAt": "2022-06-16T14:22:07.097Z",
"nextRenewal": "2022-06-16T14:22:07.097Z",
"sandbox": false,
"interval": "monthly",
"active": true,
"offer": {
"id": "6202402a76efa9210a2786e6",
"createdAt": "2022-02-08T10:04:26.546Z",
"stripe": {
"priceId": "price_1KQqYhDLuAtgK44fXxHa9l7J",
"productId": "prod_L74iEBYPVYWbq0"
},
"advantages": [
"les avantages de 'starter'",
"avantage 3"
],
"archived": false,
"taxRate": 20,
"currency": "eur",
"price": 1500,
"slug": "offre_standard",
"name": "offre standard"
},
"nextOffer": {
"id": "6202400e76efa9210a2786e4",
"createdAt": "2022-02-08T10:03:58.207Z",
"stripe": {
"priceId": "price_1KQqYEDLuAtgK44ffEcFhtsP",
"productId": "prod_L74hJahNMWUVxk"
},
"advantages": [
"avantage 1",
"avantage 2"
],
"archived": false,
"taxRate": 20,
"currency": "eur",
"price": 1100,
"slug": "offre_starter",
"name": "offre starter"
},
"owner": {
"id": "6287922bc5c5e12cbe9be8fa",
"locale": "FR",
"lastName": "Doe",
"firstName": "John",
"username": "john.doe@provider.fr"
"email": "john.doe@provider.fr",
"stripe": {
"id": "cus_LixwgIeOg5Q1Py"
},
"paymentMethod": {
"type": "card",
"number": "4242",
"expMonth": 11,
"expYear": 2022,
"brand": "visa",
"paymentMethodId": "pm_1L1VX9DLuAtgK44f7Z0Z0Z0Z",
},
}
}
}

#Cancel a subscription

  • Route: /subscribe/customers/:customerId/subscriptions/:subscriptionId/cancel
  • Method: POST
Cancels a customer's subscription
Parameters
customerId
Type: String
Required
Customer ID
subscriptionId
Type: String
Required
Subscription ID
Example
curl https://api.poool.fr/api/v3/subscribe/customers/627e5c10e04d6671b9aa937a/subscriptions/628792f6c5c5e12cbe9be8fd/cancel \
-X POST \
-H "Content-Type: application/json" \
-d \
"
{
\"clientId\": \"<your client id>\",
\"clientSecret\": \"<your client secret>\"
}
"
Result
{
"subscription": {
"id": "6287995c604e316f47c3b21e",
"updatedAt": "2022-05-20T14:03:38.272Z",
"gateway": "stripe",
"status": "canceled",
"renewal": "automatic",
"renewedAt": "2022-05-20T13:36:28.503Z",
"createdAt": "2022-05-20T13:32:52.613Z",
"endAt": "2022-06-16T14:22:07.097Z",
"nextRenewal": "2022-06-16T14:22:07.097Z",
"sandbox": false,
"interval": "monthly",
"active": true,
"offer": {
"id": "6202402a76efa9210a2786e6",
"createdAt": "2022-02-08T10:04:26.546Z",
"stripe": {
"priceId": "price_1KQqYhDLuAtgK44fXxHa9l7J",
"productId": "prod_L74iEBYPVYWbq0"
},
"advantages": [
"les avantages de 'starter'",
"avantage 3"
],
"archived": false,
"taxRate": 20,
"currency": "eur",
"price": 1500,
"slug": "offre_standard",
"name": "offre standard"
},
"nextOffer": null,
"owner": {
"id": "6287922bc5c5e12cbe9be8fa",
"locale": "FR",
"firstName": "maxime",
"username": "maximed4@poool.fr",
"email": "maximed4@poool.fr",
"stripe": {
"id": "cus_LixwgIeOg5Q1Py"
},
"paymentMethod": {
"type": "card",
"number": "4242",
"expMonth": 11,
"expYear": 2022,
"brand": "visa",
"paymentMethodId": "pm_1L1VX9DLuAtgK44f7Z0Z0Z0Z",
},
}
}
}

#Reactivate a subscription

  • Route: /subscribe/customers/:customerId/subscriptions/:subscriptionId/reactivate
  • Method: POST
Reactivates a previously canceled customer's subscription
Parameters
customerId
Type: String
Required
Customer ID
subscriptionId
Type: String
Required
Subscription ID
Example
curl https://api.poool.fr/api/v3/subscribe/customers/627e5c10e04d6671b9aa937a/subscriptions/628792f6c5c5e12cbe9be8fd/reactivate \
-X POST \
-H "Content-Type: application/json" \
-d \
"
{
\"clientId\": \"<your client id>\",
\"clientSecret\": \"<your client secret>\"
}
"
Result
{
"subscription": {
"id": "6287995c604e316f47c3b21e",
"updatedAt": "2022-05-20T14:07:15.512Z",
"gateway": "stripe",
"status": "active",
"renewal": "automatic",
"renewedAt": "2022-05-20T13:36:28.503Z",
"createdAt": "2022-05-20T13:32:52.613Z",
"endAt": "2022-06-16T14:22:07.097Z",
"nextRenewal": "2022-06-16T14:22:07.097Z",
"sandbox": false,
"interval": "monthly",
"active": true,
"offer": {
"id": "6202402a76efa9210a2786e6",
"createdAt": "2022-02-08T10:04:26.546Z",
"stripe": {
"priceId": "price_1KQqYhDLuAtgK44fXxHa9l7J",
"productId": "prod_L74iEBYPVYWbq0"
},
"advantages": [
"les avantages de 'starter'",
"avantage 3"
],
"archived": false,
"taxRate": 20,
"currency": "eur",
"price": 1500,
"slug": "offre_standard",
"name": "offre standard"
},
"nextOffer": null,
"owner": {
"id": "6287922bc5c5e12cbe9be8fa",
"locale": "FR",
"firstName": "maxime",
"username": "maximed4@poool.fr",
"email": "maximed4@poool.fr",
"stripe": {
"id": "cus_LixwgIeOg5Q1Py"
},
"paymentMethod": {
"type": "card",
"number": "4242",
"expMonth": 11,
"expYear": 2022,
"brand": "visa",
"paymentMethodId": "pm_1L1VX9DLuAtgK44f7Z0Z0Z0Z",
},
}
}
}