Subscription service API documentation version v1
http://{slave}
Announced as subscription in Zookeeper
- slave: required(string)
/subscription/v1/subscription
get /subscription/v1/subscription
Headers
- Magine-PartnerId: required(string)
Partner id
Example:
magine
- Authorization: required(string)
Login JWT
HTTP status code 200
Body
Media type: application/json
Type: array of SubscriptionOutput
Items: SubscriptionOutput
- partnerId: required(string)
- offerId: required(string)
- userId: required(string)
- periodicity: required(string)
- startedAt: required(string)
- expiry: required(string)
- cancelledAt: (string)
- latestRenewal: (string)
- trialEnd: (string)
- status: required(one of trial, active, cancelled, expired)
- nextPrice: (object)
- currency: required(string)
- netAmountCents: required(integer)
- grossAmountCents: required(integer)
- promoCode: (object)
- code: required(string)
- consumedCount: required(integer)
Example:
[
{
"partnerId" : "example",
"offerId" : "6NBYG9ZA6DEXSULCVDQQCKGFEOFR",
"userId" : "0123456USR",
"periodicity" : "monthly",
"startedAt" : "2017-12-01T00:00:00Z",
"expiry" : "2018-02-01T00:00:00Z",
"latestRenewal" : "2018-01-01T00:00:00Z",
"status" : "active",
"promoCode" : {
"code" : "TEST",
"consumedCount" : 3
},
"trialEnd" : "2017-12-08T00:00:00Z",
"nextPrice" : {
"currency" : "EUR",
"netAmountCents" : 9,
"grossAmountCents" : 99
}
},
{
"partnerId" : "example",
"offerId" : "7NXG8ABCCDXUL233423AEUOHUOFR",
"userId" : "0123456USR",
"periodicity" : "yearly",
"startedAt" : "2017-12-01T00:00:00Z",
"expiry" : "2018-02-01T00:00:00Z",
"cancelledAt" : "2018-12-01T00:00:00Z",
"status" : "cancelled",
"trialEnd" : "2017-12-08T00:00:00Z"
}
]
HTTP status code 400
Bad request
HTTP status code 401
Invalid authorization header
/subscription/v1/subscription/{offerId}/cancel
post /subscription/v1/subscription/{offerId}/cancel
URI Parameters
- offerId: required(string)
Headers
- Magine-PartnerId: required(string)
Partner id
Example:
magine
- Authorization: required(string)
Login JWT
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- partnerId: required(string)
- offerId: required(string)
- userId: required(string)
- periodicity: required(string)
- startedAt: required(string)
- expiry: required(string)
- cancelledAt: (string)
- latestRenewal: (string)
- trialEnd: (string)
- status: required(one of trial, active, cancelled, expired)
- nextPrice: (object)
- currency: required(string)
- netAmountCents: required(integer)
- grossAmountCents: required(integer)
- promoCode: (object)
- code: required(string)
- consumedCount: required(integer)
Example:
{
"partnerId" : "example",
"offerId" : "6NBYG9ZA6DEXSULCVDQQCKGFEOFR",
"userId" : "0123456USR",
"periodicity" : "monthly",
"startedAt" : "2017-12-01T00:00:00Z",
"expiry" : "2018-02-01T00:00:00Z",
"latestRenewal" : "2018-01-01T00:00:00Z",
"status" : "active",
"promoCode" : {
"code" : "TEST",
"consumedCount" : 3
},
"trialEnd" : "2017-12-08T00:00:00Z",
"nextPrice" : {
"currency" : "EUR",
"netAmountCents" : 9,
"grossAmountCents" : 99
}
}
HTTP status code 400
Bad request
HTTP status code 401
Unauthorized
HTTP status code 404
Not found
/subscription/v1/subscription/{offerId}/uncancel
post /subscription/v1/subscription/{offerId}/uncancel
URI Parameters
- offerId: required(string)
Headers
- Magine-PartnerId: required(string)
Partner id
Example:
magine
- Authorization: required(string)
Login JWT
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- partnerId: required(string)
- offerId: required(string)
- userId: required(string)
- periodicity: required(string)
- startedAt: required(string)
- expiry: required(string)
- cancelledAt: (string)
- latestRenewal: (string)
- trialEnd: (string)
- status: required(one of trial, active, cancelled, expired)
- nextPrice: (object)
- currency: required(string)
- netAmountCents: required(integer)
- grossAmountCents: required(integer)
- promoCode: (object)
- code: required(string)
- consumedCount: required(integer)
Example:
{
"partnerId" : "example",
"offerId" : "6NBYG9ZA6DEXSULCVDQQCKGFEOFR",
"userId" : "0123456USR",
"periodicity" : "monthly",
"startedAt" : "2017-12-01T00:00:00Z",
"expiry" : "2018-02-01T00:00:00Z",
"latestRenewal" : "2018-01-01T00:00:00Z",
"status" : "active",
"promoCode" : {
"code" : "TEST",
"consumedCount" : 3
},
"trialEnd" : "2017-12-08T00:00:00Z",
"nextPrice" : {
"currency" : "EUR",
"netAmountCents" : 9,
"grossAmountCents" : 99
}
}
HTTP status code 400
Bad request
HTTP status code 401
Unauthorized
HTTP status code 404
Not found
/subscription/v1/user/{userId}/subscription
get /subscription/v1/user/{userId}/subscription
URI Parameters
- userId: required(string)
Headers
- Magine-PartnerId: required(string)
Partner id
Example:
magine
- Authorization: required(string)
Bearer internal
HTTP status code 200
Body
Media type: application/json
Type: array of SubscriptionOutput
Items: SubscriptionOutput
- partnerId: required(string)
- offerId: required(string)
- userId: required(string)
- periodicity: required(string)
- startedAt: required(string)
- expiry: required(string)
- cancelledAt: (string)
- latestRenewal: (string)
- trialEnd: (string)
- status: required(one of trial, active, cancelled, expired)
- nextPrice: (object)
- currency: required(string)
- netAmountCents: required(integer)
- grossAmountCents: required(integer)
- promoCode: (object)
- code: required(string)
- consumedCount: required(integer)
Example:
[
{
"partnerId" : "example",
"offerId" : "6NBYG9ZA6DEXSULCVDQQCKGFEOFR",
"userId" : "0123456USR",
"periodicity" : "monthly",
"startedAt" : "2017-12-01T00:00:00Z",
"expiry" : "2018-02-01T00:00:00Z",
"latestRenewal" : "2018-01-01T00:00:00Z",
"status" : "active",
"promoCode" : {
"code" : "TEST",
"consumedCount" : 3
},
"trialEnd" : "2017-12-08T00:00:00Z",
"nextPrice" : {
"currency" : "EUR",
"netAmountCents" : 9,
"grossAmountCents" : 99
}
},
{
"partnerId" : "example",
"offerId" : "7NXG8ABCCDXUL233423AEUOHUOFR",
"userId" : "0123456USR",
"periodicity" : "yearly",
"startedAt" : "2017-12-01T00:00:00Z",
"expiry" : "2018-02-01T00:00:00Z",
"cancelledAt" : "2018-12-01T00:00:00Z",
"status" : "cancelled",
"trialEnd" : "2017-12-08T00:00:00Z"
}
]
HTTP status code 400
Bad request
HTTP status code 401
Unauthorized
HTTP status code 404
Not Found
/subscription/v1/user/{userId}/subscription/{offerId}
delete /subscription/v1/user/{userId}/subscription/{offerId}
/subscription/v1/user/{userId}/subscription/{offerId}/cancel
post /subscription/v1/user/{userId}/subscription/{offerId}/cancel
URI Parameters
- userId: required(string)
- offerId: required(string)
Headers
- Magine-PartnerId: required(string)
Partner id
Example:
magine
- Authorization: required(string)
Bearer internal
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- partnerId: required(string)
- offerId: required(string)
- userId: required(string)
- periodicity: required(string)
- startedAt: required(string)
- expiry: required(string)
- cancelledAt: (string)
- latestRenewal: (string)
- trialEnd: (string)
- status: required(one of trial, active, cancelled, expired)
- nextPrice: (object)
- currency: required(string)
- netAmountCents: required(integer)
- grossAmountCents: required(integer)
- promoCode: (object)
- code: required(string)
- consumedCount: required(integer)
Example:
{
"partnerId" : "example",
"offerId" : "6NBYG9ZA6DEXSULCVDQQCKGFEOFR",
"userId" : "0123456USR",
"periodicity" : "monthly",
"startedAt" : "2017-12-01T00:00:00Z",
"expiry" : "2018-02-01T00:00:00Z",
"latestRenewal" : "2018-01-01T00:00:00Z",
"status" : "active",
"promoCode" : {
"code" : "TEST",
"consumedCount" : 3
},
"trialEnd" : "2017-12-08T00:00:00Z",
"nextPrice" : {
"currency" : "EUR",
"netAmountCents" : 9,
"grossAmountCents" : 99
}
}
HTTP status code 400
Bad request
HTTP status code 401
Unauthorized
HTTP status code 404
Not Found
/subscription/v1/user/{userId}/subscription/{offerId}/uncancel
post /subscription/v1/user/{userId}/subscription/{offerId}/uncancel
URI Parameters
- userId: required(string)
- offerId: required(string)
Headers
- Magine-PartnerId: required(string)
Partner id
Example:
magine
- Authorization: required(string)
Bearer internal
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- partnerId: required(string)
- offerId: required(string)
- userId: required(string)
- periodicity: required(string)
- startedAt: required(string)
- expiry: required(string)
- cancelledAt: (string)
- latestRenewal: (string)
- trialEnd: (string)
- status: required(one of trial, active, cancelled, expired)
- nextPrice: (object)
- currency: required(string)
- netAmountCents: required(integer)
- grossAmountCents: required(integer)
- promoCode: (object)
- code: required(string)
- consumedCount: required(integer)
Example:
{
"partnerId" : "example",
"offerId" : "6NBYG9ZA6DEXSULCVDQQCKGFEOFR",
"userId" : "0123456USR",
"periodicity" : "monthly",
"startedAt" : "2017-12-01T00:00:00Z",
"expiry" : "2018-02-01T00:00:00Z",
"latestRenewal" : "2018-01-01T00:00:00Z",
"status" : "active",
"promoCode" : {
"code" : "TEST",
"consumedCount" : 3
},
"trialEnd" : "2017-12-08T00:00:00Z",
"nextPrice" : {
"currency" : "EUR",
"netAmountCents" : 9,
"grossAmountCents" : 99
}
}
HTTP status code 400
Bad request
HTTP status code 401
Unauthorized
HTTP status code 404
Not Found
/subscription/v1/user/{userId}/subscription-history
get /subscription/v1/user/{userId}/subscription-history
URI Parameters
- userId: required(string)
Headers
- Magine-PartnerId: required(string)
Partner id
Example:
magine
- Authorization: required(string)
Bearer internal
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- history: required(object)
- /^.*OFR$/: required(array of SubscriptionHistoryOutput)
Items: SubscriptionHistoryOutput
- eventType: required(one of subscribed, cancelled, renewed, hardCancelled, uncancelled, renewalFailed)
- when: required(string)
- periodicity: (string)
- trialEnd: (string)
- promoCode: (string)
- /^.*OFR$/: required(array of SubscriptionHistoryOutput)
Example:
{
"history" : {
"6NBYG9ZA6DEXSULCVDQQCKGFEOFR" : [
{
"when" : "2017-12-01T00:00:00Z",
"periodicity" : "monthly",
"trialEnd" : "2018-02-01T00:00:00Z",
"promoCode" : "promo",
"eventType" : "subscribed"
},
{
"when" : "2017-12-01T00:00:00.001Z",
"eventType" : "cancelled"
},
{
"when" : "2017-12-01T00:00:00.002Z",
"periodicity" : "monthly",
"eventType" : "subscribed"
},
{
"when" : "2017-12-01T00:00:00.003Z",
"eventType" : "renewed"
}
],
"7NXG8ABCCDXUL233423AEUOHUOFR" : [
{
"when" : "2017-12-01T00:00:00Z",
"periodicity" : "monthly",
"eventType" : "subscribed"
},
{
"when" : "2017-12-01T00:00:00Z",
"eventType" : "hardCancelled"
},
{
"when" : "2017-12-01T00:00:00.001Z",
"eventType" : "uncancelled"
},
{
"when" : "2017-12-01T00:00:00.002Z",
"eventType" : "renewalFailed"
}
]
}
}
HTTP status code 400
Bad request
HTTP status code 401
Unauthorized
HTTP status code 404
Not Found