B4A Library Offline Credit Card Validator

This simple library will validate and identify credit cards.

Requirements:

1- Copy the OfflineCreditCardValidator.xml and OfflineCreditCardValidator.jar to your additional libraries directory.


Usage:
B4X:
'Initialize the library:
Dim cCard As OfflineCreditCardValidator

cCard.Initialize

'Enter a credit card number to verify:
Msgbox(cCard.Validate("4556752115663680"), "")

You can use this library to pre-screen credit cards.

NOTE: This library only verifies that the credit card number is valid not if the credit card is authentic.
 

Attachments

  • OfflineCreditCardValidator.zip
    2.8 KB · Views: 262
Last edited:

GMan

Well-Known Member
Licensed User
Longtime User
Nice Lib - works fine.
BUT only if i disabled the cCard init - then the App crashes after start.
Without it works.

OS=4.2.2
 

GMan

Well-Known Member
Licensed User
Longtime User
This
B4X:
cCard.Initialize

If i disabled it it works - if i init it, the App crashes (OS 4.2.2 root)

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    'Initialize the library:
    Dim cCard As OfflineCreditCardValidator
    Dim CCCheckButton As Button
    Dim CCCheckEditText As EditText
    Dim CCCProviderLabel As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("ccmain")
    'cCard.Initialize
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub CCCheckButton_Click
cCard.Validate(CCCheckEditText.Text)
' Msgbox(cCard.Validate(CCCheckEditText.Text), "CreditCardCheck")
CCCProviderLabel.Text = (cCard.Validate(CCCheckEditText.Text))
End Sub
 

Attachments

  • CCChecker.zip
    80.4 KB · Views: 204

NJDude

Expert
Licensed User
Longtime User
It works fine on my devices, I see you have B4A version 2.71, and I have the latest (3.50) maybe there's an incompatibility issue.

Nice sample by the way :)
 
Last edited:
Top