Skip to content

Instantly share code, notes, and snippets.

View matthewarkin's full-sized avatar

Matthew Arkin matthewarkin

View GitHub Profile
///// ERRORS
var stripe = require("stripe")("sk_test_foo")
stripe.customers.cancelSubscription(
"cus_7kao3kVTFYB3ht",
"sub_7kaoBQVhkpGlsG",{
at_period_end_test:true
},
function(err, subscription) {
console.log(err,subscription)
}
Stripe.card.createToken({
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val(),
exp_year: $('.card-expiry-year').val()
}, function(status, response) {
var $form = $('#payment-form');
if (response.error) {
// Show the errors on the form
var stripe = require("cloud/stripe.js")("XXXXXX")
function createRefund(data){
var promise = new Parse.Promise();
stripe.refunds.create({
amount: 400,
charge: "ch_17fSCXGR6JAGMQRJn0KJL7p5", // obtained with Stripe.js
}, function(err, charge) {
if (err){
promise.reject(err)
<script src="https://js.braintreegateway.com/v2/braintree.js"></script>
<form id="form" action="chargeCustomer.php" method="POST">
</form>
<div id="paypal-container"></div>
<script type="text/javascript">
braintree.setup("<?php echo($gateway->clientToken()->generate());?>", "custom", {
paypal: {
container: "paypal-container",
singleUse: true, // Required
amount: 10.00, // Required
<html><head>
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@matthewarkin" />
<meta name="twitter:title" content="Bitcoin Paper - Download Now: 10k satoshi" />
<meta name="twitter:description" content="Satoshi Nakamoto's original paper is still recommended reading for anyone studying how Bitcoin works." />
<meta name="twitter:image" content="https://bitcoin.org/img/icons/logotop.svg" />
<meta name="btc:amount" content="10000"/>
<meta name="btc:filename" content="bitcoin.pdf"/>
</head><body>
To purchase please download <a href="https://github.com/matthewarkin/bitcoin-twitter/blob/mharkin-buy-item/client.py">client.py</a>
.stripe-button-el {
overflow: hidden;
display: inline-block;
visibility: visible !important;
background-image: -webkit-linear-gradient(#28a0e5, #015e94);
background-image: -moz-linear-gradient(#28a0e5, #015e94);
background-image: -ms-linear-gradient(#28a0e5, #015e94);
background-image: -o-linear-gradient(#28a0e5, #015e94);
background-image: -webkit-linear-gradient(#28a0e5, #015e94);
background-image: -moz-linear-gradient(#28a0e5, #015e94);
@matthewarkin
matthewarkin / charge.php
Created January 26, 2016 20:53
Simple Stripe Checkout Example
<?php
require_once('<path to stripe\init.php');
\Stripe\Stripe::setApiKey("sk_test_mcRHrvvm21fo5e********");
$token = $_POST['stripeToken'];
$charge = \Stripe\Charge::create(array(
'source' => $token,
'amount' => 5000,
'currency' => 'usd'
));
@matthewarkin
matthewarkin / plaid+managed.md
Last active January 25, 2022 21:10
Plaid and Managed Accounts

Ensuring Valid External Accounts with Stripe and Plaid

When adding a bank account to a customer in Stripe, Stripe forces you to verify the bank account (either through microdeposits or through Plaid. This is useful because you don't want to withdraw money from a bank account that a user does not own. However when it comes to sending money to bank accounts, Stripe does not require you to verify the account. After all why would you send money to an account that you're not in control of. But lets face it, users make mistakes and its not uncommon for them to type their routing or account number which can significantly delay their transfers.

One way to prevent this is to get their routing and account number directly from their bank and avoid the possibility of user error. This is where Plaid comes in. Plaid provides instant ACH verification by having the user log into their bank account (similiar to what you may done if you've ever used Mint). The u

<script type="text/javascript" src="https://commencepayments.com/js/commence.js"></script>
<button data-type="CommenceButton"
data-key= "<insert your commence API key>"
data-image="<insert url to your logo>"
data-name="<insert your business name>"
data-description="<description of product you're selling>"
data-amount="<amount to charge customer in cents: eg. 1000 for $10.00>"
data-currency="USD"
data-panelLabel="<Text you want on big button like Pay Now>"
<script>
braintree.setup(clientToken, "dropin", {
container: "dropin-container",
dataCollector: {
kount: {environment: 'sandbox'},
paypal: true
},
onReady: function (braintreeInstance) {
$("#deviceData").val(braintreeInstance.deviceData); // advanced anti-fraud
},