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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7591e018711ebd2cdb259c0e30f41d35ebb40fba79eca4417784c57311daa9fe
4
- data.tar.gz: d9e7b078f08c69b592936f17ebf96413deb572140d714da37963043b1b13c58b
3
+ metadata.gz: ca6ee27eaf4e260f2d1456e773383fa936804a1b975804b1b483f6a201668650
4
+ data.tar.gz: 934c784f177c2958766a1142fc0a81ffaf5018bcd653c5303513902487f26983
5
5
  SHA512:
6
- metadata.gz: b27186569eb0cf3d28280b07a91bca36d8e7320a0d8a0bd5b39cefc5870bfc0b03bf46d63754208a87b1bf2ef3bc454c88b5054a21710de8e609c692023ec810
7
- data.tar.gz: 6fab6f773252974e82e824311359c0997c321054164d3595846fad8bc558f3c4e16d6c2c3d8f92e635e97aa76acbc61c8780d616474c78ec0e714b01f1243279
6
+ metadata.gz: e368612ae8505fa30cd8c0e1c828ba4b553b427b85ea1651eea66863b3c065e241e33a9d1a2a79c88ca8ed27fe88e25b14a599a19391668312c9556be3515957
7
+ data.tar.gz: 5c96b27ffc3d27992dd616f0a9805bdad031f8d6385d9ad4bacb25829da2bf132d2cadc334705b522f295ec80ba7573fff503a51918d4e99a2455c67d2312416
data/Gemfile.lock CHANGED
@@ -1,45 +1,45 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- checkout_sdk (0.1.4)
5
- excon (~> 0.66.0)
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.66.0)
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.13.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.1.4
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,11 +33,70 @@ 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
45
+
46
+ #### Source Type: `token`
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")
48
+
49
+ ```ruby
50
+ payment_request_source = CheckoutSdk::PaymentRequestSource.new
51
+ payment_request_source.type = "token"
52
+ payment_request_source.token = "tok_..."
53
+ payment_request_source.amount = 2022
54
+ payment_request_source.currency = "GBP"
55
+
56
+ api_resource = CheckoutSdk::ApiResource.new
57
+
58
+ # Send API call
59
+ response = api_resource.request_payment(payment_request_source)
60
+
61
+ # response parsing
62
+ response.data # => {...}
63
+ response.body # => "..."
64
+ response.headers # => {...}
65
+ response.remote_ip # => "..."
66
+ response.status # => 200
67
+ response.remote_ip # => "..."
68
+ response.local_port # => 51601
69
+ response.local_address # => "..."
70
+ ```
71
+
72
+ #### Source Type: `id`
34
73
 
74
+ ```ruby
75
+ payment_request_source = CheckoutSdk::PaymentRequestSource.new
76
+ payment_request_source.type = "id"
77
+ payment_request_source.token = "src_..."
78
+ payment_request_source.amount = 2022
79
+ payment_request_source.currency = "GBP"
80
+
81
+ api_resource = CheckoutSdk::ApiResource.new
82
+
83
+ # Send API call
84
+ response = api_resource.request_payment(payment_request_source)
85
+
86
+ # response parsing
87
+ response.data # => {...}
88
+ response.body # => "..."
89
+ response.headers # => {...}
90
+ response.remote_ip # => "..."
91
+ response.status # => 200
92
+ response.remote_ip # => "..."
93
+ response.local_port # => 51601
94
+ response.local_address # => "..."
95
+ ```
96
+
97
+
98
+ #### Source Type: `card`
99
+ [Fully PCI Compliant](https://docs.checkout.com/docs/pci-compliance) merchants only
35
100
  ```ruby
36
101
  payment_request_source = CheckoutSdk::PaymentRequestSource.new
37
102
  payment_request_source.type = "card"
@@ -42,23 +107,11 @@ payment_request_source.card_name = "Bruce Wayne"
42
107
  payment_request_source.card_cvv = "100"
43
108
  payment_request_source.amount = 2022
44
109
  payment_request_source.currency = "GBP"
45
- payment_request_source.capture = true
46
- payment_request_source.threeds_enabled = false
47
- payment_request_source.threeds_attempt_n3d = false
48
- payment_request_source.recipient_dob = "1992-04-06"
49
- payment_request_source.recipient_account_number = "1234567890"
50
- payment_request_source.recipient_zip = "12345"
51
- payment_request_source.recipient_last_name = "Elmo"
52
- payment_request_source.risk_enabled = true
53
- payment_request_source.billing_descriptor_name = "Nancy"
54
- payment_request_source.billing_descriptor_city = "Berlin"
55
- payment_request_source.processing_mid = "CheckoutSdk"
56
-
57
110
 
58
111
  api_resource = CheckoutSdk::ApiResource.new
59
112
 
60
113
  # Send API call
61
- response = api_resource.request_payments(payment_request_source)
114
+ response = api_resource.request_payment(payment_request_source)
62
115
 
63
116
  # response parsing
64
117
  response.data # => {...}
@@ -71,6 +124,27 @@ response.local_port # => 51601
71
124
  response.local_address # => "..."
72
125
  ```
73
126
 
74
- ## Tests
127
+ # :warning: Boolean/falsy values
128
+
129
+ "nil" or empty strings will be stripped from API calls
130
+
131
+ ```ruby
132
+ # ignored
133
+ payment_request_source.capture = nil
134
+ payment_request_source.capture = ""
135
+ ```
136
+
137
+ but "false" or 0 are retained and sent in the request
75
138
 
76
- $ rspec
139
+ ```ruby
140
+ # sent
141
+ payment_request_source.capture = false
142
+ payment_request_source.capture = 0
143
+ ```
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.
145
+
146
+ # :rotating_light: Tests
147
+
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"
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
+ ```