Issue refund through Stripe

253 views
Skip to first unread message

Henric

unread,
Aug 22, 2015, 5:10:50 AM8/22/15
to Kill Bill users mailing-list
Hi,

I'm still a bit confused with the refund/cancel subscription flow in killbill. I've tried different ways but never really got it working they way I expect so there is probably something I don't fully understand :-).

Now I have an account where I've canceled a subscription and an invoice with negative amount has been generated. Now I would like to trigger a refund through stripe for that invoice. Actually I would have expected the credit of the user's card to happen automatically and that credit transaction to be connected to the negative invoice?

Now the invoice looks like this:

Adjustment (subscription change) 2015-08-20 2016-08-16 $-100 (USD) Adjust Delete
Adjustment (account credit) 2015-08-20 2015-08-20 $100 (USD)

And the customer now has a positive balance of USD 100. How do I make a refund of USD 100 using the customer’s payment method and ideally also connecting that refund to the invoice above? Is that possible through kaui or API?

If not - how do I best just do a refund through kaui and then connect it in the database to the invoice afterwards?

What is the recommended way of doing this? That is, if we want to cancel a subscription and issue a refund to user's card? If we implement this in code which API calls needs to be done?


Thanks!

Henric

step...@kill-bill.org

unread,
Aug 22, 2015, 5:39:05 PM8/22/15
to Kill Bill users mailing-list
Hi Henric,


On Saturday, August 22, 2015 at 2:10:50 AM UTC-7, Henric wrote:
Hi,

I'm still a bit confused with the refund/cancel subscription flow in killbill. I've tried different ways but never really got it working they way I expect so there is probably something I don't fully understand :-).


Let me try to explain:
* Cancellation and credits are related to each other: In the IN_ADVANCE billing mode, the customer is invoiced for the upcoming period and so cancellation of a subscription prior we reached the end of the period will generate a pro-ration credit for the part that was not used (if you want to avoid the pro-ration, you can cancel using the EOT policy).
* Now refund, is a different thing: Refunds are not directly related to subscriptions, they are tied to an existing payment (the payment itself could be associated with an invoice where we invoiced a subscription)

If you want your customer to be refunded (instead of credited), you should be able to refund the payment. As a result, the invoice balance would become positive again and the credit that was previously generated would be consumed. Could you give it a try and tell me if that works?



Now I have an account where I've canceled a subscription and an invoice with negative amount has been generated. Now I would like to trigger a refund through stripe for that invoice. Actually I would have expected the credit of the user's card to happen automatically and that credit transaction to be connected to the negative invoice?

Now the invoice looks like this:

Adjustment (subscription change)        2015-08-20        2016-08-16                        $-100 (USD)                Adjust Delete
Adjustment (account credit)        2015-08-20        2015-08-20                        $100 (USD)

And the customer now has a positive balance of USD 100. How do I make a refund of USD 100 using the customer’s payment method and ideally also connecting that refund to the invoice above? Is that possible through kaui or API?


