checkout_sdk 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 619074f072079a4136b62f90dcdf3e9ba0f9f3fd
4
- data.tar.gz: 0b2dabf17e561c4d40c63db7a9b1690822a3bce0
2
+ SHA256:
3
+ metadata.gz: 26f117e315cedf6293b15fabeca2736d00a5e59a98257e0f6af6c111e1d4ca7b
4
+ data.tar.gz: 17935194ff3650b305c3f2795c6932cb61a2b07e84259683397785367bb4d8fe
5
5
  SHA512:
6
- metadata.gz: cefed8d1d8cf7853c9bda436a867ac7a96746ea69991797364b7d29b65aca9c70f5cfb2788e8176268251d89af6ddcbd791ef5370678cfde95e18e675d7d828d
7
- data.tar.gz: 9771f371fb8b6185e3e9cb382f086d589595e9e4893eb02c1da59ba9ad3f1e6eda3367bb4b264f014297d7e7ebe9c26af441ab458335e67033d4097dd1fd26ba
6
+ metadata.gz: e76a36a2f4ffabace3f0911192b63eeda2119ee39bc0b1fad7792afdd81222b6e6a3acc42f85d2209510cb15fbe5893988e88c69c65dc51cf171824f74fbb14c
7
+ data.tar.gz: 36767831e67555237bf1f2f8ed28ff861693bd32737c3b7f5d7f0a1579a2ba8c53e7280ad13cfa02937a48f2e5dd80a1fe06a1fdf8986f17736c1c050d94f2c5
data/Gemfile.lock CHANGED
@@ -1,45 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- checkout_sdk (0.2.1)
5
- excon (>= 0.66, < 0.72)
4
+ checkout_sdk (0.3.2)
5
+ excon (>= 0.66, <= 0.88.0)
6
6
  multi_json (~> 1.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- coderay (1.1.2)
12
- diff-lcs (1.3)
13
- excon (0.71.1)
11
+ coderay (1.1.3)
12
+ diff-lcs (1.4.4)
13
+ excon (0.88.0)
14
14
  method_source (0.9.2)
15
- multi_json (1.14.1)
15
+ multi_json (1.15.0)
16
16
  pry (0.11.3)
17
17
  coderay (~> 1.1.0)
18
18
  method_source (~> 0.9.0)
19
19
  rake (10.5.0)
20
- rspec (3.8.0)
21
- rspec-core (~> 3.8.0)
22
- rspec-expectations (~> 3.8.0)
23
- rspec-mocks (~> 3.8.0)
24
- rspec-core (3.8.2)
25
- rspec-support (~> 3.8.0)
26
- rspec-expectations (3.8.4)
20
+ rspec (3.10.0)
21
+ rspec-core (~> 3.10.0)
22
+ rspec-expectations (~> 3.10.0)
23
+ rspec-mocks (~> 3.10.0)
24
+ rspec-core (3.10.1)
25
+ rspec-support (~> 3.10.0)
26
+ rspec-expectations (3.10.1)
27
27
  diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.8.0)
29
- rspec-mocks (3.8.1)
28
+ rspec-support (~> 3.10.0)
29
+ rspec-mocks (3.10.2)
30
30
  diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.8.0)
32
- rspec-support (3.8.2)
31
+ rspec-support (~> 3.10.0)
32
+ rspec-support (3.10.2)
33
33
 
34
34
  PLATFORMS
35
35
  ruby
36
36
 
37
37
  DEPENDENCIES
38
- bundler (~> 1.16)
38
+ bundler (~> 2.0)
39
39
  checkout_sdk!
40
40
  pry (~> 0.11.3)
41
41
  rake (~> 10.0)
42
- rspec (~> 3.0)
42
+ rspec (~> 3.5)
43
43
 
44
44
  BUNDLED WITH
