Skip to content

Instantly share code, notes, and snippets.

Kei Kubo keikubo

Block or report user

Report or block keikubo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View webpay-active-merchant-example.rb
require 'active_merchant'
ActiveMerchant::Billing::Base.mode = :test
gateway = ActiveMerchant::Billing::WebpayGateway.new(:login => 'test_secret_eHn4TTgsGguBcW764a2KA8Yd')
amount = 10000 # 100 yen
credit_card = ActiveMerchant::Billing::CreditCard.new(
:first_name => 'Kei',
:last_name => 'Kubo',
View pay-via-phone.rb
require 'twilio-ruby'
require 'webpay'
post '/' do
Twilio::TwiML::Response.new do |r|
r.Gather :timeout => "10", :finishOnKey => "*", :action => '/month' do |g|
g.Say "Please enter your credit card number and then press star."
end
end.text
end
View gist:7723060
1111.94 - 1139.17 (coinbase)
1115.51 - 1117.51 (bitstamp)
1224.00001 - 1224.4 (Mt. Gox)
1116.46849 - 1125.42705 (Kraken)
1041.18 - 1042 (BTC-E)
1093.2799 - 1096.4686 (itBit)
1168.305 - 1203.450 (Justcoin BTCUSD)
at 2013-12-01 03:06:51 +0900
View gist:7722423
require 'http'
require 'json'
require 'bitstamp'
require 'mtgox'
require 'btce'
# coinbase
coinbase_buy = HTTP.get "https://coinbase.com/api/v1/prices/buy",
:params => { :api_key => 'COINBASE_API_KEY',
:amount => "1.00", :currency => "USD"}
View index.html
<div class='container'>
<div class='row'>
<div class='span12'>
<h2>Samurai Startup IslandのDayPassを購入してスタートアップライフを満喫しましょう!</h2>
<h4>価格: 2,100円</h4>
<form accept-charset="UTF-8" action="/tickets" class="new_ticket" id="new_ticket" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="xhANERJ85JA2nKY9esTc7hTIOQiLd6n0lrFn6QWqTmE=" /></div>
<label for="ticket_name">名前</label>
<input id="ticket_name" name="ticket[name]" size="30" type="text" />
<label for="ticket_email">メールアドレス</label>
View index.html
<div class='container'>
<div class='row'>
<div class='span12'>
<h2>Samurai Startup IslandのDayPassを購入してスタートアップライフを満喫しましょう!</h2>
<h4>価格: 2,100円</h4>
<form accept-charset="UTF-8" action="/tickets" class="new_ticket" id="new_ticket" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="xhANERJ85JA2nKY9esTc7hTIOQiLd6n0lrFn6QWqTmE=" /></div>
<label for="ticket_name">名前</label>
<input id="ticket_name" name="ticket[name]" size="30" type="text" />
<label for="ticket_email">メールアドレス</label>
View gist:5461317
curl "https://api.webpay.jp/v1/plans" \
-u "test_secret_key:" \
-d "amount=1500" \
-d "interval=week" \
-d "name=すごいプラン" \
-d "currency=jpy" \
-d "id=great plan" \
-d "interval_count=5"
@keikubo
keikubo / webpay-win8.js
Last active Dec 16, 2015
WebPay Win8 App SDK for using a publishable key to tokenize credit card information for complying PCI DSS. PCI DSSに準拠するためのWebPay JS SDK for Win8。 クレジットカードをアプリ側でトークン化することでセキュアな取引を可能にします。
View webpay-win8.js
// Copyright (c) 2013 Kei Kubo <keikubo@webpay.jp> (MIT License)
(function () {
var e = this;
this.Webpay = function () {
return e.endpoint = 'https://api.webpay.jp/v1', e.key = null,
e.setPublishableKey = function (key) {
e.key = key;
},
e.setApiBase = function (endpoint) {
@keikubo
keikubo / customer_sample.rb
Created Apr 12, 2013
WebPayでクレジットカード情報を保存することなく、課金を実現するサンプルコード。
View customer_sample.rb
# 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,
@keikubo
keikubo / get_charge.rb
Created Apr 6, 2013
Ruby1.8.5でWebPayのRest APIを使う例。
View get_charge.rb
#!/usr/bin/env ruby
require 'net/https'
require 'uri'
require 'rubygems'
require 'json'
url = URI.parse('https://api.webpay.jp/v1/charges/ch_WO14ib0ANJiSHn')
req = Net::HTTP::Get.new(url.path)
req.basic_auth 'vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE', ''
You can’t perform that action at this time.