Last active
December 16, 2015 05:09
-
-
Save keikubo/5382106 to your computer and use it in GitHub Desktop.
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。
クレジットカードをアプリ側でトークン化することでセキュアな取引を可能にします。
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
// Copyright (c) 2013 Kei Kubo <[email protected]> (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) { | |
e.endpoint = endpoint; | |
}, | |
e.createToken = function (data, callback) { | |
var params = JSON.stringify({ | |
card: data, | |
key: e.key | |
}); | |
var path = '/tokens'; | |
WinJS.xhr({ | |
url: e.endpoint + path, | |
type: 'POST', | |
username: e.key, | |
headers: { "Content-type": "application/json" }, | |
data: params, | |
}).then( | |
function completed(response) { | |
callback("success", JSON.parse(response.responseText)); | |
}, | |
function error(response) { | |
callback("error", response); | |
} | |
); | |
}, e | |
}.call(this); | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment