checkout_sdk 0.1.4 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +20 -20
- data/README.md +96 -22
- data/checkout_sdk.gemspec +3 -3
- data/documentation/.gitignore +20 -0
- data/documentation/docs/environment.md +26 -0
- data/documentation/docs/getting_started.md +48 -0
- data/documentation/docs/initialize.md +19 -0
- data/documentation/docs/install.md +21 -0
- data/documentation/docs/payments.md +200 -0
- data/documentation/docs/sources.md +53 -0
- data/documentation/docs/tokens.md +88 -0
- data/documentation/docusaurus.config.js +60 -0
- data/documentation/package-lock.json +13511 -0
- data/documentation/package.json +32 -0
- data/documentation/sidebars.js +10 -0
- data/documentation/src/css/custom.css +103 -0
- data/documentation/src/pages/index.js +10 -0
- data/documentation/src/pages/styles.module.css +37 -0
- data/documentation/static/img/favicon.png +0 -0
- data/documentation/static/img/logo.png +0 -0
- data/documentation/static/img/undraw_docusaurus_mountain.svg +170 -0
- data/documentation/static/img/undraw_docusaurus_react.svg +169 -0
- data/documentation/static/img/undraw_docusaurus_tree.svg +1 -0
- data/documentation/yarn.lock +9369 -0
- data/lib/checkout_sdk/api_resource.rb +16 -5
- data/lib/checkout_sdk/configuration.rb +2 -1
- data/lib/checkout_sdk/data/payment_request_source.rb +2 -1
- data/lib/checkout_sdk/version.rb +1 -1
- data/spec/checkout_sdk/api_resource_spec.rb +5 -5
- data/spec/checkout_sdk_spec.rb +14 -0
- metadata +38 -11
@@ -0,0 +1,88 @@
|
|
1
|
+
---
|
2
|
+
id: tokens
|
3
|
+
title: Tokens
|
4
|
+
---
|
5
|
+
|
6
|
+
export const Highlight = ({children, color}) => (
|
7
|
+
<span
|
8
|
+
style={{
|
9
|
+
color: color,
|
10
|
+
padding: '0.2rem',
|
11
|
+
}}>
|
12
|
+
{children}
|
13
|
+
</span>
|
14
|
+
);
|
15
|
+
|
16
|
+
You can find a list of request body parameters and possible outcomes [here](https://api-reference.checkout.com/#tag/Tokens).
|
17
|
+
|
18
|
+
## Request a token for <Highlight color="#25c2a0">Apple Pay</Highlight>
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
header_data = { "ephemeralPublicKey" => "XXX",
|
22
|
+
"publicKeyHash" => "XXX",
|
23
|
+
"transactionId" => "XXX" }
|
24
|
+
|
25
|
+
token_request_source = CheckoutSdk::RequestToken.new
|
26
|
+
token_request_source.type = "applepay"
|
27
|
+
token_request_source.token_data_version = "EC_v1"
|
28
|
+
token_request_source.token_data_data = "XXX"
|
29
|
+
token_request_source.token_data_signature = "XXX"
|
30
|
+
token_request_source.token_data_header = header_data
|
31
|
+
|
32
|
+
# Send API call
|
33
|
+
response = api_resource.request_token(token_request_source)
|
34
|
+
|
35
|
+
# response parsing
|
36
|
+
puts(response.data) # => {...}
|
37
|
+
puts(response.body) # => "..."
|
38
|
+
```
|
39
|
+
|
40
|
+
## Request a token for <Highlight color="#25c2a0">Google Pay</Highlight>
|
41
|
+
|
42
|
+
const token = await cko.tokens.request({
|
43
|
+
// type:"googlepay" is inferred
|
44
|
+
token_data: {
|
45
|
+
protocolVersion: 'EC_v1',
|
46
|
+
signature: 'XXX',
|
47
|
+
signedMessage: 'XXX'
|
48
|
+
}
|
49
|
+
});
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
token_request_source = CheckoutSdk::RequestToken.new
|
53
|
+
token_request_source.type = "googlepay"
|
54
|
+
token_request_source.token_data_protocolVersion = "ECv1"
|
55
|
+
token_request_source.token_data_signature = "XXX"
|
56
|
+
token_request_source.token_data_signedMessage = "XXX"
|
57
|
+
|
58
|
+
# Send API call
|
59
|
+
response = api_resource.request_token(token_request_source)
|
60
|
+
|
61
|
+
# response parsing
|
62
|
+
puts(response.data) # => {...}
|
63
|
+
puts(response.body) # => "..."
|
64
|
+
```
|
65
|
+
|
66
|
+
## Request a token for <Highlight color="#25c2a0">raw card details</Highlight>
|
67
|
+
|
68
|
+
:::warning
|
69
|
+
|
70
|
+
If you do not have SAQ-D level PCI Compliance, this interaction can only be done in the Sandbox environment. This is in case you want to unit test your code and need a token to make a payment. In the Production environment, you need to use an integrated solution such as **[Frames](https://docs.checkout.com/quickstart/integrate/frames)** to generate the token for you.
|
71
|
+
|
72
|
+
:::
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
token_request_source = CheckoutSdk::RequestToken.new
|
76
|
+
token_request_source.type = "card"
|
77
|
+
token_request_source.card_number = "4242424242424242"
|
78
|
+
token_request_source.card_expiry_month = 6
|
79
|
+
token_request_source.card_expiry_year = 28
|
80
|
+
token_request_source.card_cvv = "100"
|
81
|
+
|
82
|
+
# Send API call
|
83
|
+
response = api_resource.request_token(token_request_source)
|
84
|
+
|
85
|
+
# response parsing
|
86
|
+
puts(response.data) # => {...}
|
87
|
+
puts(response.body) # => "..."
|
88
|
+
```
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module.exports = {
|
2
|
+
title: "checkout-sdk-ruby",
|
3
|
+
tagline: "Checkout.com SDK for Ruby",
|
4
|
+
url: "https://checkout.github.io",
|
5
|
+
baseUrl: "/checkout-sdk-ruby/",
|
6
|
+
favicon: "img/favicon.png",
|
7
|
+
organizationName: "checkout", // Usually your GitHub org/user name.
|
8
|
+
projectName: "checkout-sdk-ruby", // Usually your repo name.
|
9
|
+
themeConfig: {
|
10
|
+
prism: {
|
11
|
+
additionalLanguages: ["ruby", "bash"],
|
12
|
+
},
|
13
|
+
navbar: {
|
14
|
+
title: "checkout-sdk-ruby",
|
15
|
+
logo: {
|
16
|
+
alt: "checkout-sdk-ruby",
|
17
|
+
src: "img/logo.png",
|
18
|
+
},
|
19
|
+
items: [
|
20
|
+
{
|
21
|
+
to: "getting_started",
|
22
|
+
activeBasePath: "docs",
|
23
|
+
label: "Docs",
|
24
|
+
position: "right",
|
25
|
+
},
|
26
|
+
{
|
27
|
+
href: "https://github.com/checkout/checkout-sdk-ruby",
|
28
|
+
label: "GitHub",
|
29
|
+
position: "right",
|
30
|
+
},
|
31
|
+
],
|
32
|
+
},
|
33
|
+
footer: {
|
34
|
+
style: "dark",
|
35
|
+
copyright: `© ${new Date().getFullYear()} Checkout.com `,
|
36
|
+
},
|
37
|
+
googleAnalytics: {
|
38
|
+
trackingID: "UA-165971486-1",
|
39
|
+
},
|
40
|
+
},
|
41
|
+
presets: [
|
42
|
+
[
|
43
|
+
"@docusaurus/preset-classic",
|
44
|
+
{
|
45
|
+
docs: {
|
46
|
+
sidebarPath: require.resolve("./sidebars.js"),
|
47
|
+
routeBasePath: "/",
|
48
|
+
// editUrl: 'https://github.com/facebook/docusaurus/edit/master/website/'
|
49
|
+
},
|
50
|
+
theme: {
|
51
|
+
customCss: require.resolve("./src/css/custom.css"),
|
52
|
+
},
|
53
|
+
},
|
54
|
+
],
|
55
|
+
],
|
56
|
+
plugins: [
|
57
|
+
// Basic usage.
|
58
|
+
// require.resolve('@docusaurus/plugin-google-analytics'),
|
59
|
+
],
|
60
|
+
};
|