Fairlight FairPay
Documentation
Current Version: 01.02.02
Released: 01/28/05

Database Schema

FairPay's fairpay_sql_populate program utilises six relational database tables for storage of IPN data from PayPal. In the tables below, SQL character data is labeled as "char", and numeric types are labelled as "decimal" or "integer", depending on which is appropriate. This is to abstract the data types for general use, independant of which database type you're using, as the low-level engine types differ between engines.

NOTE: Always check the flt_verified field for any transaction. Even if a transaction is shown as INVALID, it will be stored, along with all its details, both on the off-chance that there is a bug that caused a false negative, and so that you can track attempted payment spoofs. In your business rules, only actually financially process transactions marked as VERIFIED

In any table, any field for which there is no data will be a NULL field.

The layout of the tables is as follows, accompanied by explanations of what contents may be expected within each column:

fairpay_transactions - The heart of the FairPay database relation system, the majority of your transaction information will end up in this table. Any IPN transaction that has a tranaction ID will have a record here.

Column NameType/LengthInformation and Details
txn_idchar (17)A unique ID designated by PayPal to identify the transaction.
parent_txn_idchar (17)The unique ID of the transaction for which the current transaction is a child. The presence of this ID usually indicates a refund or other kind of reversal.
txn_typechar (14)Type of transaction. There are five types:
  • web_accept
  • cart
  • send_money
  • masspay
  • subscr_payment

Reversals will not have a transaction type.
payment_typechar (7)Either instant or echeck depending on the method of payment.
payment_datechar (25)Date of payment. The format is: HH:MM:SS MON X, YYYY TZN
payment_statuschar (17)One of several results:
  • Cancelled_Reversal - Reversal was cancelled.
  • Completed - Initial payment completed, funds available.
  • Denied - Merchant (you) denied the transaction.
  • Failed - Payment failed. (Buyer bank account had insufficient funds.)
  • Pending - Payment pending. See pending_reason.
  • Refunded - Merchant (you) refunded the transaction.
  • Reversed - Chargeback or other kind of reversal. See reason_code as well.
  • Processed - Mass Payment has been processed but not yet completed (this result is for a txn_typeof masspay only).
pending_reasonchar (14)One of several results:
  • address - No confirmed shipping address as specified by merchant's preferences.
  • echeck - Payment made by an eCheck which has not yet cleared.
  • intl - Merchant is a non-US account and has no withdrawal method.
  • multi_currency - Currency was not native and merchant does not have the conversion option enabled.
  • unilateral - Payment made by non-confirmed or non-registered email address.
  • upgrade - Payment made to an account that must be upgraded to Premiere or Business status.
  • verify - Merchant account is not yet verified.
  • other - Other reason for pending payments.
reason_codechar (14)One of several results:
  • buyer_complaint
  • chargeback
  • guarantee
  • refund
  • other
mc_grossdecimalThe gross amount of payment made in mc_currency.
mc_feedecimalThe fee charged made in mc_currency.
mc_currencychar (3)One of several results:
  • USD - U.S. Dollars
  • GBP - British Pounds Sterling
  • EUR - Euros
  • CAD - Canadian Dollars
  • JPY - Japanese Yen
mc_handlingdecimalThe amount of shipping paid in mc_currency. NOTE: This is not currently split out on "Buy Now" buttons!
mc_shippingdecimalThe amount of shipping paid in mc_currency. NOTE: This is not currently split out on "Buy Now" buttons!
settle_amountdecimalThe amount deposited after automatic currency conversion.
settle_currencychar (3)The currency used for settle_amount
exchange_ratedecimalExchange rate for conversion.
payment_grossdecimalGross payment in USD. This is a legacy field.
payment_feedecimalFee in USD. This is a legacy field.
businesschar (127)Email address of the recipient. Identical to receiver_email if payment was made to primary address for the account.
receiver_emailchar (127)Primary email address of the payment recipient.
receiver_idchar (13)Unique ID assigned by PayPal to the recipient. Equivalent to the recipient's referral ID.
item_namechar (127)Item name as passed by the merchant.
item_numberchar (127)Item number as passed by the merchant.
quantityintegerQuantity of item purchased.
invoicechar (255)Passthrough variable for invoice tracking. Omitted if not supplied by merchant.
customchar (255)Custom variables passed to merchant which are never seen by the customer.
memochar (255)Memo as entered on PayPal's site in the Note field.
taxdecimalTax charged on entire payment.
notechar (4000)Extra note field.
option_name1char (64)Descriptive name of first of two possible (optional) options.
option_selection1char (200)Value of first of two possible (optional) options.
option_name2char (64)Descriptive name of second of two possible (optional) options.
option_selection2char (200)Value of second of two possible (optional) options.
notify_versionchar (10)Version number of PayPal's IPN service.
payer_idchar (13)Unique ID assigned by PayPal to the payer's account.
num_cart_itemsintegerNumber of line items present in a shopping cart transaction.
for_auctionchar (4)Set to true if transaction is from an auction.
flt_record_processedchar (1)A one character field to help any business-rules software determine if a record has been processed. Defaults to "N".
flt_createdchar (14)Time the record was created. Format is YYYYMMDDHHMMSS
flt_verifiedchar (8)Either INVALID or VERIFIED depending on whether the IPN was validated by PayPal as authentic and generated by their system.
flt_idchar (64)Unique ID assigned by flipna with which you may look up all records related to one IPN submission.

