A basic example of a PHP script you would run on your secure web server to use for remote registration.



Our cart will send in a GET/POST request with  common fields from the order URL encoded - customer first name, customer last name, customer email address and receipt id (unique purchase identifier). We can also send in custom fields such as product ID, unique key, campaign ID, etc.


In this example, we send in firstname, lastname, email, transaction_id as the URL parameters to your script:



POST /your_registration_script.php?firstname=John&lastname=Smith&email=john_smitch%40google.com&transaction_id=1234567890 HTTP/1.1
Host: yourserver.com
Connection: close
Accept-encoding: gzip, deflate
User-Agent: Zend_Http_Client
Content-Type: application/x-www-form-urlencoded
Content-Length: 87
firstname=John&lastname=Smith&email=john_smitch%40google.com&transaction_id=1234567890



Your PHP script on your secure web server would receive the request, parse the parameters from the order, interface with your own database or serial number generator, and return the serial number back to our cart.



<?php
            
$customer_first_name = trim(urldecode($_POST["firstname"]));
$customer_last_name  = trim(urldecode($_POST["lastname"]));
$customer_email      = strtolower(trim(urldecode($_POST["email"]));
$transaction_id      = trim(urldecode($_POST["transaction_id"]));


/////////////////////////////

Custom PHP code goes here you will need to implement to store the customer and order in your database and generate a serial number

Simple serial number generators typically are created using a one-way hash of the customer data and a private seed or key, which can be verified in your app.

More complex serial number generators may use public/private key pairs, which your app can use to verify the serial number with only the public key - see the CocoaFob registration example for a system like this.
 
//////////////////////////////

$serial_number = generateSerialNumber($customer_email);

echo $serial_number;
exit();

?>