AsyncAPI for subscription service 0.1.0 documentation
- Protobuf File Spec: ecommerce.proto
Published Messages (subscription)
The service publishes one of these messages below.
subscribed
Message is sent when user subscribe a subscription. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
}
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
cancelled
Message is sent when a subscription is cancelled. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
}
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
immediateCancelled
Message is sent when a subscription is cancelled immediately. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
}
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
resubscribed
Message is sent when user resubscribe a subscription. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
}
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
daysGranted
Message is sent when grant days to subscription. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
},
"grantDays": 0
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
grantDays | integer | - |
charged
Message is sent when billing is charged. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
},
"billing": {
"paymentProvider": "WALLET",
"paymentMethod": "string",
"amount": 0,
"totalTax": 0,
"totalPrice": 0,
"subtotalPrice": 0,
"recurringOrderNo": "string",
"paymentOrderNo": "string",
"txEndTime": "2019-08-24T14:15:22Z",
"extTxId": "string"
}
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
billing | billing | - |
chargeFailed
Message is sent when billing is charge failed. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
},
"billing": {
"paymentProvider": "WALLET",
"paymentMethod": "string",
"amount": 0,
"totalTax": 0,
"totalPrice": 0,
"subtotalPrice": 0,
"recurringOrderNo": "string",
"paymentOrderNo": "string",
"txEndTime": "2019-08-24T14:15:22Z",
"extTxId": "string"
}
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
billing | billing | - |
expired
Message is sent when subscription is expired. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
}
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
billingAccountChanged
Message is sent when billing account is changed. Contains fields from event and the following payload.
Example value
{
"payload": {
"subscription": {
"id": "string",
"namespace": "string",
"userId": "string",
"itemId": "string",
"sku": "string",
"title": "string",
"currency": {
"currencyCode": "string",
"currencySymbol": "string",
"currencyType": "REAL",
"namespace": "string",
"decimals": 0
},
"price": 0,
"trialPrice": 0,
"recurring": {
"cycle": "WEEKLY",
"fixedFreeDays": 0,
"fixedTrialCycles": 0,
"graceDays": 7
},
"status": "INIT",
"chargeStatus": "NEVER",
"nextBillingDate": "2019-08-24T14:15:22Z",
"currentPeriodStart": "2019-08-24T14:15:22Z",
"currentPeriodEnd": "2019-08-24T14:15:22Z",
"start": "2019-08-24T14:15:22Z",
"end": "2019-08-24T14:15:22Z",
"currentCycle": 0,
"chargedCycles": 0,
"trialedCycles": 0,
"inFixedFreeDays": true,
"inFixedCycleTrial": true,
"firstSubscribe": true,
"paid": true,
"subscribedBy": "USER",
"subscribedAt": "2019-08-24T14:15:22Z",
"unsubscribedAt": "2019-08-24T14:15:22Z",
"unsubscribeReason": "string",
"source": "string",
"region": "string",
"language": "string",
"sandbox": true,
"createdAt": "2019-08-24T14:15:22Z",
"updateAt": "2019-08-24T14:15:22Z"
},
"billing": {
"paymentProvider": "WALLET",
"paymentMethod": "string",
"amount": 0,
"totalTax": 0,
"totalPrice": 0,
"subtotalPrice": 0,
"recurringOrderNo": "string",
"paymentOrderNo": "string",
"txEndTime": "2019-08-24T14:15:22Z",
"extTxId": "string"
}
},
"id": "string",
"version": 0,
"name": "string",
"namespace": "string",
"parentNamespace": "string",
"timestamp": "2019-08-24T14:15:22Z",
"clientId": "string",
"userId": "string",
"traceId": "string",
"sessionId": "string"
}
payload
Name | Type | Description |
---|---|---|
subscription | subscription | - |
billing | billing | - |
Schemas
subscription
Name | Type | Description |
---|---|---|
id | string | id |
namespace | string | namespace |
userId | string | user id |
itemId | string | item id |
sku | string | sku |
title | string | title |
currency | object | - |
price | integer | normal price |
trialPrice | integer | trial price |
recurring | object | - |
status | string | status |
chargeStatus | string | charge status |
nextBillingDate | string (date-time) | next billing date |
currentPeriodStart | string (date-time) | current period start time |
currentPeriodEnd | string (date-time) | current period end time |
start | string (date-time) | start date, the first time subscribed |
end | string (date-time) | end time if exists |
currentCycle | integer | current cycle |
chargedCycles | integer | already charged cycles |
trialedCycles | integer | already trialed cycles if fixedCycleTrial exists |
inFixedFreeDays | boolean | whether in fixed free days |
inFixedCycleTrial | boolean | whether in fixed cycle trial |
firstSubscribe | boolean | indicates whether is first subscribe |
paid | boolean | whether user paid from the subscription start |
subscribedBy | string | subscribed by PLATFORM(system granted) or USER(subscribed by user self) |
subscribedAt | string (date-time) | time when subscribed |
unsubscribedAt | string (date-time) | time when unsubscribed |
unsubscribeReason | string | reason why unsubscribe |
source | string | source |
region | string | created region |
language | string | created language |
sandbox | boolean | is sandbox mode |
createdAt | string (date-time) | - |
updateAt | string (date-time) | - |
currency
Name | Type | Description |
---|---|---|
currencyCode | string | currency code |
currencySymbol | string | currency symbol |
currencyType | string | currency type |
namespace | string | namespace |
decimals | integer (int32) | decimals |
recurring
Name | Type | Description |
---|---|---|
cycle | string | recurring cycle |
fixedFreeDays | integer (int32) | fixed free days, 0 means not set |
fixedTrialCycles | integer (int32) | fixed trial cycles, 0 means not set |
graceDays | integer (int32) | recurring grace days, retry recurring charge within configured days if charge fail, default 7 |
billing
Name | Type | Description |
---|---|---|
paymentProvider | string | payment provider |
paymentMethod | string | payment method |
amount | integer | charge amount |
totalTax | integer | total tax |
totalPrice | integer | total price |
subtotalPrice | integer | subtotal price |
recurringOrderNo | string | recurring order no for this billing |
paymentOrderNo | string | payment order no |
txEndTime | string (date-time) | transaction end time |
extTxId | string | external transaction id |
event
Name | Type | Description |
---|---|---|
id | string | - |
version | integer | - |
name | string | - |
namespace | string | - |
parentNamespace | string | - |
timestamp | string (date-time) | - |
clientId | string | - |
userId | string | - |
traceId | string | - |
sessionId | string | - |