我特别想到Zen cart Stripe插件。
我找不到客户的IP地址是否发布到Stripe,或者是否必须检查IP地址以防止欺诈。
看看代码(无论如何一部分),模块在这里
非常感谢,伙计们。 PHP不是我的事,电子商务也不是。
global $_POST, $order, $sendto, $currency, $charge,$db, $messageStack;
require_once(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/stripepay/Stripe.php');
//Stripe get the test/production state
$secret_key = ((MODULE_PAYMENT_STRIPEPAY_TESTMODE == 'Test') ? MODULE_PAYMENT_STRIPEPAY_TESTING_SECRET_KEY : MODULE_PAYMENT_STRIPEPAY_MERCHANT_LIVE_SECRET_KEY);
Stripe::setApiKey($secret_key);
$error = '';
// get the credit card details submitted by the form
$token = $_POST['StripeToken'];
//existing customer
if (zen_not_null($_POST['StripeCustomerID'])) {
if ($token == 'NONE') {
//charge the customer on existing card
try {
$charge = Stripe_Charge::create(array(
//"amount" => ($order->info['total']) * 100, // amount in cents
//fimgirl fix for total
"amount" =>floor(($order->info['total']) * 100),
"currency" => MODULE_PAYMENT_STRIPEPAY_CURRENCY,
"customer" => $_POST['StripeCustomerID']
));
}
catch (Exception $e) {
$error = $e->getMessage();
$messageStack->add_session('checkout_confirmation', $error . '<!-- [' . $this->code . '] -->', 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL', true, false));
}
} //end use existing card
//start new card
//new card for the customer and he wants to save it (or we are not allowing the option do StripesaveCard==YES
elseif (zen_not_null($_POST['StripeSaveCard']) && ($_POST['StripeSaveCard'] == 'YES')) {
try {
//update the card for the customer
$cu = Stripe_Customer::retrieve($_POST['StripeCustomerID']);
$cu->source = $token;
$cu->save();
//charge the customer
$charge = Stripe_Charge::create(array(
//"amount" => ($order->info['total']) * 100, // amount in cents
//fimgirl fix for total
"amount" =>floor(($order->info['total']) * 100),
"currency" => MODULE_PAYMENT_STRIPEPAY_CURRENCY,
"customer" => $_POST['StripeCustomerID']
));
}
catch (Exception $e) {
$error = $e->getMessage();
$messageStack->add_session('checkout_confirmation', $error . '<!-- [' . $this->code . '] -->', 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL', true, false));
}
} //end save card
else {
//a saved customer has entered new card details but does NOT want them saved. Currently (Nov 2012) Stripe does not allow you to remove a card object so you'll have to charge the card and not the customer
try {
// create the charge on Stripe's servers - this will charge the user's card no customer object
$charge = Stripe_Charge::create(array(
// "amount" => ($order->info['total']) * 100, // amount in cents
//fimgirl fix for total
"amount" =>floor(($order->info['total']) * 100),
"currency" => MODULE_PAYMENT_STRIPEPAY_CURRENCY,
"card" => $token,
"description" => $order->customer['email_address']
));
}
catch (Exception $e) {
$error = $e->getMessage();
$messageStack->add_session('checkout_confirmation', $error . '<!-- [' . $this->code . '] -->', 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL', true, false));
}
}
} //end existing customer
//new customer wants to save card details
elseif (zen_not_null($_POST['StripeSaveCard']) && ($_POST['StripeSaveCard'] == 'YES')) {
//new customer create the object
try {
// create a Customer
$customer = Stripe_Customer::create(array(
"card" => $token,
"description" => $order->customer['email_address']
));
// charge the Customer instead of the card
$charge = Stripe_Charge::create(array(
// "amount" => ($order->info['total']) * 100, // amount in cents
//fimgirl fix for total
"amount" =>floor(($order->info['total']) * 100),
"currency" => MODULE_PAYMENT_STRIPEPAY_CURRENCY,
"customer" => $customer->id
));
}
catch (Exception $e) {
$error = $e->getMessage();
$messageStack->add_session('checkout_confirmation', $error . '<!-- [' . $this->code . '] -->', 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL', true, false));
}
}
// not a customer token
else {
try {
// create the charge on Stripe's servers - this will charge the user's card no customer object
$charge = Stripe_Charge::create(array(
// "amount" => ($order->info['total']) * 100, // amount in cents
//fimgirl fix for total
"amount" =>floor(($order->info['total']) * 100),
"currency" => MODULE_PAYMENT_STRIPEPAY_CURRENCY,
"card" => $token,
"description" => $order->customer['email_address']
));
}
catch (Exception $e) {
$error = $e->getMessage();
$messageStack->add_session('checkout_confirmation', $error . '<!-- [' . $this->code . '] -->', 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL', true, false));
}
} //end not a customer token
// die ( $charge);
return false;
}
function after_process()
{
global $charge, $insert_id, $db;
//let's update the stripe_id table
if (table_exists('stripe_data')) {
$sql_data_array = array(
'orders_id' => zen_db_prepare_input($insert_id),
'stripe_charge_id' => zen_db_prepare_input($charge->id),
'customers_id' => zen_db_prepare_input($_SESSION['customer_id']),
'stripe_amount' => zen_db_prepare_input($charge->amount),
'stripe_amount_refunded' => zen_db_prepare_input($charge->amount_refunded),
'stripe_currency' => strtoupper(zen_db_prepare_input($charge->currency)),
'stripe_customer' => zen_db_prepare_input($charge->customer),
'stripe_description' => zen_db_prepare_input($charge->description),
'stripe_disputed' => zen_db_prepare_input($charge->disputed),
'stripe_fee' => zen_db_prepare_input($charge->fee),
'stripe_invoice' => zen_db_prepare_input($charge->invoice),
// 'stripe_object' => zen_db_prepare_input($charge->object);
'stripe_paid' => zen_db_prepare_input($charge->paid),
'stripe_address_city' => zen_db_prepare_input($charge->source->address_city),
'stripe_address_country' => zen_db_prepare_input($charge->source->address_country),
'stripe_address_line1' => zen_db_prepare_input($charge->source->address_line1),
'stripe_address_line1_check' => zen_db_prepare_input($charge->source->address_line1_check),
'stripe_address_line2' => zen_db_prepare_input($charge->source->address_line2),
'stripe_address_zip' => zen_db_prepare_input($charge->source->address_zip),
'stripe_address_zip_check' => zen_db_prepare_input($charge->source->address_zip_check),
'stripe_country' => zen_db_prepare_input($charge->source->country),
'stripe_fingerprint' => zen_db_prepare_input($charge->source->fingerprint),
'stripe_cvc_check' => zen_db_prepare_input($charge->source->cvc_check),
'stripe_name' => zen_db_prepare_input($charge->source->name),
'stripe_last4' => zen_db_prepare_input($charge->source->last4),
'stripe_exp_month' => zen_db_prepare_input($charge->source->exp_month),
'stripe_exp_year' => zen_db_prepare_input($charge->source->exp_year),
'stripe_type' => zen_db_prepare_input($charge->source->brand)
);
zen_db_perform('stripe_data', $sql_data_array);
}
//now let's update the orders table
$db->Execute("update " . TABLE_ORDERS . " set
cc_type = '" . zen_db_prepare_input($charge->source->type) . "',
cc_owner='" . zen_db_prepare_input($charge->source->name) . "',
cc_expires='" . zen_db_prepare_input($charge->source->exp_month) . "/" . zen_db_prepare_input($charge->source->exp_year) . "',
cc_number='XXXX-XXXX-XXXX-" . zen_db_prepare_input($charge->source->last4) . "'
where
orders_id = '" . $insert_id . "' ");
//AVS checking
if (MODULE_PAYMENT_STRIPEPAY_AVS == 'True' && ($charge->source->address_line1_check !== 'pass' || $charge->source->address_zip_check !== 'pass')) {
$error = '';
if ($charge->source->address_line1_check == 'fail') {
$error .= MODULE_PAYMENT_STRIPEPAY_TEXT_AVS_FAILED . '. ';
} //$charge->source->address_line1_check == 'fail'
if ($charge->source->address_zip_check == 'fail') {
$error .= MODULE_PAYMENT_STRIPEPAY_TEXT_ZIP_FAILED . '. ';
} //$charge->source->address_zip_check == 'fail'
if ($charge->source->address_line1_check == 'unchecked') {
$error .= MODULE_PAYMENT_STRIPEPAY_TEXT_AVS_UNCHECKED . '. ';
} //$charge->source->address_line1_check == 'unchecked'
if ($charge->source->address_zip_check == 'unchecked') {
$error .= MODULE_PAYMENT_STRIPEPAY_TEXT_ZIP_UNCHECKED;
} //$charge->source->address_zip_check == 'unchecked'
$sql_data_array2 = array(
'orders_status' => MODULE_PAYMENT_STRIPEPAY_AVS_FAILED
);
zen_db_perform(TABLE_ORDERS, $sql_data_array2, "update", "orders_id='" . $insert_id . "'");
//// also change status in order history
$sql_data_array3 = array(
'orders_id' => $insert_id,
'orders_status_id' => MODULE_PAYMENT_STRIPEPAY_AVS_FAILED,
'date_added' => 'now()',
'customer_notified' => 0,
'comments' => $error
);
zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array3);
} //MODULE_PAYMENT_STRIPEPAY_AVS == 'True' && ($charge->source->address_line1_check !== 'pass' || $charge->source->address_zip_check !== 'pass')
//CVV checking
if (MODULE_PAYMENT_STRIPEPAY_CVV == 'True' && $charge->source->cvc_check !== 'pass') {
$cvv_error = '';
if ($charge->source->cvc_check == 'fail') {
$cvv_error .= MODULE_PAYMENT_STRIPEPAY_TEXT_CVV_FAILED . '. ';
} //$charge->source->cvc_check == 'fail'
elseif ($charge->source->cvc_check == 'unchecked') {
$cvv_error .= MODULE_PAYMENT_STRIPEPAY_TEXT_CVV_UNCHECKED . '. ';
} //$charge->source->cvc_check == 'unchecked'
$sql_data_array4 = array(
'orders_status' => MODULE_PAYMENT_STRIPEPAY_CVV_FAILED
);
zen_db_perform(TABLE_ORDERS, $sql_data_array4, "update", "orders_id='" . $insert_id . "'");
//// also change status in order history
$sql_data_array5 = array(
'orders_id' => $insert_id,
'orders_status_id' => MODULE_PAYMENT_STRIPEPAY_CVV_FAILED,
'date_added' => 'now()',
'customer_notified' => 0,
'comments' => $cvv_error
);
zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array5);
} //MODULE_PAYMENT_STRIPEPAY_CVV == 'True' && $charge->source->cvc_check !== 'pass'
return false;
}
function get_error()
{
global $_GET;
$error = array(
'title' => MODULE_PAYMENT_STRIPEPAY_ERROR_TITLE,
'error' => stripslashes($_GET['error'])
);
return $error;
}
function check()
{
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_STRIPEPAY_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
function install()
{
global $db, $messageStack;
if (defined('MODULE_PAYMENT_STRIPEPAY_STATUS')) {
$messageStack->add_session('Stripe Payment module already installed.', 'error');
zen_redirect(zen_href_link(FILENAME_MODULES, 'set=payment&module=stripepay', 'NONSSL'));
return 'failed';
}
//send cheeky cURL to Blue Toucan
cheeky_curl('installed');
//
// OK lets add in a new order statuses Stripe - failures
$check_query = $db->Execute("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Stripe - CVV Failure' limit 1");
if ($check_query->RecordCount() < 1) {
$status = $db->Execute("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
$status_id = $status->fields['status_id'] + 1;
$languages = zen_get_languages();
foreach ($languages as $lang) {
$db->Execute("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Stripe - CVV Failure')");
} //$languages as $lang
} else {
$status_id = $check_query->fields['orders_status_id'];
}
$check_query2 = $db->Execute("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Stripe - AVS Failure' limit 1");
if ($check_query2->RecordCount() < 1) {
$status2 = $db->Execute("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
$status_id2 = $status2->fields['status_id'] + 1;
$languages = zen_get_languages();
foreach ($languages as $lang) {
$db->Execute("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id2 . "', '" . $lang['id'] . "', 'Stripe - AVS Failure')");
} //$languages as $lang
} else {
$status_id2 = $check_query2->fields['orders_status_id'];
}
//Now for 'unchecked
// OK lets add in a new order statuses Stripe - failures
$check_query3 = $db->Execute("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Stripe - CVV unchecked' limit 1");
if ($check_query3->RecordCount() < 1) {
$status3 = $db->Execute("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
$status_id3 = $status3->fields['status_id'] + 1;
$languages = zen_get_languages();
foreach ($languages as $lang) {
$db->Execute("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id3 . "', '" . $lang['id'] . "', 'Stripe - CVV unchecked')");
} //$languages as $lang
} else {
$status_id3 = $check_query3->fields['orders_status_id'];
}
$check_query4 = $db->Execute("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Stripe - AVS unchecked' limit 1");
if ($check_query4->RecordCount() < 1) {
$status4 = $db->Execute("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS);
$status_id4 = $status4->fields['status_id'] + 1;
$languages = zen_get_languages();
foreach ($languages as $lang) {
$db->Execute("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id4 . "', '" . $lang['id'] . "', 'Stripe - AVS unchecked')");
} //$languages as $lang
} else {
$status_id4 = $check_query4->fields['orders_status_id'];
}
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Stripe Payments', 'MODULE_PAYMENT_STRIPEPAY_STATUS', 'True', 'Do you want to accept Stripe payments?', '6', '10', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_STRIPEPAY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '20', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_STRIPEPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '30', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_STRIPEPAY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '40', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
//extra payment statuses
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('CVV failure order status', 'MODULE_PAYMENT_STRIPEPAY_CVV_FAILED', '" . $status_id . "', 'If CVV checking is activated what order status do you want to apply to CVV check failures?', '6', '69', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('AVS failure order status', 'MODULE_PAYMENT_STRIPEPAY_AVS_FAILED', '" . $status_id2 . "', 'If AVS checking is activated what order status do you want to apply to AVS check failures?', '6', '71', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('CVV unchecked order status', 'MODULE_PAYMENT_STRIPEPAY_CVV_UNCHECKED', '" . $status_id3 . "', 'If CVV checking is activated what order status do you want to apply to cases where the CVV is returned as unchecked??', '6', '69', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('AVS unchecked order status', 'MODULE_PAYMENT_STRIPEPAY_AVS_UNCHECKED', '" . $status_id4 . "', 'If AVS checking is activated what order status do you want to apply to cases where the AVS is returned as unchecked?', '6', '71', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
// test or production?
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_STRIPEPAY_TESTMODE', 'Test', 'Transaction mode used for processing orders', '6', '50', 'zen_cfg_select_option(array(\'Test\', \'Production\'), ', now())");
//USD or CAN or GBP or EUR
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Stripe Currency', 'MODULE_PAYMENT_STRIPEPAY_CURRENCY', 'USD', 'The currency that your Stripe account is setup to handle - currently only a choice between USD and CAD - <b>make sure that your store is operating in the same currency!!</b>', '6', '50', 'zen_cfg_select_option(array(\'USD\', \'CAD\', \'EUR\',\'GBP\'), ', now())");
//API keys
//Testing Secret Key
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Testing Secret Key', 'MODULE_PAYMENT_STRIPEPAY_TESTING_SECRET_KEY', '', 'Testing Secret Key - obtainable in your Strip dashboard.', '6', '60', now())");
//Testing Publishable Key
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Testing Publishable Key', 'MODULE_PAYMENT_STRIPEPAY_TESTING_PUBLISHABLE_KEY', '', 'Testing Publishable Key - obtainable in your Strip dashboard.', '6', '62', now())");
//Live Secret key
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Live Secret key', 'MODULE_PAYMENT_STRIPEPAY_MERCHANT_LIVE_SECRET_KEY', '', 'Live Secret key - obtainable in your Strip dashboard.', '6', '64', now())");
//Live Publishable key
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Live Publishable key', 'MODULE_PAYMENT_STRIPEPAY_LIVE_PUBLISHABLE_KEY', '', 'Live Publishable key - obtainable in your Strip dashboard.', '6', '66', now())");
//CVV - defaults to True
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable CVV/CVC checking', 'MODULE_PAYMENT_STRIPEPAY_CVV', 'True', 'Do you want to enable CVV/CVC checking at Stripe? <b>Highly recommended</b>', '6', '68', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
//AVS - defaults to False
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable AVS check', 'MODULE_PAYMENT_STRIPEPAY_AVS', 'False', 'Do you want to enable Address Verification System checking at Stripe?', '6', '70', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
//create customer object?
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Create a Customer Object at Stripe?', 'MODULE_PAYMENT_STRIPEPAY_CREATE_OBJECT', 'True', 'Do you want to create Customer Objects at Stripe (True) or just charge the card every time (False)? ', '6', '72', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
//save card for customer
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow customers option not to save their card details?', 'MODULE_PAYMENT_STRIPEPAY_SAVE_CARD', 'True', 'Do you want to allow customers the option of not saving their card token with Stripe?', '6', '75', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Above option checked or unchecked?', 'MODULE_PAYMENT_STRIPEPAY_SAVE_CARD_CHECK', 'Checked', 'If the above is set to <b>True</b> do you want the option of saving to be checked or unchecked?', '6', '76', 'zen_cfg_select_option(array(\'Checked\', \'Unchecked\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Width of checkout payment fields', 'MODULE_PAYMENT_STRIPEPAY_WIDTH', '300', 'Depending on yuor template you may wish to make the credit card payment area in the checkout field wider or narrower. Insert a numerical value here for the desired width in pixels', '6', '80', now())");
//new database table
$db->Execute("CREATE TABLE IF NOT EXISTS `stripe_data` (
`stripe_id` int(11) NOT NULL auto_increment,
`orders_id` int(11) NOT NULL,
`customers_id` int(11) NOT NULL,
`stripe_charge_id` varchar(25) NOT NULL,
`stripe_amount` int(25) NOT NULL,
`stripe_amount_refunded` int(25) default NULL,
`stripe_currency` varchar(6) NOT NULL,
`stripe_customer` varchar(64) default NULL,
`stripe_description` varchar(255) default NULL,
`stripe_disputed` varchar(64) NOT NULL,
`stripe_fee` int(11) NOT NULL,
`stripe_invoice` varchar(64) default NULL,
`stripe_object` varchar(64) NOT NULL,
`stripe_paid` int(11) NOT NULL,
`stripe_address_city` varchar(255) NOT NULL,
`stripe_address_country` varchar(255) NOT NULL,
`stripe_address_line1` varchar(255) NOT NULL,
`stripe_address_line1_check` varchar(64) default NULL,
`stripe_address_line2` varchar(255) default NULL,
`stripe_address_zip` varchar(255) default NULL,
`stripe_address_zip_check` varchar(64) default NULL,
`stripe_country` varchar(64) NOT NULL,
`stripe_fingerprint` varchar(64) NOT NULL,
`stripe_cvc_check` varchar(64) default NULL,
`stripe_name` varchar(64) NOT NULL,
`stripe_last4` int(4) NOT NULL,
`stripe_exp_month` int(2) NOT NULL,
`stripe_exp_year` int(4) NOT NULL,
`stripe_type` varchar(64) NOT NULL,
PRIMARY KEY (`stripe_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;");