How to detect EndDate/Cancellation of a Product with finalPhase type=FIXEDTERM after duration ended?

328 views
Skip to first unread message

ggra...@gmail.com

unread,
Jun 13, 2016, 7:50:45 AM6/13/16
to Kill Bill users mailing-list
Dear Alexandre and Stephane

1. I setup a productCatalogue containing a ProductPlan with a finalPhase FIXEDTERM which a duration of 1 DAYS and a fixedPrice of 5 like this:

<plan name="productName.price.daily">
<product>productName</product>
<finalPhase type="FIXEDTERM">
<duration>
<unit>DAYS</unit>
<number>1</number>
</duration>
<fixed type="ONE_TIME">
<fixedPrice>
<price>
<currency>CHF</currency>
<value>5.00</value>
</price>
</fixedPrice>
</fixed>
<usages/>
</finalPhase>
<plansAllowedInBundle>1</plansAllowedInBundle>
</plan>

2. After i booked this product to a customer and i check the subscription on killbill with GET: {{baseURLKillBill}}/subscriptions/a2759e57-e3cc-4529-847e-13d9e0bbddab i receive:

{
"accountId": "28659015-067b-415c-abe7-9dfb278ae580",
"bundleId": "4da23f00-c635-42b6-b167-35d852ba7106",
"subscriptionId": "a2759e57-e3cc-4529-847e-13d9e0bbddab",
"externalKey": "1",
"startDate": "2016-06-13",
"productName": "productName",
"productCategory": "ADD_ON",
"billingPeriod": "NO_BILLING_PERIOD",
"phaseType": "FIXEDTERM",
"priceList": "daily",
"state": "ACTIVE",
"sourceType": "NATIVE",
"cancelledDate": null,
"chargedThroughDate": "2016-06-13",
"billingStartDate": "2016-06-13",
"billingEndDate": null,
"events": [
{
"eventId": "a8749ce9-406a-4b54-b8aa-52d2ae218dc6",
"billingPeriod": "NO_BILLING_PERIOD",
"product": "productName",
"priceList": "daily",
"eventType": "START_ENTITLEMENT",
"isBlockedBilling": false,
"isBlockedEntitlement": false,
"serviceName": "entitlement-service",
"serviceStateName": "START_ENTITLEMENT",
"phase": "productName.price.daily-fixedterm",
"auditLogs": null,
"requestedDate": "2016-06-13",
"effectiveDate": "2016-06-13"
},
{
"eventId": "a8749ce9-406a-4b54-b8aa-52d2ae218dc6",
"billingPeriod": "NO_BILLING_PERIOD",
"product": "cproductName",
"priceList": "daily",
"eventType": "START_BILLING",
"isBlockedBilling": false,
"isBlockedEntitlement": false,
"serviceName": "billing-service",
"serviceStateName": "START_BILLING",
"phase": "productName.price.daily-fixedterm",
"auditLogs": null,
"requestedDate": "2016-06-13",
"effectiveDate": "2016-06-13"
}
],
"priceOverrides": [],
"auditLogs": null
}


3. After i booked the product, i set the killbill clock to be from now +1-2 days in the future

4.1 What i expected to happen:
I expected that killbill will generate appropriate events when this subscription ends which i can catch in the eventHandlerPlugin and invoke my interal actions and i expected that this subscription state would have changed from ACTIVE to CANCELED when the 1 Day duration passed (startTime+24h)

4.2 What happened:
No events got generated, i checked the bus_ext_events_history and the bus_events_history table but it looks like both dosnt receive events about the entitlment ending after 1 day.


Question:

1. Am I doing sth wrong or am i missing sth?
2. Is there a way on getting this event somhow else?

Sincerly

Giuliano Grassi

stephane brossier

unread,
Jun 13, 2016, 3:19:43 PM6/13/16
to giuliano grassi, Kill Bill users mailing-list
Hi Giuliano,


What you are describing makes sense: Kill Bill does not emit an event when a subscription 'expires' by itself (it does though, when the user cancels the subscription). I agree this could be a nice feature to add for 0.17.x (since that would require some api changes).

A possible workaround in the meantime (if that notification is important to you) would be to future cancel the subscription at its expiration date when you create it.

Stéphane



Giuliano Grassi

--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To post to this group, send email to killbill...@googlegroups.com.
Visit this group at https://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/4078c42c-8705-4925-aa2a-7b18e7fa15ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

acy...@gmail.com

unread,
Jul 26, 2016, 11:24:16 AM7/26/16
to Kill Bill users mailing-list, ggra...@gmail.com
Hi,

I'm evaluating KillBill subscriptions and from the docs I can't seemed to get how my app should know if a user is eligible of doing something on my site. I mean which KillBill API endpoint should I hit to get the answer about user's current subscription status, whether it is ACTIVE or not (by ACTIVE I mean that a user was charged for the subscription as I'am not supposed to credit users).

stephane brossier

unread,
Jul 26, 2016, 7:45:37 PM7/26/16
to Александр Суховетченко, Kill Bill users mailing-list, giuliano grassi

 
 
Hi,

I'm evaluating KillBill subscriptions and from the docs I can't seemed to get how my app should know if a user is eligible of doing something on my site. I mean which KillBill API endpoint should I hit to get the answer about user's current subscription status, whether it is ACTIVE or not

GET /1.0/kb/subscriptions/<subscription_id>

ACTIVE = subscription was created in the past and has not yet been cancelled.
 
(by ACTIVE I mean that a user was charged for the subscription as I'am not supposed to credit users).


The state associated with the subscription is independent of whether the user was charged, which is also independent of whether the payment was successful.

Create subscription -> Invoice -> Payment

I suggest you go through the tutorial and get familiar with the model.

Stéphane



 

--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To post to this group, send email to killbill...@googlegroups.com.
Visit this group at https://groups.google.com/group/killbilling-users.

Ying Que

unread,
Jul 24, 2019, 8:59:23 PM7/24/19
to Kill Bill users mailing-list
Sorry Stephane to resurrect this from over 3 years ago

In your latest code, 
I still cannot see any external bus event type of ENTITLEMENT_STOP which I think is what is needed to detect when a subscription naturally 'expires" by itself in the absence of this there are only two options: 1. relying on an external clock to remember to send a request to force KB to cancel an expired subscription 2. or we fork this out and do it ourselves , i.e., go through entitlement and create that event for the email notification to listen to What do you think ?
To unsubscribe from this group and stop receiving emails from it, send an email to killbill...@googlegroups.com.

Pierre-Alexandre Meyer

unread,
Jul 24, 2019, 11:32:49 PM7/24/19
to Ying Que, Kill Bill users mailing-list

As Stéphane suggested, a possible workaround would be to future cancel the subscription at its expiration date when you create it. Upon effective cancellation, you would receive an event to react to.

Hope this helps,

To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/cb681640-7eb4-4c2e-bf86-939e7ebee8c2%40googlegroups.com.


--
Pierre
Reply all
Reply to author
Forward
0 new messages