Skip to content

Instantly share code, notes, and snippets.

View matthewarkin's full-sized avatar

Matthew Arkin matthewarkin

View GitHub Profile
<html>
<body>
<form action="charge.php" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="{{Public Key}}"
data-amount="2000"
data-name="Demo Site"
data-description="Subscription ($20.00 per Month)"
data-image="/128x128.png">
property type description
line1 string Address line 1 (Street address/PO Box/Company name)
line2 string Address line 2 (Apartment/Suite/Unit/Building)
city string City/Suburb/Town/Village
state string State/Province/County
postal_code string Zip/Postal Code
country string 2-letter country code
Customer A
Subscrion 1 - set to 0, creates line item of - $10.
Subscription 2 - Set to 2, create line item of + $10.
Next invoice for Subscription 1 will be -$10.
Create this invoice and pay it, the global customer balance will be -$10. (Create it before Subscription 2 is billed)
This customer balance will get applied to Subscription 2's next invoice.
curl https://api.stripe.com/v1/accounts/acct_164Dk6E9BTSoxG7I/bank_accounts -u <api key>: -d bank_account[country]=US \
> -d bank_account[routing_number]=110000000 \
> -d bank_account[account_number]=000123456789
{
"object": "bank_account",
"id": "ba_164DlyE9BTSoxG7IVkLFPqUn",
"last4": "6789",
"country": "US",
"currency": "usd",
"status": "new",
#Retrieve account details request - getting a "Invalid API Key provided: acct_************xxxx" error
curl https://api.stripe.com/v1/account \
-u [LIVE SECRET KEY]: \
-H Stripe-Account:[acct_xxxxxxxxxxxxxx] #the connected account ID
#Transfering $ to a connected account - getting a "Cannot transfer to an unconnected destination account." error
curl https://api.stripe.com/v1/transfers \
-u [LIVE SECRET KEY]: \
-d amount=xxxx \
@matthewarkin
matthewarkin / commence amount from url.js
Created April 17, 2015 20:22
Get commence amount from url
//URL would be like https://yourdomain.com/pay?amount=1300
$(function() {
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
$("[href='#pay']").click(function(e) {
@matthewarkin
matthewarkin / bankaccountoken.js
Created April 16, 2015 20:50
Bank Account token response
{
"id": "btok_64SrtnJR9qQnAC",
"livemode": false,
"created": 1429217396,
"used": false,
"object": "token",
"type": "bank_account",
"bank_account": {
"object": "bank_account",
"id": "ba_64SrZ3q6ziWX7o",
$ curl https://api.stripe.com/v1/events/evt_15rtqCAUDjBBTb8yXU17IMj -u <Access_Token>:
{
"error": {
"type": "invalid_request_error",
"message": "Expired API key provided: sk_test_********************AzJX. Platform access may have been revoked."
}
}
$ curl https://api.stripe.com/v1/events -u <Access_Token>:
{
"error": {
@matthewarkin
matthewarkin / keybase.md
Created April 15, 2015 02:07
Keybase.io

Keybase proof

I hereby claim:

  • I am matthewarkin on github.
  • I am matthewarkin (https://keybase.io/matthewarkin) on keybase.
  • I have a public key whose fingerprint is 3A57 F8C5 6CC4 521C 2E60 30B8 A473 3160 6821 D3C5

To claim this, I am signing this object:

@matthewarkin
matthewarkin / gist:aec305313b4d81cd98a1
Created March 22, 2015 06:48
Revoke connected account over api
curl https://connect.stripe.com/oauth/deauthorize \
-H "Authorization: Bearer sk_test_*****************" \
-d client_id=ca_********************* \
-d stripe_user_id=acct_*****************