Skip to content

Instantly share code, notes, and snippets.

@keikubo
Last active December 16, 2015 05:09
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/5382106 to your computer and use it in GitHub Desktop.
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。 クレジットカードをアプリ側でトークン化することでセキュアな取引を可能にします。
// 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) {
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