NOTES:


fairpay_buyers - Every transaction (even of the Mass-Payment type) has a payer_id field. This is unique to every user. Relation between transactions and buyer information should be based on this field. All buyer-specific details will appear in this table, and will be kept as current and complete as possible.

Column NameType/LengthInformation and Details
payer_idchar (13)A Unique customer ID assigned to the payer's account by PayPal.
first_namechar (64)The payer's first name.
last_namechar (64)The payer's last name.
payer_business_namechar (127)The business name of the payer, if given.
address_namechar (128)The name of to be used for the shipping address if Gift Address is provided.
address_streetchar (200)Street address for shipping.
address_citychar (40)City for shipping.
address_statechar (40)State for shipping.
address_zipchar (20)ZIP code for shipping.
address_countrychar (64)Country for shipping.
address_statuschar (11)One of two results:
  • confirmed
  • unconfirmed
payer_emailchar (127)Primary email address of the payer.
payer_statuschar (10)One of two results:
  • verified
  • unverified
flt_record_processedchar (1)A one character field to help any business-rules software determine if a record has been processed. Defaults to "N".
flt_createdchar (14)Time the record was created. Format is YYYYMMDDHHMMSS
flt_idchar (64)Unique ID assigned by flipna with which you may look up all records related to one IPN submission. Any time the buyer record is updated with more current information, this will be the last flipna ID that triggered such an update.

NOTES:


fairpay_auction - Information that is auction-specific will be stored in this table.

Column NameType/LengthInformation and Details
txn_idchar (17)A unique ID designated by PayPal to identify the transaction.
auction_buyer_idchar (64)The eBay auction ID of the buyer. This is their screen name on eBay.
auction_closing_datechar (25)The closing date of the auction. The format is: HH:MM:SS MON X, YYYY TZN
auction_multi_itemintegerA field that indicates which item number from an auction is being referenced. NOTE: This field is not currently used. The PayPal Integration Guide is currently incorrect about how auction data is presented via IPN. We have confirmed this with PayPal as of January 25, 2005, and they agree there is a discrepancy between the documentation and the actual functionality. The reality is that all auction line items are presented as an individual transaction with its own txn_id, and all the data not in this table is currently tracked in fairpay_transactions. The guide says that every IPN from an auction will have the same txn_id, mc_gross, and payment_gross. Again, PayPal has verified for us that this is incorrect at this time.
flt_record_processedchar (1)A one character field to help any business-rules software determine if a record has been processed. Defaults to "N".
flt_createdchar (14)Time the record was created. Format is YYYYMMDDHHMMSS
flt_idchar (64)Unique ID assigned by flipna with which you may look up all records related to one IPN submission.

NOTES:

None.


fairpay_cart - All shopping cart-specific information will be stored in this table.

Column NameType/LengthInformation and Details
txn_idchar (17)A unique ID designated by PayPal to identify the transaction.
cart_item_numintegerThe line number of the item in the shopping cart.
taxdecimalThe tax collected on the cart line item, if the item was taxed separately.
item_namechar (127)The item number of cart line item.
item_numberchar (127)The item name of the cart line item.
option_name1char (64)Descriptive name of first of two possible (optional) options for the cart line item.
option_selection1char (200)Value of first of two possible (optional) options for the cart line item.
option_name2char (64)Descriptive name of first of two possible (optional) options for the cart line item.
option_selection2char (200)Value of first of two possible (optional) options for the cart line item.
quantityintegerQuantity of the cart line item that was purchased.
mc_grossdecimalThe gross amount paid for the cart line item in mc_currency..
mc_handlingdecimalThe amount of handling paid in mc_currency.
mc_shippingdecimalThe amount of shipping of handling paid in mc_currency.
flt_record_processedchar (1)A one character field to help any business-rules software determine if a record has been processed. Defaults to "N".
flt_createdchar (14)Time the record was created. Format is YYYYMMDDHHMMSS
flt_idchar (64)Unique ID assigned by flipna with which you may look up all records related to one IPN submission.

NOTES:

None.


fairpay_masspay - All information related to mass payments will be stored in this table,

