January 29, 2014 (G+) |
Step.3 Click on that link, Enter your Secret Key and click Save. That's it your JVZoo IPN secret key has been successfully saved.
if(!isset($_POST['ctransaction'])) die('unathorized access.'); function jvzipnVerification() { $secretKey = "Let's analyze what this simple script does... First we check if there is POST parameter 'ctransaction' that is part from JVZoo IPN. If that parameter does not exist then the request is not sent from JVZoo. If 'ctransaction' parameter exists then we verify if the request really came from JVZoo using predefined function for verification. If verification is passed then we can execute whatever code we want. In our case there is IF clause that checks if the transaction was SALE then it executes code. Other types of transaction are:"; $pop = ""; $ipnFields = array(); foreach ($_POST AS $key => $value) { if ($key == "cverify") { continue; } $ipnFields[] = $key; } sort($ipnFields); foreach ($ipnFields as $field) { // if Magic Quotes are enabled $_POST[$field] will need to be // un-escaped before being appended to $pop $pop = $pop . $_POST[$field] . "|"; } $pop = $pop . $secretKey; $calcedVerify = sha1(mb_convert_encoding($pop, "UTF-8")); $calcedVerify = strtoupper(substr($calcedVerify,0,8)); return $calcedVerify == $_POST["cverify"]; } if(jvzipnVerification() == 1) { //register sale if($_POST['ctransaction'] == 'SALE') { //execute code when sale has been made } }
Type |
Description |
SALE |
The purchase of a standard product or the initial purchase of recurring billing product. |
BILL |
A rebill for a recurring billing product. |
RFND |
The refunding of a standard or recurring billing product. Recurring billing products that are refunded also result in a “CANCEL-REBILL” action. |
CGBK |
A chargeback for a standard or recurring product. |
INSF |
An eCheck chargeback for a standard or recurring product. |
CANCEL-REBILL |
The cancellation of a recurring billing product. Recurring billing products that are canceled do not result in any other action. |
UNCANCEL-REBILL |
Reversing the cancellation of a recurring billing product. |
Parameter |
Description |
Detail |
ccustname |
customer name |
1-510 Characters |
ccuststate |
customer state |
0-2 Characters |
ccustcc |
customer country code |
0-2 Characters |
ccustemail |
customer email |
1-255 Characters |
cproditem |
JVZoo product number |
1-5 Characters |
cprodtitle |
title of product at time of purchase |
0-255 Characters |
cprodtype |
type of product on transaction (STANDARD, and RECURRING) |
8-11 Characters |
ctransaction |
action taken |
4-15 Characters |
ctransaffiliate |
affiliate on transaction |
0-10 Characters |
ctransamount |
amount paid to party receiving notification (in pennies (1000 = $10.00)) |
3-10 Characters |
ctranspaymentmethod |
method of payment by customer |
0-4 Characters |
ctransvendor |
vendor on transaction |
5-10 Characters |
ctransreceipt |
JVZoo Payment Id |
16-22 Characters |
cupsellreceipt |
Parent receipt number for upsell transaction |
8-13 Characters |
caffitid |
affiliate tracking id |
0 – 24 Characters |
cvendthru |
extra information passed to order form with duplicated information removed |
0-1024 Characters |
cverify |
the “cverify” parameter is used to verify the validity of the previous fields |
8 Characters |
ctranstime |
the Epoch time the transaction occurred (not included in cverify) |
10 Characters |