Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@keikubo
Created April 12, 2013 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keikubo/5372318 to your computer and use it in GitHub Desktop.
Save keikubo/5372318 to your computer and use it in GitHub Desktop.
WebPayでクレジットカード情報を保存することなく、課金を実現するサンプルコード。
# coding: utf-8
require "stripe"
Stripe.api_key = "vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE" # this is a test key. change it to your API key
Stripe.api_base = "https://api.webpay.jp"
customer = Stripe::Customer.create(
:card => {
:number => "4242424242424242",
:exp_month => 1,
:exp_year => 2015,
:cvc => 123,
:name => "Kei Kubo"
}
)
charge = Stripe::Charge.create(
:amount => 1000,
:currency => "jpy",
:customer => customer["id"]
)
puts charge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment