Invoicing for recurring payments

4 months 17 hours ago #311940 by activha
Hello guys

I come back on this subject that we have raised since more than a year now see this post

CBSubs invoicing for recurring items is still not in line with european legislations regarding recurring payments which need recurring invoices following a numbering scheme.

Can you tell me what are your moves for dev on this point ?

You told us about payment numbering scheme, is this still in dev ?

Thanks
Jean
4 months 12 hours ago - 4 months 11 hours ago #311942 by krileon

You told us about payment numbering scheme, is this still in dev ?

We've plans to implement frontend payment history display. It has not started development. Please understand we've over 20 products that all need to be maintained so they are cycled through. My focus is making PayPal Pro and Stripe PSD2 complaint since banks decided to enforce a new EU law now instead of in September when it goes in affect. This has interrupted CB Activity 5.0.0 development, which I will return to once these implementations are done. I do not know when we will get to implementing frontend payment history, but I suppose technically you could implement it using CB Query Field and its Multiple Row output by querying _cbsubs_payments. The below for example should work.

Query:
SELECT * FROM `#__cbsubs_payments` WHERE `by_user_id` = '[user_id]' ORDER BY `time_paid` DESC
Output: Multiple Rows
Header:
<table>
	<thead>
		<tr>
			<th>Invoice</th>
			<th>Item</th>
			<th>Amount</th>
			<th>Date</th>
		</tr>
	</thead>
	<tbody>
Row:
		<tr>
			<td>[column_invoice]</td>
			<td>[column_item_name]</td>
			<td>[column_mc_gross]</td>
			<td>[column_time_paid]</td>
		</tr>
Footer:
	</tbody>
</table>


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM EST to 4:00 PM EST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
4 months 11 hours ago #311945 by activha
Yep thanks this was what we did started last year already.

But this does not solve the fact that recurring invoices are not legal because they do not follow a scheme. That's good for payments but we would need a way to implement a numbering scheme even on recurring invoices.

For now we rely upon a third party set up but this kind of defeat the purpose of using CBsubs as an integrated system from A to Z.
Solving this would greatly enhance it.
4 months 10 hours ago #311946 by krileon
As it's just outputting the results of a query you could in theory just alter the query to output an invoice number that fits your needs. Beyond that I don't have anything further to suggest at this time.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM EST to 4:00 PM EST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
3 months 3 weeks ago #311974 by activha
Thanks but this does not work like that.
We need to have a legal system that stores the correct invoice numbers and numbers cannot be changed.
For now CBSubs does not do this and does not comply to EU rules and french regulations
I thought Beat would help to solve this but this has already been asked for more than a year now.
3 months 3 weeks ago #311982 by krileon
Payment rows have stored invoice numbers. There's just no means of specifying a separate numbering system for payment rows at this time, which is something we're discussing possibly implementing when we implement the frontend access to payment rows. Since there's already stored payment row invoices I suppose you could alter them directly in the database so they'll be stored however you're needing. Beyond that I do not know what more to suggest a this time.

Regarding how to do this you'd need to likely act on either of the below triggers.

onCPayAfterPaymentStatusChange
$_PLUGINS->trigger( 'onCPayAfterPaymentStatusChange', array( &$user, &$paymentBasket, &$subscriptions, $unifiedStatus, $previousUnifiedStatus, $occurrences, $autorecurring_type, $autorenew_type ) );

onCPayAfterPaymentStatusUpdateEvent
$_PLUGINS->trigger( 'onCPayAfterPaymentStatusUpdateEvent', array( &$user, &$paymentBasket, &$subscriptions, $unifiedStatus, $previousUnifiedStatus, $eventType, &$notification ) );

Neither directly provide the payment rows for a basket. You'd basically just do an update query against _cbsubs_payments for the most recent payment row for a basket when the payment status changes. This should allow you to enforce whatever ordering system you need for payment rows and you already have the display output via query field. Example query as follows.

SET @a = 0;
UPDATE `#__cbsubs_payments` SET `invoice` = CONCAT( 'PAYMENT-', ( @a:=@a + 1 ) ) WHERE `payment_basket_id` = 47

This for example would change the invoice columns for a baskets payments to be PAYMENT-# so PAYMENT-1, PAYMENT-2, PAYMENT-3, etc.. This can of course be expanded on to do whatever numbering scheme you want. As I understand you can increment the basket invoice and that'd be sufficient enough so instead of completely overriding the invoice number you'd have the below.

SET @a = 0;
UPDATE `#__cbsubs_payments` SET `invoice` = CONCAT( `invoice`, '-', ( @a:=@a + 1 ) ) WHERE `payment_basket_id` = 47

Now for example my invoice is P343063397246874. I've 2 payments for the basket. This gives payment invoice values of P343063397246874-1 and P343063397246874-2. Unique and correctly incremented on a per-payment basis.

The next issue is what happens if the invoice as already incremented? You'd end up with P343063397246874-1-1, which of course isn't good, but we can't skip any row as it's necessary for the incrementing variable so we'll just first remove it. This finally gives us the below.

SET @a = 0;
UPDATE `#__cbsubs_payments` SET `invoice` = CONCAT( SUBSTRING_INDEX( `invoice`, '-', 1 ), '-', ( @a:=@a + 1 ) ) WHERE `payment_basket_id` = 47

Would this fit your needs?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM EST to 4:00 PM EST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Moderators: beatnantkrileon
Time to create page: 0.689 seconds
Facebook Twitter Google LinkedIn