How to control tuition and app access?

I am developing a system that should block the access of those who do not make the payment of the monthly bill.

I took a look at the project BoletoPHP for ticket generation and it partially meets me. I can generate the bills, but I don't know when and if they were paid.

What I need is a system-level feedback on billet payment, something like the PagSeguro API does, so that account blocking is automatic.

By now I can't use APIs like PagSeguro, MercadoPago etc.

 9
Author: C. E. Gesser, 2014-02-18

3 answers

Payment control via boleto

  1. Generate bill of lading
  2. Write billing data to database (subscriber, expiration, amount, etc)
  3. Get File-Bank return (Every Business Day)
  4. process the return file (here you know the details of the payments)
  5. update the database with the information obtained (check paid charges, etc)
  6. Check for arrears (still not paid after due date) and Block

Generating ticket

Always on the client side, I have been involved with ticket generation using PHP since 2007, having used the services of Banco do Brasil, Bradesco and Caixa Econômica Federal, in the modalities without registration and registered.

Last year, I made a ticket generation Bundle for Symfony 2 that does the same service as BoletoPHP: from the billing data reported, generates the corresponding billet. However, this is only part of the system.

The following information is valid for the banks mentioned above, within the experience I had. I believe that the others follow the same model.

Getting file-return

To control the fees, that is, to know which tickets have been paid, you need to get the return file that is generated every business day by the bank, and contains the information about the tickets processed at that time day.

How do you get the file-return from the bank?

Or through Internet Banking, or some proprietary software to be installed by a bank technician. Unfortunately, there is no API or other simpler way that can be automated by the customer. The routine of getting the file-return from the bank, and then sending it to your system to process it, is a manual task.

The exact answer on the form of obtaining these files will be given by the bank itself, either when hiring the collection wallet, or at any other time.

Generating and sending the consignment file

In registered wallet contracts, it is also necessary to generate and send to the bank the so-called remittance file, so that the tickets generated by your system are registered in the bank's system. Submissions are made in a similar manner ( Internet Banking or proprietary software ). In Caixa Econômica there is a process of homologation to validate the formatting of your files-shipment. After a testing phase, the "production" phase is activated, when the sent consignment files are effectively registered.

Also last year, on the same system in Symfony 2, i implemented a class to generate files-shipment from the billing data and the system-generated tickets-but this code it's not in the public domain.

CNAB pattern

Both files sent to the Bank ( remittance file , for the registered wallet only) and files received from the Bank ( return file daily) follow a standard formatting.

The CNAB Standard (National Center for banking automation) has some variations - CNAB 240, CNAB 400, etc. On the websites of Banco do Brasil and Caixa Econômica Federal are available the technical documents detailing the standard used for this communication between the bank and the customer.

Each bank must maintain similar documentation, which is necessary to implement any solution that needs to generate or process "return" and/or "remittance"files.

Processing file-return

As there are variations between each bank, there is no ready solution for everyone. You need to be with the technical documentation, and make the implementation accordingly. Just as we have "various types of tickets" in BoletoPHP... we have several " file-return types "and several"file-shipment types".

I have already made file-return processing implementations, in PHP, for the three banks mentioned, of which my clients were clients. This is another part of the system whose code is not in the public domain.

It is not difficult, but it is laborious - there are many details, many fields... it's not nice at all.

In short

What you will need is:

  1. Dialog with the bank in order to gain access to the Files-return

  2. Routine of getting the file and sending it to your system

  3. implementation of script that processes return files received by the system

 8
Author: J. Bruni, 2014-02-19 05:52:27

I have always worked in companies in the financial segment, which provide services and develop systems for banks. However, I do not have much experience with the Bulletin systems as I have not worked directly with them.

However, having already worked on systems client, that is, that generate the tickets and receive the return, I can say that financial institutions use standards for sending and receiving information about tickets. The most common where I worked is the CNAB.

But your problem is not the format itself, but how the institution will (or will not) make this information available to its customers through a web service.

See, the systems I work with are run internally in the bank, so we read the CNAB return through a procedure, a table or a TXT file in a directory configured by the bank.

But to make this information available to third parties , each bank it will create its own solution, like the internet banking that exist out there.

My suggestion is that you go to the agency to talk to your manager and ask about this service. He will probably refer this question to someone from it in the bank, who will be able to inform the format of the data and how it is made available.

Perhaps this service is onerous, since the bank needs to worry about security, availability and does not want anyone accessing services directly.

Something I see in many smaller virtual stores is a functionality where the user himself makes control of the paid tickets, since he can access the company's internet banking . Some banks (Banco do Brasil, for example) have exports of the extract data of internet banking in CSV and XLS formats, so it would be possible to facilitate a little and allow the user to upload these files to his system and he identify whether there are paid bills on the statement.

 2
Author: utluiz, 2014-02-18 20:35:43

To do this control it is necessary that you query the status of the tickets (whether it was paid or not, late, etc...) in the bank system, this query is made via the exchange of text files with the bank through the CNAB standard, but each bank has its own extensions to the CNAB standard which ends up forcing you to have a different sending and receiving model for each bank. The specification of these models can be found on the internet or on the website of each bank.

Is it is important to note that each time you make an appointment the bank charges you a fee, so limit the amount of queries.

 2
Author: Daniel Santos, 2014-02-19 11:17:59