Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. What is the code for Credit card no. validation in C#?

What is the code for Credit card no. validation in C#?

Scheduled Pinned Locked Moved C#
questioncsharpcom
22 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S ScottM1

    Can I have half your profits?

    P Offline
    P Offline
    Pete OHanlon
    wrote on last edited by
    #3

    You've done all the work, it will only be fair that you get all of them.

    I'm not a stalker, I just know things. Oh by the way, you're out of milk.

    Forgive your enemies - it messes with their heads

    My blog | My articles | MoXAML PowerToys | Onyx

    OriginalGriffO 1 Reply Last reply
    0
    • C Cnu55555

      Dear Skilties...

      I am doing a project on "SECURE E-COMMERCE" so I need to validate the Credit Cards. Kindly anyone send the code to me.

      srinivas96alluri@ymail.com

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #4
      1. Don't post your email to any public forum, unless you really like spam. 2) Don't ask for codez, unless you really want to annoy people. 3) Try googling: many web hosting companies are out there, most of which will be more than happy to help you validate credit cards as part of a ecommerce site. Otherwise, they may assume you are trying to rip people off.

      Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      S 1 Reply Last reply
      0
      • P Pete OHanlon

        You've done all the work, it will only be fair that you get all of them.

        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

        Forgive your enemies - it messes with their heads

        My blog | My articles | MoXAML PowerToys | Onyx

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #5

        Nah, I assume Shrinvas will be supplying the card numbers...He should get some of the profit for that bit. Oh, and all the risk-of-arrest.

        Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff
          1. Don't post your email to any public forum, unless you really like spam. 2) Don't ask for codez, unless you really want to annoy people. 3) Try googling: many web hosting companies are out there, most of which will be more than happy to help you validate credit cards as part of a ecommerce site. Otherwise, they may assume you are trying to rip people off.

          Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

          S Offline
          S Offline
          ScottM1
          wrote on last edited by
          #6

          OriginalGriff wrote:

          trying to rip people off

          I don't think he is going to be very successful at this somehow.

          OriginalGriffO P 2 Replies Last reply
          0
          • S ScottM1

            OriginalGriff wrote:

            trying to rip people off

            I don't think he is going to be very successful at this somehow.

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #7

            It's so refreshing to see disorganised crime in the "planning" stages, isn't it? :laugh:

            Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            1 Reply Last reply
            0
            • S ScottM1

              OriginalGriff wrote:

              trying to rip people off

              I don't think he is going to be very successful at this somehow.

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #8

              I want to know what skilties are. Google Translate tells me that it's Lithuanian for column, but I really doubt that's what he means.

              I'm not a stalker, I just know things. Oh by the way, you're out of milk.

              Forgive your enemies - it messes with their heads

              My blog | My articles | MoXAML PowerToys | Onyx

              OriginalGriffO 1 Reply Last reply
              0
              • P Pete OHanlon

                I want to know what skilties are. Google Translate tells me that it's Lithuanian for column, but I really doubt that's what he means.

                I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                Forgive your enemies - it messes with their heads

                My blog | My articles | MoXAML PowerToys | Onyx

                OriginalGriffO Offline
                OriginalGriffO Offline
                OriginalGriff
                wrote on last edited by
                #9

                From the Oxtail Dictionary of English: "Skilty : [Skil'ty] (n) A person skilled in technical matters who is also so naive and gullible that he will give out information needed for a small (but ultimately unsuccessful) crime spree if you meet either one of two conditions: 1) You can convince him that this is for a project, rather than for nefarious purposes. 2) You are, or can present yourself as, female."

                Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

                "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                1 Reply Last reply
                0
                • C Cnu55555

                  Dear Skilties...

                  I am doing a project on "SECURE E-COMMERCE" so I need to validate the Credit Cards. Kindly anyone send the code to me.

                  srinivas96alluri@ymail.com

                  K Offline
                  K Offline
                  Keith Barrow
                  wrote on last edited by
                  #10

                  I haven't read any of the other answers to this question yet, so let me look into my crystal ball: Amongst other things, I bet thet say (with varying degrees if politeness): 1. No one is going to write your project/ homework for you. 2. You haven't tried anything yet. If you have tried something, tell us what isn't working 3. Read the site FAQs. 3. If you need to ask this, you shouldn't be playing with security on something as serious as a credit card. [Edit] Wrong on points two and three and should have foreseen the easily "google-able" message, better than most psychics at least....

                  Sort of a cross between Lawrence of Arabia and Dilbert.[^]
                  -Or-
                  A Dead ringer for Kate Winslett[^]

                  P 1 Reply Last reply
                  0
                  • K Keith Barrow

                    I haven't read any of the other answers to this question yet, so let me look into my crystal ball: Amongst other things, I bet thet say (with varying degrees if politeness): 1. No one is going to write your project/ homework for you. 2. You haven't tried anything yet. If you have tried something, tell us what isn't working 3. Read the site FAQs. 3. If you need to ask this, you shouldn't be playing with security on something as serious as a credit card. [Edit] Wrong on points two and three and should have foreseen the easily "google-able" message, better than most psychics at least....

                    Sort of a cross between Lawrence of Arabia and Dilbert.[^]
                    -Or-
                    A Dead ringer for Kate Winslett[^]

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #11

                    You like point 3 so much, you make it twice. :-D

                    I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                    Forgive your enemies - it messes with their heads

                    My blog | My articles | MoXAML PowerToys | Onyx

                    K 1 Reply Last reply
                    0
                    • P Pete OHanlon

                      You like point 3 so much, you make it twice. :-D

                      I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                      Forgive your enemies - it messes with their heads

                      My blog | My articles | MoXAML PowerToys | Onyx

                      K Offline
                      K Offline
                      Keith Barrow
                      wrote on last edited by
                      #12

                      In an embarring faux pas, I also get it wrong the second time :-) I shall use <ol> next time, unless I'm being lazy. Oh BTW, I'm not coming home over the festive, that's why I haven't been in touch. We are planning a visit mid-Jan instead.

                      Sort of a cross between Lawrence of Arabia and Dilbert.[^]
                      -Or-
                      A Dead ringer for Kate Winslett[^]

                      P 1 Reply Last reply
                      0
                      • K Keith Barrow

                        In an embarring faux pas, I also get it wrong the second time :-) I shall use <ol> next time, unless I'm being lazy. Oh BTW, I'm not coming home over the festive, that's why I haven't been in touch. We are planning a visit mid-Jan instead.

                        Sort of a cross between Lawrence of Arabia and Dilbert.[^]
                        -Or-
                        A Dead ringer for Kate Winslett[^]

                        P Offline
                        P Offline
                        Pete OHanlon
                        wrote on last edited by
                        #13

                        Fair enough. Let me know when, and we'll arrange a get together. It's a shame you haven't been here this week, the lady santas have looked very fine down on the quayside. Ho ho ho.

                        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

                        Forgive your enemies - it messes with their heads

                        My blog | My articles | MoXAML PowerToys | Onyx

                        1 Reply Last reply
                        0
                        • C Cnu55555

                          Dear Skilties...

                          I am doing a project on "SECURE E-COMMERCE" so I need to validate the Credit Cards. Kindly anyone send the code to me.

                          srinivas96alluri@ymail.com

                          P Offline
                          P Offline
                          PIEBALDconsult
                          wrote on last edited by
                          #14

                          http://en.wikipedia.org/wiki/Luhn_algorithm[^]

                          C 1 Reply Last reply
                          0
                          • C Cnu55555

                            Dear Skilties...

                            I am doing a project on "SECURE E-COMMERCE" so I need to validate the Credit Cards. Kindly anyone send the code to me.

                            srinivas96alluri@ymail.com

                            J Offline
                            J Offline
                            jschell
                            wrote on last edited by
                            #15

                            Depends on what you mean by validate. One of the other posts provide a link to do a simple check sum on the digits itself. This is a simple test that can be done in a GUI. A number that passes that test still might not be a valid number in that numbers have certain rules related to the card type (such as Visa.) There are simple methods that one can use to validate those however the only correct way requires that one get the bin numbers from a valid processor and check them. Of course a number is only valid if a processor accepts it. Doing that requires a lot of code and will be specific to each processor. Both of those make it pointless for anyone to post such solutions here. And none of that has anything at all to do with securing ecommerce payment applications.

                            C 1 Reply Last reply
                            0
                            • C Cnu55555

                              Dear Skilties...

                              I am doing a project on "SECURE E-COMMERCE" so I need to validate the Credit Cards. Kindly anyone send the code to me.

                              srinivas96alluri@ymail.com

                              D Offline
                              D Offline
                              DaveyM69
                              wrote on last edited by
                              #16

                              Many numbers in use use the Luhn algorithm to generate/check the final digit of the number. Credit cards, debit cards, cell phone IMEI numbers, SIM cards are just a few examples of these. It will tell you that the number is theoretically valid only. At work I have a class I wrote a while ago with all this stuff in. I would paste it here but I'm not back at work til 4th Jan - it's pretty easy to implement though so you should be able to do it yourself.

                              Dave
                              Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
                              BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

                              1 Reply Last reply
                              0
                              • C Cnu55555

                                Dear Skilties...

                                I am doing a project on "SECURE E-COMMERCE" so I need to validate the Credit Cards. Kindly anyone send the code to me.

                                srinivas96alluri@ymail.com

                                D Offline
                                D Offline
                                Dr Walt Fair PE
                                wrote on last edited by
                                #17

                                bool IsCardValid(string CCNumber)
                                {
                                return (CustomerResponse("Is this your card?") == "Yes")
                                && (ExpirationDate > DateTime.Now());
                                }

                                CQ de W5ALT

                                Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                                C 1 Reply Last reply
                                0
                                • C Cnu55555

                                  Dear Skilties...

                                  I am doing a project on "SECURE E-COMMERCE" so I need to validate the Credit Cards. Kindly anyone send the code to me.

                                  srinivas96alluri@ymail.com

                                  L Offline
                                  L Offline
                                  LloydA111
                                  wrote on last edited by
                                  #18

                                  WTF is a "Skilties"?


                                  See if you can crack this: fb29a481781fe9b3fb8de57cda45fbef

                                  The unofficial awesome history of Code Project's Bob! "People demand freedom of speech to make up for the freedom of thought which they avoid."

                                  1 Reply Last reply
                                  0
                                  • C Cnu55555

                                    Dear Skilties...

                                    I am doing a project on "SECURE E-COMMERCE" so I need to validate the Credit Cards. Kindly anyone send the code to me.

                                    srinivas96alluri@ymail.com

                                    B Offline
                                    B Offline
                                    Bernhard Hiller
                                    wrote on last edited by
                                    #19

                                    Dear friends on CodeProject, do not discourage the OP! Have you ever been to India? I just spent 4 weeks of holidays there, and I can tell you from my experience: credit/debit card validation is a real issue! In 1 hotel only were my credit cards accepted, all other hotels failed - and of course none had the old type of machines doing a simple paper offprint as a fall-back solution... I had to get cash from (Indian) ATMs... At the first machine, I failed using it, on the first screen I saw the logo of the bank and its name on top, a "WELCOME:" in bold black letters on the middle left, and a "CONTINUE" on the middle right, I selected "CONTINUE" and was back to this page. A security man could tell me that I was expected to enter my PIN here (and in fact, in small dark gray characters on a light gray background it read "Please enter your PIN", where I previously thought was part of the logo). But in the end, the transaction failed for unknown reasons. After many more failures at different ATMs, I tried to change cash at a Western Union office, which they were not licensed to do, but they told me that only a few banks can handle non-Indian MasterCards, and could give me two suggestions to try. At ICICI bank, the transaction failed, but their staff told me that they can do, I should try later again, and it failed again... Only from the ATM of HDFC bank I could get cash (and that ATM looked like Western make, quite different from the other ones). Some time ago, some (Indian?) guy asked here on CodeProject how to program a cash machine. We should have provided him with much more guidance! In the end, we could become victims of our failure to guide such newbies.

                                    1 Reply Last reply
                                    0
                                    • D Dr Walt Fair PE

                                      bool IsCardValid(string CCNumber)
                                      {
                                      return (CustomerResponse("Is this your card?") == "Yes")
                                      && (ExpirationDate > DateTime.Now());
                                      }

                                      CQ de W5ALT

                                      Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

                                      C Offline
                                      C Offline
                                      Cnu55555
                                      wrote on last edited by
                                      #20

                                      Thanks for Ur reply.. But i need to validate CCNumber is it possible?

                                      1 Reply Last reply
                                      0
                                      • J jschell

                                        Depends on what you mean by validate. One of the other posts provide a link to do a simple check sum on the digits itself. This is a simple test that can be done in a GUI. A number that passes that test still might not be a valid number in that numbers have certain rules related to the card type (such as Visa.) There are simple methods that one can use to validate those however the only correct way requires that one get the bin numbers from a valid processor and check them. Of course a number is only valid if a processor accepts it. Doing that requires a lot of code and will be specific to each processor. Both of those make it pointless for anyone to post such solutions here. And none of that has anything at all to do with securing ecommerce payment applications.

                                        C Offline
                                        C Offline
                                        Cnu55555
                                        wrote on last edited by
                                        #21

                                        Actually SECURE E-COMMERCE is my acadamic project. In that i need to validate Credit card atleast Visa card. My thinking is when the user give card no. how can we validate ? and what are the reqmnts to validate?

                                        1 Reply Last reply
                                        0
                                        • P PIEBALDconsult

                                          http://en.wikipedia.org/wiki/Luhn_algorithm[^]

                                          C Offline
                                          C Offline
                                          Cnu55555
                                          wrote on last edited by
                                          #22

                                          Thank Q

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups