Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init try #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified LICENSE
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
33 changes: 33 additions & 0 deletions charge (1).php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
// Get the latest version of stripe from: https://github.com/stripe/stripe-php/releases
require_once("stripe-php-1.18.0/lib/Stripe.php");

//
// Set your secret key: remember to change this to your live secret key in production
// We are using the test seceret key here just for our demo
//
Stripe::setApiKey("sk_test_Hta3le08tAzxbMq4NvgQVnqe");

// Get the credit card details submitted by the form
$token = $_POST['stripeToken'];

// Create the charge on Stripe's servers - this will charge the user's card
try {
$charge = Stripe_Charge::create(array(
"amount" => 999999, // amount in cents - so it's 9,999.99$ (cheap!)
"currency" => "usd",
"card" => $token,
"description" => "[email protected]")
);
error_log("Charge obj: $charge");
$charge = str_replace("{", "<br>{", $charge);
$charge = str_replace("}", "}<br>", $charge);
$charge = str_replace(",", "<br>", $charge);
$htmlCharge = "<h4> {$charge} </h4>";
echo $htmlCharge;
} catch(Stripe_CardError $e) {
// The card has been declined
error_log("Err: We could not charge. The card has been declined.\n Error Details: " . $e);
}


100 changes: 100 additions & 0 deletions charge-ex1 (1).php
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?php
// Get the latest version from: https://github.com/stripe/stripe-php/releases
require_once("stripe-php-1.18.0/lib/Stripe.php");

// Let's see if we getting a new card with details to charge
if ($_POST) {

// Set your secret key: remember to change this to your live secret key in production
// We are using the test seceret key here just for our demo
Stripe::setApiKey("sk_test_Hta3le08tAzxbMq4NvgQVnqe");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
Stripe_Charge::create(array("amount" => 99999999, // amount in cents - so it's 9,999.99$ (cheap!)
"currency" => "usd",
"card" => $_POST['stripeToken']));
$success = 'Your payment was successful. Good day!';
}
catch (Exception $e) {
$error = $e->getMessage();
error_log("Err: could not create a payment: " . $error);
}
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe - Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">

// this identifies your website in the createToken call below
Stripe.setPublishableKey('pk_test_2HBorPiB3CC68c1ujnhqGMd0');

function stripeResponseHandler(status, response) {
if (response.error) {
// re-enable the submit button
$('.submit-button').removeAttr("disabled");
// show the errors on the form
$(".payment-errors").html(response.error.message);
} else {
var form$ = $("#payment-form");
// token contains id, last4, and card type
var token = response['id'];
// insert the token into the form so it gets submitted to the server
form$.append("<input type='hidden' name='stripeToken' value='" + token + "' />");
// and submit
form$.get(0).submit();
}
}

$(document).ready(function() {
$("#payment-form").submit(function(event) {
// disable the submit button to prevent repeated clicks
$('.submit-button').attr("disabled", "disabled");

// createToken returns immediately
// the supplied callback submits the form if there are no errors
Stripe.createToken({
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val(),
exp_year: $('.card-expiry-year').val()
}, stripeResponseHandler);
// submit from callback
return false;
});
});
</script>
</head>
<body>
<h1>Charge $9,999.99 For an hour with Ido</h1>
<h5>* Price is what you pay value is what you get.</h5>
<!-- to display errors returned by createToken -->
<span class="payment-errors"><?= $error ?></span>
<span class="payment-success"><?= $success ?></span>
<form action="" method="POST" id="payment-form">
<div class="form-row">
<label>Card Number</label>
<input type="text" size="20" autocomplete="off" class="card-number" />
</div>
<div class="form-row">
<label>CVC</label>
<input type="text" size="4" autocomplete="off" class="card-cvc" />
</div>
<div class="form-row">
<label>Expiration (MM/YYYY)</label>
<input type="text" size="2" class="card-expiry-month"/>
<span> / </span>
<input type="text" size="4" class="card-expiry-year"/>
</div>
<button type="submit" class="submit-button">Submit Payment</button>
</form>
</body>
</html>
Empty file modified css/bootstrap.css
100755 → 100644
Empty file.
Empty file modified css/bootstrap.min.css
100755 → 100644
Empty file.
Empty file modified css/stylish-portfolio.css
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/css/font-awesome.css
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/css/font-awesome.min.css
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/fonts/FontAwesome.otf
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/fonts/fontawesome-webfont.eot
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/fonts/fontawesome-webfont.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified font-awesome-4.1.0/fonts/fontawesome-webfont.ttf
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/fonts/fontawesome-webfont.woff
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/bordered-pulled.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/core.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/fixed-width.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/font-awesome.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/icons.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/larger.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/list.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/mixins.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/path.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/rotated-flipped.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/spinning.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/stacked.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/less/variables.less
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_bordered-pulled.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_core.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_fixed-width.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_icons.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_larger.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_list.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_mixins.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_path.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_rotated-flipped.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_spinning.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_stacked.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/_variables.scss
100755 → 100644
Empty file.
Empty file modified font-awesome-4.1.0/scss/font-awesome.scss
100755 → 100644
Empty file.
Empty file modified fonts/glyphicons-halflings-regular.eot
100755 → 100644
Empty file.
Empty file modified fonts/glyphicons-halflings-regular.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified fonts/glyphicons-halflings-regular.ttf
100755 → 100644
Empty file.
Empty file modified fonts/glyphicons-halflings-regular.woff
100755 → 100644
Empty file.
148 changes: 148 additions & 0 deletions form-cc-example (1).html
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Ido Green | greenido.wordpress.com | @greenido">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#db5945">
<title>Auto Complete Attribute Example</title>
<style type="text/css">
input, textarea {
padding-top: 0.5em;
padding-bottom: 0.5em;
width: 100%;
border: 1px solid gray;
}
p {
background: rgba(244, 187, 110, 0.47);
padding: 0.7em;
border-radius: 1em;
}
form {
width: 100%;
}
input.dirty:not(:focus):invalid {
background-color: #FFD9D9;
}
input.dirty:not(:focus):valid {
background-color: #D9FFD9;
}
fieldset {
background: rgba(199, 183, 171, 0.61);
margin-top: 2.5em;
border-radius: 1em;
}
legend {
font-size: 120%;
padding-right: 0.5em;
padding-left: 0.5em;
}
#butCheckout {
padding: 1.5em;
border-radius: 0.2em;
}
</style>
<body>
<h1>AutoComplete Example</h1>
<p>
To try this example, open it in Chrome (version 42+) and try to start filling the fields. Chrome will suggest you 'auto fill' data from what it got so far.
<br></p>
<h3>Wallet Integration</h3>
<p>
If you got
<a href="http://google.com/wallet">Google Wallet</a>
with you credit card data, even better! Go to the
<a href="#paymentSec">'Payment' section</a>
and start to fill the data. Chrome will offer you to pre-fill it with the current credit card's information wallet got on file.
<br>
(!) The current spec can be found at:
<a href="https://html.spec.whatwg.org/multipage/forms.html#association-of-controls-and-forms">html.spec.whatwg.org/multipage/forms.html</a>
</p>
<h3>Material Design</h3>
<p>
You can see one way to leverage the power of material design with these forms in this
<a href="form-cc-example-m2.html">Material design example</a>
</p>
<div role="main">
<form method="post" id="usrForm">
<fieldset>
<legend>Contact Info</legend>
<label for="frmNameA">Name</label>
<input name="name" id="frmNameA" placeholder="Full name" required autocomplete="name">
<label for="frmEmailA">Email</label>
<input type="email" name="email" id="frmEmailA" placeholder="[email protected]" required autocomplete="email">
<label for="frmEmailC">Confirm Email</label>
<input type="email" name="emailC" id="frmEmailC" placeholder="[email protected]" required autocomplete="email">
<label for="frmPhoneNumA">Phone</label>
<input type="tel" name="phone" id="frmPhoneNumA" placeholder="+1-650-450-1212" required autocomplete="tel">

<datalist id="chocType">
<option value="white">
<option value="milk">
<option value="dark"></datalist>
</fieldset>
<fieldset>
<legend>Shipping</legend>
<label for="frmAddressS">Address</label>
<input name="ship-address" required id="frmAddressS" placeholder="123 Any Street" autocomplete="shipping street-address">
<label for="frmCityS">City</label>
<input name="ship-city" required id="frmCityS" placeholder="New York" autocomplete="shipping locality">
<label for="frmStateS">State</label>
<input name="ship-state" required id="frmStateS" placeholder="NY" autocomplete="shipping region">
<label for="frmZipS">Zip</label>
<input name="ship-zip" required id="frmZipS" placeholder="10011" autocomplete="shipping postal-code">
<label for="frmCountryS">Country</label>
<input name="ship-country" required id="frmCountryS" placeholder="USA" autocomplete="shipping country">

<label>
<input type="checkbox" name="billAndShip" id="cbBillAndShip">
<br>Bill to this address.</label>
</fieldset>
<fieldset>
<legend>Billing</legend>
<label for="frmAddressB">Address</label>
<input name="bill-address" id="frmAddressB" required placeholder="123 Any Street" autocomplete="billing street-address">
<label for="frmCityB">City</label>
<input name="bill-city" id="frmCityB" required placeholder="New York" autocomplete="billing locality">
<label for="frmStateB">State</label>
<input name="bill-state" id="frmStateB" required placeholder="NY" autocomplete="billing region">
<label for="frmZipB">Zip</label>
<input name="bill-zip" id="frmZipB" required placeholder="10011" autocomplete="billing postal-code">
<label for="frmCountryB">Country</label>
<input name="bill-country" id="frmCountryB" required placeholder="USA" autocomplete="billing country"></fieldset>

<div id="paymentSec">
<fieldset>
<legend>Payment</legend>
<p>
Do <b>NOT</b>
provide real credit card information in this field.
</p>
<label for="frmNameCC">Name on card</label>
<input name="ccname" id="frmNameCC" required placeholder="Full Name" autocomplete="cc-name">
<label for="frmCCNum">Card Number</label>
<input name="cardnumber" id="frmCCNum" required autocomplete="cc-number">
<label for="frmCCCVC">CVC</label>
<input name="cvc" id="frmCCCVC" required autocomplete="cc-csc">
<label for="frmCCExp">Expiry</label>
<input name="cc-exp" id="frmCCExp" required placeholder="MM-YYYY" autocomplete="cc-exp">
<div>
<button class="btn" id="butCheckout">Check Out</button>
</div>
</fieldset>
</div>
</form>
</div>
<!-- GA -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-53348325-1', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
</body>
</html>
Loading