45
- 1.17.3
45
+ 2.2.31
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
- # CheckoutSdk
1
+ [![GitHub license](https://img.shields.io/github/license/checkout/checkout-sdk-ruby.svg)](https://github.com/checkout/checkout-sdk-ruby/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/checkout/checkout-sdk-ruby.svg)](https://GitHub.com/checkout/checkout-sdk-ruby/releases/)
2
2
 
3
- You are reading documentation for version: 0.2.1
3
+ <p align="center"><img src="https://i.ibb.co/5Mx7ZsS/Screenshot-2020-07-30-at-17-20-31.png" width="20%"></p>
4
4
 
5
- ## Installation
5
+ # Checkout.com Ruby SDK
6
+
7
+ # :rocket: Install
6
8
 
7
9
  Add this line to your application's Gemfile:
8
10
 
@@ -12,13 +14,17 @@ gem 'checkout_sdk'
12
14
 
13
15
  And then execute:
14
16
 
15
- $ bundle
17
+ ```bash
18
+ $ bundle
19
+ ```
16
20
 
17
21
  Or install it yourself as:
18
22
 
19
- $ gem install checkout_sdk
23
+ ```bash
24
+ $ gem install checkout_sdk
25
+ ```
20
26
 
21
- ## Configuration
27
+ # :wrench: Configure
22
28
 
23
29
  API keys must be configured in the gem setup. You can do this anywhere in your application before you make API calls using the gem.
24
30
 
@@ -27,10 +33,15 @@ CheckoutSdk.configure do |config|
27
33
  config.secret_key = ENV['SECRET_KEY']
28
34
  config.public_key = ENV['PUBLIC_KEY']
29
35
  config.base_url = ENV['BASE_URL']
36
+ config.persistent = true|false # default: true
30
37
  end
31
38
  ```
32
39
 
33
- ## Usage
40
+ # :book: Documentation
41
+
42
+ You can see the [SDK documentation here](https://checkout.github.io/checkout-sdk-ruby/getting_started/).
43
+
44
+ # :dash: Quickstart
34
45
 
35
46
  #### Source Type: `token`
36
47
  A card token can be obtained using one of Checkout.com's JavaScript frontend solutions such as [Frames](https://docs.checkout.com/docs/frames "Frames") or any of the [mobile SDKs](https://docs.checkout.com/docs/sdks#section-mobile-sdk-libraries "Mobile SDKs")
@@ -113,20 +124,27 @@ response.local_port # => 51601
113
124
  response.local_address # => "..."
114
125
  ```
115
126
 
116
- #### NB: Using boolean/falsey values
127
+ # :warning: Boolean/falsy values
128
+
129
+ "nil" or empty strings will be stripped from API calls
130
+
117
131
  ```ruby
118
- # `nil` or empty strings
132
+ # ignored
119
133
  payment_request_source.capture = nil
120
134
  payment_request_source.capture = ""
121
- # will be stripped from API call
135
+ ```
136
+
137
+ but "false" or 0 are retained and sent in the request
122
138
 
123
- # but `false`, or 0
139
+ ```ruby
140
+ # sent
124
141
  payment_request_source.capture = false
125
142
  payment_request_source.capture = 0
126
- # are retained and sent in request
127
143
  ```
128
- See [api_resource_spec](https://github.com/checkout/checkout-sdk-ruby/blob/master/spec/checkout_sdk/api_resource_spec.rb#L10-L24) for details
144
+ See [api_resource_spec](https://github.com/checkout/checkout-sdk-ruby/blob/master/spec/checkout_sdk/api_resource_spec.rb#L10-L24) for details.
129
145
 
130
- ## Tests
146
+ # :rotating_light: Tests
131
147
 
132
- $ rspec
148
+ ```bash
149
+ $ rspec
150
+ ```
data/checkout_sdk.gemspec CHANGED
@@ -15,10 +15,10 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ["lib"]
16
16
  spec.license = "MIT"
17
17
 
18
- spec.add_development_dependency "bundler", "~> 1.16"
18
+ spec.add_development_dependency "bundler", "~> 2.0"
19
19
  spec.add_development_dependency "rake", "~> 10.0"
20
- spec.add_development_dependency "rspec", "~> 3.0"
20
+ spec.add_development_dependency "rspec", "~> 3.5"
21
21
  spec.add_development_dependency "pry", "~> 0.11.3"
22
22
  spec.add_dependency "multi_json", '~> 1.0'
23
- spec.add_dependency "excon", ">= 0.66", "< 0.72"
23
+ spec.add_dependency "excon", ">= 0.66", "<= 0.88.0"
24
24
  end
@@ -0,0 +1,20 @@
1
+ # Dependencies
2
+ /node_modules
3
+
4
+ # Production
5
+ /build
6
+
7
+ # Generated files
8
+ .docusaurus
9
+ .cache-loader
10
+
11
+ # Misc
12
+ .DS_Store
13
+ .env.local
14
+ .env.development.local
15
+ .env.test.local
16
+ .env.production.local
17
+
18
+ npm-debug.log*
19
+ yarn-debug.log*
20
+ yarn-error.log*
@@ -0,0 +1,26 @@
1
+ ---
2
+ id: environment
3
+ title: Environment
4
+ ---
5
+
6
+ The SDK will target an environment based on the **base_url** value you provide when you initialize it:
7
+
8
+ **Sandbox**: https://api.sandbox.checkout.com
9
+
10
+ **Live**: https://api.checkout.com
11
+
12
+ :::caution
13
+
14
+ Public and secret key pairs will only work for their relevant environment. Sandbox keys begin with "pk&#95;test&#95;" or "sk&#95;test&#95;". You will receive separate Live keys for use in your production environment when going live with Checkout.com.
15
+
16
+ :::
17
+
18
+ ## Testing
19
+
20
+ If you are testing in the Sandbox environment, Checkout.com provides a list of [test card details](https://docs.checkout.com/testing/test-card-numbers). You can also simulate a lot of edge cases like Declines, by using [special transaction values](https://docs.checkout.com/testing/response-code-testing).
21
+
22
+ :::note
23
+
24
+ You can also test 3D Secure with the test cards provided. If you want to test 3DS 2 flows, use the cards mentioned [here](https://docs.checkout.com/testing/3d-secure-testing).
25
+
26
+ :::
@@ -0,0 +1,48 @@
1
+ ---
2
+ id: getting_started
3
+ title: Getting Started
4
+ sidebar_label: Getting Started
5
+ ---
6
+
7
+ The Checkout.com Ruby SDK makes it easy to interact with the Unified Payments API. You can easily accept card payments and manage these using the same integration.
8
+
9
+ [![GitHub license](https://img.shields.io/github/license/checkout/checkout-sdk-ruby.svg)](https://github.com/checkout/checkout-sdk-ruby/blob/master/LICENSE) [![GitHub release](https://img.shields.io/github/release/checkout/checkout-sdk-ruby.svg)](https://GitHub.com/checkout/checkout-sdk-ruby/releases/)
10
+
11
+ ## Get a test account
12
+
13
+ If you are starting the integration process, and you want to start interacting with Checkout.com's API, you will need a test account, so you can get your API keys.
14
+
15
+ export const RedirectButton = ({text, link}) => (
16
+ <a
17
+ href={link}
18
+ target="\_blank"
19
+ className="get-test-account">{text}</a>
20
+ );
21
+
22
+ <RedirectButton text="Get a test account" link="https://www.checkout.com/get-test-account" />
23
+
24
+ ## Authentication
25
+
26
+ export const Highlight = ({children, color}) => (
27
+ <span
28
+ style={{
29
+ backgroundColor: color,
30
+ borderRadius: '2px',
31
+ color: '#fff',
32
+ padding: '0.2rem',
33
+ }}>
34
+ {children}
35
+ </span>
36
+ );
37
+
38
+ When you sign up for an account, you are given a secret and public API key pair. They will be used to initialise the SDK. You can find the keys by navigating to <Highlight color="#1877F2">Settings > Channels > API keys</Highlight> in Checkout.com's Hub.
39
+
40
+ :::warning
41
+
42
+ Never share your secret keys. Keep them guarded and secure.
43
+
44
+ :::
45
+
46
+ ## Payload and Responses
47
+
48
+ If you want to see all the parameters that you can provide in API requests, as well as examples of possible responses, please follow the Checkout.com [API Reference](https://api-reference.checkout.com/).
@@ -0,0 +1,19 @@
1
+ ---
2
+ id: initialize
3
+ title: Initialize
4
+ ---
5
+
6
+ ## Configuration
7
+
8
+ API keys must be configured in the gem setup. You can do this anywhere in your application before you make API calls using the gem.
9
+
10
+ ```ruby
11
+ CheckoutSdk.configure do |config|
12
+ config.secret_key = "your secret key"
13
+ config.public_key = "your public key"
14
+ config.base_url = "https://api.sandbox.checkout.com" #for sandbox
15
+ end
16
+
17
+ api_resource = CheckoutSdk::ApiResource.new
18
+ ```
19
+
@@ -0,0 +1,21 @@
1
+ ---
2
+ id: install
3
+ title: Install
4
+ ---
5
+
6
+ ## Add to your application's Gemfile
7
+
8
+ ```ruby
9
+ gem 'checkout_sdk'
10
+ ```
11
+
12
+ And then execute:
13
+ ```bash
14
+ $ bundle
15
+ ```
16
+
17
+ ## Or install yourself
18
+
19
+ ```bash
20
+ $ gem install checkout_sdk
21
+ ```
@@ -0,0 +1,200 @@
1
+ ---
2
+ id: payments
3
+ title: Payments
4
+ ---
5
+
6
+ You can find a list of request body parameters and possible outcomes [here](https://api-reference.checkout.com/#tag/Payments).
7
+
8
+ export const Highlight = ({children, color}) => (
9
+ <span
10
+ style={{
11
+ color: color,
12
+ padding: '0.2rem',
13
+ }}>
14
+ {children}
15
+ </span>
16
+ );
17
+
18
+ :::important
19
+
20
+ #### Using boolean/falsy values
21
+
22
+ "nil" or empty strings will be stripped from API calls
23
+
24
+ ```ruby
25
+ # ignored
26
+ payment_request_source.capture = nil
27
+ payment_request_source.capture = ""
28
+ ```
29
+
30
+ but "false" or 0 are retained and sent in the request
31
+
32
+ ```ruby
33
+ # sent
34
+ payment_request_source.capture = false
35
+ payment_request_source.capture = 0
36
+ ```
37
+ See [api_resource_spec](https://github.com/checkout/checkout-sdk-ruby/blob/master/spec/checkout_sdk/api_resource_spec.rb#L10-L24) for details.
38
+
39
+ :::
40
+
41
+ ## Request a card payment with a <Highlight color="#25c2a0">card token</Highlight>
42
+
43
+ The card token is generated by front-end integration options such as [Frames](https://docs.checkout.com/docs/frames) or one of the [Mobile SDKs](https://docs.checkout.com/docs/sdks#section-mobile-sdk-libraries). Keep in mind that this token expires in 15 minutes and can only be used once.
44
+
45
+ ```ruby
46
+ payment_request_source = CheckoutSdk::PaymentRequestSource.new
47
+ payment_request_source.type = "token"
48
+ payment_request_source.token = "tok_ubfj2q76miwundwlk72vxt2i7q"
49
+ payment_request_source.amount = 1000
50
+ payment_request_source.currency = "GBP"
51
+ payment_request_source.reference = "ORD-090857"
52
+
53
+ # Send API call
54
+ response = api_resource.request_payment(payment_request_source)
55
+
56
+ # response parsing
57
+ puts(response.data) # => {...}
58
+ puts(response.body) # => "..."
59
+ ```
60
+
61
+ ## Request a card payment with a <Highlight color="#25c2a0">full card details</Highlight>
62
+
63
+ :::warning
64
+
65
+ You need to have a high level of PCI Compliance (SAQ-D) to be able to send requests with full card details. Note that unless this payment option is enabled on your account by Checkout.com, the <Highlight color="#5A522C">request will fail</Highlight>. Contact you account manager to request access for this payment interaction.
66
+
67
+ :::
68
+
69
+ ```ruby
70
+ payment_request_source = CheckoutSdk::PaymentRequestSource.new
71
+ payment_request_source.type = "card"
72
+ payment_request_source.card_number = "4242424242424242"
73
+ payment_request_source.card_expiry_month = 6
74
+ payment_request_source.card_expiry_year = 2025
75
+ payment_request_source.card_name = "Bruce Wayne"
76
+ payment_request_source.card_cvv = "100"
77
+ payment_request_source.amount = 1000
78
+ payment_request_source.currency = "GBP"
79
+
80
+ # Send API call
81
+ response = api_resource.request_payment(payment_request_source)
82
+
83
+ # response parsing
84
+ puts(response.data) # => {...}
85
+ puts(response.body) # => "..."
86
+ ```
87
+
88
+ ## Request a card payment with a <Highlight color="#25c2a0">an existing card</Highlight>
89
+
90
+ After you perform at least one successful payment for a customer, Checkout.com will return a <Highlight color="#02b48f">source.id</Highlight>. This id does not expire, so it can be used to perform subsequent payments without needing the customer to enter the card details again.
91
+
92
+ ```ruby
93
+ payment_request_source = CheckoutSdk::PaymentRequestSource.new
94
+ payment_request_source.type = "id"
95
+ payment_request_source.token = "src_vg3tm54ndfbefotjlmgrrvbxli"
96
+ payment_request_source.amount = 1000
97
+ payment_request_source.currency = "GBP"
98
+
99
+ # Send API call
100
+ response = api_resource.request_payment(payment_request_source)
101
+
102
+ # response parsing
103
+ puts(response.data) # => {...}
104
+ puts(response.body) # => "..."
105
+ ```
106
+
107
+ ## Request a <Highlight color="#25c2a0">3D Secure payment</Highlight>
108
+
109
+ You have the ability to authenticate with 3DS in a payment request. The request body is similar to normal card payments, but with some additional parameters. [Read more about 3DS](https://docs.checkout.com/docs/3d-secure-payments)
110
+
111
+ ```ruby
112
+ payment_request_source = CheckoutSdk::PaymentRequestSource.new
113
+ payment_request_source.type = "token"
114
+ payment_request_source.token = "tok_ubfj2q76miwundwlk72vxt2i7q"
115
+ payment_request_source.amount = 1000
116
+ payment_request_source.currency = "GBP"
117
+ payment_request_source.reference = "ORD-090857"
118
+ payment_request_source.threeds_enabled = true
119
+
120
+ # Send API call
121
+ response = api_resource.request_payment(payment_request_source)
122
+
123
+ # response parsing
124
+ puts(response.data) # => {...}
125
+ puts(response.body) # => "..."
126
+ ```
127
+
128
+ 3D Secure payments will return a redirection URL. Here is an example of a 3DS response:
129
+
130
+ ```json
131
+ {
132
+ "id": "pay_hehfmlkpykeupofyxf7nbr6yyy",
133
+ "status": "Pending",
134
+ "customer": {
135
+ "id": "cus_u4a4zosnrw7ehhzr7jipbkdzo4"
136
+ },
137
+ "3ds": {
138
+ "downgraded": false,
139
+ "enrolled": "Y"
140
+ },
141
+ "_links": {
142
+ "self": {
143
+ "href": "https://api.sandbox.checkout.com/payments/pay_hehfmlkpykeupofyxf7nbr6yyy"
144
+ },
145
+ "redirect": {
146
+ "href": "https://sandbox.checkout.com/api2/v2/3ds/acs/sid_feixbit6us3utfedjulm6egnsu"
147
+ }
148
+ }
149
+ }
150
+ ```
151
+
152
+ You can access the redirection URL via the SDK like so:
153
+
154
+ ```ruby
155
+ redirectURL = response.data._links.redirect.href
156
+ ```
157
+
158
+ ## Get payment details
159
+
160
+ ```ruby
161
+ details = api_resource.get_payment_details("pay_juevt3h5mcjulir2t5g3wfug6u") # or with session id sid_XXX
162
+ ```
163
+
164
+ ## Get payment actions
165
+
166
+ ```ruby
167
+ actions = api_resource.get_payment_actions("pay_juevt3h5mcjulir2t5g3wfug6u")
168
+ ```
169
+
170
+ ## Capture a payment
171
+
172
+ ```ruby
173
+ capture_payment = CheckoutSdk::CapturePayment.new
174
+ capture_payment.id = "pay_y3oqhf46pyzuxjbcn2giaqnb44"
175
+ capture_payment.amount = "1000"
176
+ capture_payment.reference = "your reference"
177
+
178
+ response = api_resource.capture_payment(capture_payment)
179
+ ```
180
+
181
+ ## Refund a payment
182
+
183
+ ```ruby
184
+ refund_payment = CheckoutSdk::RefundPayment.new
185
+ refund_payment.id = "pay_y3oqhf46pyzuxjbcn2giaqnb44"
186
+ refund_payment.amount = "1000"
187
+ refund_payment.reference = "your reference"
188
+
189
+ response = api_resource.refund_payment(refund_payment)
190
+ ```
191
+
192
+ ## Void a payment
193
+
194
+ ```ruby
195
+ void_payment = CheckoutSdk::VoidPayment.new
196
+ void_payment.id = "pay_y3oqhf46pyzuxjbcn2giaqnb44"
197
+ void_payment.reference = "your reference"
198
+
199
+ response = api_resource.void_payment(void_payment)
200
+ ```
@@ -0,0 +1,53 @@
1
+ ---
2
+ id: sources
3
+ title: Sources
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/Sources).
17
+
18
+ ## Add a <Highlight color="#25c2a0">SEPA source</Highlight>
19
+
20
+ :::note
21
+
22
+ SEPA is not enabled by default, so please let your account manager know if you want to use it.
23
+
24
+ :::
25
+
26
+ ```ruby
27
+ payment_source = CheckoutSdk::PaymentSource.new
28
+ payment_source.type = "sepa"
29
+ payment_source.reference = "X-080957-N34"
30
+
31
+ payment_source.customer_id = "cus_y3oqhf46pyzuxjbcn2giaqnb44"
32
+ payment_source.customer_email = "jokershere@gmail.com"
33
+ payment_source.customer_name = "Jack Napier"
34
+
35
+ payment_source.billing_address_line1 = "Checkout.com"
36
+ payment_source.billing_address_line2 = "Shepherdess Walk"
37
+ payment_source.billing_city = "London"
38
+ payment_source.billing_state = "London"
39
+ payment_source.billing_zip = "N1 7LH"
40
+ payment_source.billing_country = "GB"
41
+
42
+ payment_source.phone_country_code = "+1"
43
+ payment_source.phone_number = "415 555 2671"
44
+
45
+ payment_source.source_data_first_name = "Marcus"
46
+ payment_source.source_data_last_name = "Barrilius Maximus"
47
+ payment_source.source_data_account_iban = "DE25100100101234567893"
48
+ payment_source.source_data_bic = "PBNKDEFFXXX"
49
+ payment_source.source_data_billing_descriptor = "Ruby SDK test"
50
+ payment_source.source_data_mandate_type = "single"
51
+
52
+ response = api_resource.add_payment_source(payment_source)
53
+ ```
@@ -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
+ ```