Both API and KAUI allow you to create a refund (you will have a do a simple refund with no invoice item adjustments to make sure you consume the credit that was previously generated.


In the future i would suggest to start  doing the refund first and then cancel the subscription (but the reverse operations, which you did should lead to the same result).


Stéphane

Henric

unread,
Aug 24, 2015, 7:54:39 AM8/24/15
to Kill Bill users mailing-list
Hi,

Thanks for your response. Please see my findings inline below.
 
Let me try to explain:
* Cancellation and credits are related to each other: In the IN_ADVANCE billing mode, the customer is invoiced for the upcoming period and so cancellation of a subscription prior we reached the end of the period will generate a pro-ration credit for the part that was not used (if you want to avoid the pro-ration, you can cancel using the EOT policy).
* Now refund, is a different thing: Refunds are not directly related to subscriptions, they are tied to an existing payment (the payment itself could be associated with an invoice where we invoiced a subscription)

If you want your customer to be refunded (instead of credited), you should be able to refund the payment. As a result, the invoice balance would become positive again and the credit that was previously generated would be consumed. Could you give it a try and tell me if that works?

When you say "you should be able to refund the payment" where do you mean I do the actual refund - in KAUI and where or using API and which API call?
For example:
* listing the payments in KAUI gives no way to look at the payment nor refund it. 
* Going to the invoices in KAUI doesn't give any refund option. 
* In account I can click credit next to the "payment method".
 
The last option above I've tried. Here are the result:
* Using the "Credit" button in KAUI next to the payment method for that account, then select "CREDIT" in the drop down. 
Here is the result in the killbill log using version 0.13:

* I then tried upgrading to 0.14 and do the same thing which resulted in a different error:

If I instead choose "REFUND" in the drop down I get a 404 error from killbill AP (for both 0.13 and 0.14)I:

2015-08-24 10:26:26,244 [qtp932583850-126] INFO  c.s.j.a.c.filter.LoggingFilter - 299 * Server in-bound request
.....
299 > Content-Type: application/json
299 >

2015-08-24 10:26:26,259 [qtp932583850-126] INFO  c.s.j.a.c.filter.LoggingFilter - 299 * Server out-bound response
299 < 404
299 <


* Finally if I instead to "Credit" next to the account, the account will be credited and increase the balance further also creating a new invoice for the credited amount which I think I understand the reason for.
 



Now I have an account where I've canceled a subscription and an invoice with negative amount has been generated. Now I would like to trigger a refund through stripe for that invoice. Actually I would have expected the credit of the user's card to happen automatically and that credit transaction to be connected to the negative invoice?

Now the invoice looks like this:

Adjustment (subscription change)        2015-08-20        2016-08-16                        $-100 (USD)                Adjust Delete
Adjustment (account credit)        2015-08-20        2015-08-20                        $100 (USD)

And the customer now has a positive balance of USD 100. How do I make a refund of USD 100 using the customer’s payment method and ideally also connecting that refund to the invoice above? Is that possible through kaui or API?


Both API and KAUI allow you to create a refund (you will have a do a simple refund with no invoice item adjustments to make sure you consume the credit that was previously generated.


In the future i would suggest to start  doing the refund first and then cancel the subscription (but the reverse operations, which you did should lead to the same result).


Could you please point me to the right API to accomplish that?

Thanks!

/Henric

Henric

unread,
Aug 24, 2015, 10:49:01 AM8/24/15
to Kill Bill users mailing-list
Hi again,

Quick update:
I found the refund button in KAUI in the billing timeline next to a payment, which I tried. I selected "No invoice adjustment" but still the invoice got adjusted with the amount I refunded. So the balance of the invoice is now 0 resulting in that the customer still has the same balance on his account since I had canceled the subscription.

What does the different options mean:
"No invoice adjustment"
"Invoice adjustment"
"Invoice item adjustment"

Is it possible to do a refund without modifying the invoice as you indicated in your response?

Thanks!

Kind regards
Henric

step...@kill-bill.org

unread,
Aug 24, 2015, 12:18:43 PM8/24/15
to Kill Bill users mailing-list


On Monday, August 24, 2015 at 7:49:01 AM UTC-7, Henric wrote:
Hi again,

Quick update:
I found the refund button in KAUI in the billing timeline next to a payment, which I tried.

Great (by the way, we are redesigning our UI, so hopefully in the next version, this will be easier to find the refund button).
 
I selected "No invoice adjustment" but still the invoice got adjusted with the amount I refunded. So the balance of the invoice is now 0 resulting in that the customer still has the same balance on his account since I had canceled the subscription.


You did the right thing, 'No Invoice Adjustment' as its name indicates should NOT adjust the invoice (only refund the payment). As a result the balance should either become positive (or if your customer has some credit, the credit should be consumed).

 
What does the different options mean:
"No invoice adjustment"

As i explained.
 
"Invoice adjustment"

Adjust the whole invoice (not at the item level); this allows to make a refund for a payment (matching a specific invoice) without changing the balance of that invoice. It is better to NOT use that and do the adjustment at the item level. We are even considering removing that option.
 
"Invoice item adjustment"

Adjust at the item level; this also  allows to make a refund for a payment (matching a specific invoice) without changing the balance of that invoice.
  

Is it possible to do a refund without modifying the invoice as you indicated in your response?

'modifying the invoice': If you don't do anything (No invoice adjustment), the invoice balance (not the invoice per say) will be modified; if you specify 'invoice item adjustment' (full amount for all items), then your invoice balance will not be modified.

It seems like you did the right thing but as far as i understand that does not seem to give rise to the correct result, so you may want to file a bug report with as much detail as possible. (i am bit surprised because we have used that functionality in the past quite a lot, but maybe there has been a regression ??)


Stéphane

 

Thanks!

Kind regards
Henric

Henric

unread,
Aug 25, 2015, 10:26:35 AM8/25/15
to Kill Bill users mailing-list

Quick update:
I found the refund button in KAUI in the billing timeline next to a payment, which I tried.

Great (by the way, we are redesigning our UI, so hopefully in the next version, this will be easier to find the refund button).

Sounds good!
 
 
I selected "No invoice adjustment" but still the invoice got adjusted with the amount I refunded. So the balance of the invoice is now 0 resulting in that the customer still has the same balance on his account since I had canceled the subscription.


You did the right thing, 'No Invoice Adjustment' as its name indicates should NOT adjust the invoice (only refund the payment). As a result the balance should either become positive (or if your customer has some credit, the credit should be consumed).

There was a REFUND_ADJ invoice item added to the invoice and the account balance of the customer wasn't touched according to the "balance" info in KAUI. Is this expected would you say given that I choose "No invoice adjustment"?

Not sure if this is what you mean by customer balance though - as I understand it there are no balance field on the account, but you rather sum the invoice items to get the account balance?
In my case there was a "negative" invoice that generated a positive account balance. After I made the refund I manually tried to change those invoice items to 0 which resulted in a 0 balance of the account again.

/Henric

step...@kill-bill.org

unread,
Aug 25, 2015, 2:14:38 PM8/25/15
to Kill Bill users mailing-list
Henric,

Which version are you using? 

I just wrote a test case to reproduce your scenario, and that seems to work perfectly on my side.

More inline below...


On Tuesday, August 25, 2015 at 7:26:35 AM UTC-7, Henric wrote:

Quick update:
I found the refund button in KAUI in the billing timeline next to a payment, which I tried.

Great (by the way, we are redesigning our UI, so hopefully in the next version, this will be easier to find the refund button).

Sounds good!
 
 
I selected "No invoice adjustment" but still the invoice got adjusted with the amount I refunded. So the balance of the invoice is now 0 resulting in that the customer still has the same balance on his account since I had canceled the subscription.


You did the right thing, 'No Invoice Adjustment' as its name indicates should NOT adjust the invoice (only refund the payment). As a result the balance should either become positive (or if your customer has some credit, the credit should be consumed).

There was a REFUND_ADJ invoice item added to the invoice and the account balance of the customer wasn't touched according to the "balance" info in KAUI. Is this expected would you say given that I choose "No invoice adjustment"?

Maybe this is a bug in the UI then... You should not see a REFUND_ADJ if you chose 'No Invoice adjustment'
 

Not sure if this is what you mean by customer balance though - as I understand it there are no balance field on the account, but you rather sum the invoice items to get the account balance?

Correct. 

Henric

unread,
Aug 26, 2015, 5:26:30 AM8/26/15
to Kill Bill users mailing-list
Hi,

We are using 0.13.4 with a patched version of the stripe plugin (which we've contributed back and you've merged it).
I started upgrading to 0.14 locally the other day, but I haven't been able to get everything working yet.

Below is a snippet from the killbill log of the refund, but I don't think we can see all parameters sent from KAUI so I don't know
if it tells you much?

2015-08-24 14:47:21,895 [qtp1893704400-941457] INFO  c.s.j.a.c.filter.LoggingFilter - 146842 * Server in-bound request
...
146842 >

2015-08-24 14:47:21,947 [qtp1893704400-941457] INFO  o.k.b.payment.api.DefaultPaymentApi - PaymentApi : REFUND, account = xxx, paymentTransactionExternalKey = xxx, paymentId = xxx, amount = 100.0, currency = USD
....

/Henric

step...@kill-bill.org

unread,
Aug 26, 2015, 4:46:54 PM8/26/15
to Kill Bill users mailing-list
Henric,

I created issue #48 to track the UI. If you have the chance you could also verify this is not an API issue (and therefore most likely a UI problem) by running my tests against your instance.

Stéphane
Reply all
Reply to author
Forward
0 new messages