Column NameType/LengthInformation and Details
txn_idchar (17)A unique ID designated by PayPal to identify the transaction.
receiver_emailchar (127)Email address of the payment recipient.
mc_grossdecimalGross amount paid in mc_currency.
mc_feedecimalFee paid in mc_currency.
mc_currencychar (3)One of several results:
  • USD - U.S. Dollars
  • GBP - British Pounds Sterling
  • EUR - Euros
  • CAD - Canadian Dollars
  • JPY - Japanese Yen
payment_grossdecimalGross payment in USD. This is a legacy field.
statuschar (9)One of several results:
  • Completed - Payment processed.
  • failed - Insufficient funds.
  • reversed - Payee refused payment or unilateral payments were unclaimed for 30 days.
  • pending - Unilateral payments still pending.
payment_feedecimalFee in USD. This is a legacy field.
unique_idchar (17)Unique ID assigned to this recipient by the merchant during the Mass Pay process.
flt_record_processedchar (1)A one character field to help any business-rules software determine if a record has been processed. Defaults to "N".
flt_createdchar (14)Time the record was created. Format is YYYYMMDDHHMMSS
flt_verifiedchar (8)Either INVALID or VERIFIED depending on whether the IPN was validated by PayPal as authentic and generated by their system.
flt_idchar (64)Unique ID assigned by flipna with which you may look up all records related to one IPN submission.

NOTES:


fairpay_subscriptions - All subscription information will be stored in this table. This includes IPN transactions that will not show up in the fairpay_transactions table, as only payments themselves will have transaction ID's, and there are five other types of subscription IPN types.

Column NameType/LengthInformation and Details
txn_idchar (17)A unique ID designated by PayPal to identify the transaction.
txn_typechar (14)One of several results:
  • subscr_signup - Sign-up
  • subscr_cancel - Cancellation
  • subscr_failed - Payment failure
  • subscr_payment - Subscription Payment
  • subscr_eot - End of Term
  • subscr_modify - User modifiction of subscription
subscr_datechar (25)Date of subscription. The format is: HH:MM:SS MON X, YYYY TZN
subscr_effectivechar (25)Date on which subscriber modification will become effective. The format is: HH:MM:SS MON X, YYYY TZN
period1char (10)Length of first trial period. An integer, followed by a space and a single character:
  • D - days
  • W - weeks
  • M - months
  • Y - years
period2char (10)Length of second trial period. An integer, followed by a space and a single character:
  • D - days
  • W - weeks
  • M - months
  • Y - years
period3char (10)Length of regular subscription period. An integer, followed by a space and a single character:
  • D - days
  • W - weeks
  • M - months
  • Y - years
amount1decimalAmount for first trial period in USD. This is a legacy field.
amount2decimalAmount for first trial period in USD. This is a legacy field.
amount3decimalAmount for regular subscription period in USD. This is a legacy field.
mc_amount1decimalAmount for first trial period in mc_currency
mc_amount2decimalAmount for second trial period in mc_currency
mc_amount3decimalAmount for regular subscripton period in mc_currency
mc_currencychar (3)One of several results:
  • USD - U.S. Dollars
  • GBP - British Pounds Sterling
  • EUR - Euros
  • CAD - Canadian Dollars
  • JPY - Japanese Yen
recurringchar (1)Is the subscription recurring at the regular rate (mc_amount3 and period3)? "1" means yes.
reattemptchar (1)Retry on failed payments? A "1" means yes.
retry_atchar (25)The date at which a retry will be attempted after a failed payment.
recur_timesintegerThe number of payment installments that will occur at the regular rate (mc_amount3 and period3).
usernamechar (64)Username generated by PayPal for subscription access, if the account generation feature is enabled.
passwordchar (127)Password generated by PayPal for subscription access, if the account generation feature is enabled.
subscr_idchar (19)Unique ID assigned by PayPal for an individual subscription.
payer_idchar (13)A Unique customer ID assigned to the payer's account by PayPal.
item_namechar (127)Item name as passed by the merchant.
item_numberchar (127)Item number as passed by the merchant.
option_name1char (64)Descriptive name of first of two possible (optional) options.
option_selection1char (200)Value of first of two possible (optional) options.
option_name2char (64)Descriptive name of second of two possible (optional) options.
option_selection2char (200)Value of second of two possible (optional) options.
flt_record_processedchar (1)A one character field to help any business-rules software determine if a record has been processed. Defaults to "N".
flt_createdchar (14)Time the record was created. Format is YYYYMMDDHHMMSS
flt_verifiedchar (8)Either INVALID or VERIFIED depending on whether the IPN was validated by PayPal as authentic and generated by their system.
flt_idchar (64)Unique ID assigned by flipna with which you may look up all records related to one IPN submission.

NOTES:


Back to Table of Contents

Copyright 2005, Fairlight Consulting. All rights reserved.

Back to Fairlight Consulting