Created
April 12, 2013 14:15
-
-
Save keikubo/5372318 to your computer and use it in GitHub Desktop.
WebPayでクレジットカード情報を保存することなく、課金を実現するサンプルコード。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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