Unique code redemption web service?

  • Started
  • Last post
  • 9 Responses
  • Nathan_Adams

    Had a left field request from a client, and I've got no idea how to address it. Been searching for either a web service (or a Wordpress plugin) that could handle it but coming up with nothing.

    Basically they want to print unique serial numbers inside the packaging of their products. People can then go on their site, fill out their details along with the serial number, to redeem a book they're giving away. Each serial number to be unique, and only redeemable once. They can also tick to sign up to their Campaign Monitor mailing list.

    Been pulling my hair out trying to work out if there's anything that can do that online. Does anyone have any suggestions?

    They don't have an online shop, so can't tie it in with that. Just a straight up WP site with Gravity Forms (but there's no add-on for that that can do this, AFAIW).

  • Gnash0

    are you asking how to fulfil the on-line part, or getting the codes actually printed?

  • Gnash0

    If you're printer is not familiar with printing "Variable Data," then find another.

    You will need to provide the printer with file containing the codes. The data should be in .csv (comma delineated), .txt (tab delineated), .xls (excel pre-2007), or filemaker pro format.

    Last time i did this the printer requested the the data in 50M blocks (I needed 500K pieces printed)

    • listen to this guy, he speaks the truthgeorgesIII
    • ugh. your, not you're.Gnash
    • the online fulfilment is more challenging. You will likely need to use a service (pay per transaction). We licensed software, and it was upwards of $50K I thinkGnash
    • I agree with everything you've written except for the cost in ^this last note. Could quite easily do this with a minimal SQL DB and a simple form look up, <$1kdetritus
    • ya, I wasn't part of the software stuff (don't really get it) but we fulfilled both music and book downloads, some with DRM and some without.Gnash
    • And they were cheap! I'm sure if they could have gotten away with a $1K solution they would have used it :)Gnash
  • vaxorcist0

    OK... Need some clarification to give useful info;

    Who prints the numbers?

    Do you really want "serial numbers" or rather non-repeating randomized numbers, so people can't guess numbers and fake out your fulfillment system to get free stuff.

    Do you need to:

    1 generate a list of unguessable numbers

    2 send those to printing process, other people handle this once they get number list

    3 add a redemption form to website that asks for user to type in unguessable number and shipping info, then you lookup number to make sure it is OK, then ship out the stuff

    I.e. does this work like airline confirmation codes? Usually alpha numeric like F6A89E

    • use a guid or pseudo guid. make sure your form is hardened against brute-force attacks.monNom
  • vaxorcist0

    let's see if the new QBN permits PHP code samples... test code, YMMV,etc...

    <?php

    $count = 10000; // total number of numbers you want

    for($i=1;$i<$count;$i++){
    $x=rand(1,100000);
    $list[$i]=hash('crc32',$x);
    }

    $results = array_unique($list);
    shuffle($results);

    foreach ($results as $result) {
    echo "$result</br>\n\r";
    }

    ?>

  • vaxorcist0

    generates list like:
    38a0a6b5
    88e4378e
    be88fc45
    96949262
    18b5e68e
    1c3f3cbd
    3852caf4
    d7517f33
    4e62380c
    fd6f516d
    50c5c3f7
    f265882a

  • Nathan_Adams0

    Thanks guys.

    It's the online side I'm after. The take the details (easy), check the code is valid and hasn't been used before, and save into list.

    Gravity Forms gets me 2/3rds of the way, I can make the field to enter the code into, and for it to check for duplicate entries (so it can't be used twice), but not sure how to get it to verify the code against a list of valid entires.

    Client and their packaging manufacturer I assume will be organising the codes themselves and printing them.

    • you will need to be able to get their list of PIN codes and somehow bring it into your end. that's where things will get weird.Gnash
    • we did it the other way around. the online guys created all the codes and provided the list to the printer.Gnash
    • if you can give the printer the list of codes, it may be easier for you. use the PHP code above or modify it.vaxorcist
  • vaxorcist0

    you will need to program this,using something like PHP and probably in an SQL database something like psuedocode below:

    $code = $_POST('code');
    $code = sanitize_function($code)
    // remove illegal chars,hack attempts,etc...

    if(sql_query("select code from list where code ='$code'")){

    // they got in! OK...
    // set a flag in database for this code being used,
    // or simply delete from list of "OK" codes
    // get address to send item,etc.. send to e-commerce fulfillment

    }else{

    //error try agagin

    }

    NOTE
    this assumes you have a database full of codes setup already,etc.

  • Gnash0

    We cheated one of these things once because we didn't have time to integrate a promotion properly.

    In order to download the eBook, the client had to enter a ten digit 'unique' code from the printed package they had. We didn't have time or budget to set it up the server for unique codes so we left it open. i.e., ANY 10-digit number would unlock the book, only the user didn't know that.

    a sloppy solution for sure. but it worked for that one time

  • uan1

    how about gform_validation in gravity forms
    http://www.gravityhelp.com/docum…

    • Oh, I haven't seen that. That might be a viable direction. Thanks.Nathan_Adams