ultracart_api 4.1.12 → 4.1.14

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.
data/docs/CheckoutApi.md CHANGED
@@ -1,1424 +1,1622 @@
1
- # UltracartClient::CheckoutApi
2
-
3
- All URIs are relative to *https://secure.ultracart.com/rest/v2*
4
-
5
- | Method | HTTP request | Description |
6
- | ------ | ------------ | ----------- |
7
- | [**city_state**](CheckoutApi.md#city_state) | **POST** /checkout/city_state | City/State for Zip |
8
- | [**finalize_order**](CheckoutApi.md#finalize_order) | **POST** /checkout/cart/finalizeOrder | Finalize Order |
9
- | [**get_affirm_checkout**](CheckoutApi.md#get_affirm_checkout) | **GET** /checkout/cart/{cart_id}/affirmCheckout | Get affirm checkout (by cart id) |
10
- | [**get_allowed_countries**](CheckoutApi.md#get_allowed_countries) | **POST** /checkout/allowedCountries | Allowed countries |
11
- | [**get_cart**](CheckoutApi.md#get_cart) | **GET** /checkout/cart | Get cart |
12
- | [**get_cart_by_cart_id**](CheckoutApi.md#get_cart_by_cart_id) | **GET** /checkout/cart/{cart_id} | Get cart (by cart id) |
13
- | [**get_cart_by_return_code**](CheckoutApi.md#get_cart_by_return_code) | **GET** /checkout/return/{return_code} | Get cart (by return code) |
14
- | [**get_cart_by_return_token**](CheckoutApi.md#get_cart_by_return_token) | **GET** /checkout/return_token | Get cart (by return token) |
15
- | [**get_state_provinces_for_country**](CheckoutApi.md#get_state_provinces_for_country) | **POST** /checkout/stateProvincesForCountry/{country_code} | Get state/province list for a country code |
16
- | [**handoff_cart**](CheckoutApi.md#handoff_cart) | **POST** /checkout/cart/handoff | Handoff cart |
17
- | [**login**](CheckoutApi.md#login) | **POST** /checkout/cart/profile/login | Profile login |
18
- | [**logout**](CheckoutApi.md#logout) | **POST** /checkout/cart/profile/logout | Profile logout |
19
- | [**register**](CheckoutApi.md#register) | **POST** /checkout/cart/profile/register | Profile registration |
20
- | [**register_affiliate_click**](CheckoutApi.md#register_affiliate_click) | **POST** /checkout/affiliateClick/register | Register affiliate click |
21
- | [**related_items_for_cart**](CheckoutApi.md#related_items_for_cart) | **POST** /checkout/related_items | Related items |
22
- | [**related_items_for_item**](CheckoutApi.md#related_items_for_item) | **POST** /checkout/relatedItems/{item_id} | Related items (specific item) |
23
- | [**setup_browser_key**](CheckoutApi.md#setup_browser_key) | **PUT** /checkout/browser_key | Setup Browser Application |
24
- | [**update_cart**](CheckoutApi.md#update_cart) | **PUT** /checkout/cart | Update cart |
25
- | [**validate_cart**](CheckoutApi.md#validate_cart) | **POST** /checkout/cart/validate | Validate |
26
-
27
-
28
- ## city_state
29
-
30
- > <CityStateZip> city_state(cart)
31
-
32
- City/State for Zip
33
-
34
- Look up the city and state for the shipping zip code. Useful for building an auto complete for parts of the shipping address
35
-
36
- ### Examples
37
-
38
- ```ruby
39
- require 'time'
40
- require 'ultracart_api'
41
- require 'json'
42
- require 'yaml'
43
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
44
-
45
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
46
- # As such, this might not be the best way to use this object.
47
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
48
-
49
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
50
- cart = UltracartClient::Cart.new # Cart | Cart
51
-
52
- begin
53
- # City/State for Zip
54
- result = api_instance.city_state(cart)
55
- p result
56
- rescue UltracartClient::ApiError => e
57
- puts "Error when calling CheckoutApi->city_state: #{e}"
58
- end
59
- ```
60
-
61
- #### Using the city_state_with_http_info variant
62
-
63
- This returns an Array which contains the response data, status code and headers.
64
-
65
- > <Array(<CityStateZip>, Integer, Hash)> city_state_with_http_info(cart)
66
-
67
- ```ruby
68
- begin
69
- # City/State for Zip
70
- data, status_code, headers = api_instance.city_state_with_http_info(cart)
71
- p status_code # => 2xx
72
- p headers # => { ... }
73
- p data # => <CityStateZip>
74
- rescue UltracartClient::ApiError => e
75
- puts "Error when calling CheckoutApi->city_state_with_http_info: #{e}"
76
- end
77
- ```
78
-
79
- ### Parameters
80
-
81
- | Name | Type | Description | Notes |
82
- | ---- | ---- | ----------- | ----- |
83
- | **cart** | [**Cart**](Cart.md) | Cart | |
84
-
85
- ### Return type
86
-
87
- [**CityStateZip**](CityStateZip.md)
88
-
89
- ### Authorization
90
-
91
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
92
-
93
- ### HTTP request headers
94
-
95
- - **Content-Type**: application/json
96
- - **Accept**: application/json
97
-
98
-
99
- ## finalize_order
100
-
101
- > <CartFinalizeOrderResponse> finalize_order(finalize_request)
102
-
103
- Finalize Order
104
-
105
- Finalize the cart into an order. This method can not be called with browser key authentication. It is ONLY meant for server side code to call.
106
-
107
- ### Examples
108
-
109
- ```ruby
110
- require 'time'
111
- require 'ultracart_api'
112
- require 'json'
113
- require 'yaml'
114
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
115
-
116
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
117
- # As such, this might not be the best way to use this object.
118
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
119
-
120
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
121
- finalize_request = UltracartClient::CartFinalizeOrderRequest.new # CartFinalizeOrderRequest | Finalize request
122
-
123
- begin
124
- # Finalize Order
125
- result = api_instance.finalize_order(finalize_request)
126
- p result
127
- rescue UltracartClient::ApiError => e
128
- puts "Error when calling CheckoutApi->finalize_order: #{e}"
129
- end
130
- ```
131
-
132
- #### Using the finalize_order_with_http_info variant
133
-
134
- This returns an Array which contains the response data, status code and headers.
135
-
136
- > <Array(<CartFinalizeOrderResponse>, Integer, Hash)> finalize_order_with_http_info(finalize_request)
137
-
138
- ```ruby
139
- begin
140
- # Finalize Order
141
- data, status_code, headers = api_instance.finalize_order_with_http_info(finalize_request)
142
- p status_code # => 2xx
143
- p headers # => { ... }
144
- p data # => <CartFinalizeOrderResponse>
145
- rescue UltracartClient::ApiError => e
146
- puts "Error when calling CheckoutApi->finalize_order_with_http_info: #{e}"
147
- end
148
- ```
149
-
150
- ### Parameters
151
-
152
- | Name | Type | Description | Notes |
153
- | ---- | ---- | ----------- | ----- |
154
- | **finalize_request** | [**CartFinalizeOrderRequest**](CartFinalizeOrderRequest.md) | Finalize request | |
155
-
156
- ### Return type
157
-
158
- [**CartFinalizeOrderResponse**](CartFinalizeOrderResponse.md)
159
-
160
- ### Authorization
161
-
162
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
163
-
164
- ### HTTP request headers
165
-
166
- - **Content-Type**: application/json
167
- - **Accept**: application/json
168
-
169
-
170
- ## get_affirm_checkout
171
-
172
- > <CartAffirmCheckoutResponse> get_affirm_checkout(cart_id)
173
-
174
- Get affirm checkout (by cart id)
175
-
176
- Get a Affirm checkout object for the specified cart_id parameter.
177
-
178
- ### Examples
179
-
180
- ```ruby
181
- require 'time'
182
- require 'ultracart_api'
183
- require 'json'
184
- require 'yaml'
185
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
186
-
187
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
188
- # As such, this might not be the best way to use this object.
189
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
190
-
191
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
192
- cart_id = 'cart_id_example' # String | Cart ID to retrieve
193
-
194
- begin
195
- # Get affirm checkout (by cart id)
196
- result = api_instance.get_affirm_checkout(cart_id)
197
- p result
198
- rescue UltracartClient::ApiError => e
199
- puts "Error when calling CheckoutApi->get_affirm_checkout: #{e}"
200
- end
201
- ```
202
-
203
- #### Using the get_affirm_checkout_with_http_info variant
204
-
205
- This returns an Array which contains the response data, status code and headers.
206
-
207
- > <Array(<CartAffirmCheckoutResponse>, Integer, Hash)> get_affirm_checkout_with_http_info(cart_id)
208
-
209
- ```ruby
210
- begin
211
- # Get affirm checkout (by cart id)
212
- data, status_code, headers = api_instance.get_affirm_checkout_with_http_info(cart_id)
213
- p status_code # => 2xx
214
- p headers # => { ... }
215
- p data # => <CartAffirmCheckoutResponse>
216
- rescue UltracartClient::ApiError => e
217
- puts "Error when calling CheckoutApi->get_affirm_checkout_with_http_info: #{e}"
218
- end
219
- ```
220
-
221
- ### Parameters
222
-
223
- | Name | Type | Description | Notes |
224
- | ---- | ---- | ----------- | ----- |
225
- | **cart_id** | **String** | Cart ID to retrieve | |
226
-
227
- ### Return type
228
-
229
- [**CartAffirmCheckoutResponse**](CartAffirmCheckoutResponse.md)
230
-
231
- ### Authorization
232
-
233
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
234
-
235
- ### HTTP request headers
236
-
237
- - **Content-Type**: Not defined
238
- - **Accept**: application/json
239
-
240
-
241
- ## get_allowed_countries
242
-
243
- > <CheckoutAllowedCountriesResponse> get_allowed_countries
244
-
245
- Allowed countries
246
-
247
- Lookup the allowed countries for this merchant id
248
-
249
- ### Examples
250
-
251
- ```ruby
252
- require 'time'
253
- require 'ultracart_api'
254
- require 'json'
255
- require 'yaml'
256
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
257
-
258
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
259
- # As such, this might not be the best way to use this object.
260
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
261
-
262
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
263
-
264
- begin
265
- # Allowed countries
266
- result = api_instance.get_allowed_countries
267
- p result
268
- rescue UltracartClient::ApiError => e
269
- puts "Error when calling CheckoutApi->get_allowed_countries: #{e}"
270
- end
271
- ```
272
-
273
- #### Using the get_allowed_countries_with_http_info variant
274
-
275
- This returns an Array which contains the response data, status code and headers.
276
-
277
- > <Array(<CheckoutAllowedCountriesResponse>, Integer, Hash)> get_allowed_countries_with_http_info
278
-
279
- ```ruby
280
- begin
281
- # Allowed countries
282
- data, status_code, headers = api_instance.get_allowed_countries_with_http_info
283
- p status_code # => 2xx
284
- p headers # => { ... }
285
- p data # => <CheckoutAllowedCountriesResponse>
286
- rescue UltracartClient::ApiError => e
287
- puts "Error when calling CheckoutApi->get_allowed_countries_with_http_info: #{e}"
288
- end
289
- ```
290
-
291
- ### Parameters
292
-
293
- This endpoint does not need any parameter.
294
-
295
- ### Return type
296
-
297
- [**CheckoutAllowedCountriesResponse**](CheckoutAllowedCountriesResponse.md)
298
-
299
- ### Authorization
300
-
301
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
302
-
303
- ### HTTP request headers
304
-
305
- - **Content-Type**: Not defined
306
- - **Accept**: application/json
307
-
308
-
309
- ## get_cart
310
-
311
- > <CartResponse> get_cart(opts)
312
-
313
- Get cart
314
-
315
- If the cookie is set on the browser making the request then it will return their active cart. Otherwise it will create a new cart.
316
-
317
- ### Examples
318
-
319
- ```ruby
320
- require 'time'
321
- require 'ultracart_api'
322
- require 'json'
323
- require 'yaml'
324
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
325
-
326
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
327
- # As such, this might not be the best way to use this object.
328
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
329
-
330
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
331
- opts = {
332
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
333
- }
334
-
335
- begin
336
- # Get cart
337
- result = api_instance.get_cart(opts)
338
- p result
339
- rescue UltracartClient::ApiError => e
340
- puts "Error when calling CheckoutApi->get_cart: #{e}"
341
- end
342
- ```
343
-
344
- #### Using the get_cart_with_http_info variant
345
-
346
- This returns an Array which contains the response data, status code and headers.
347
-
348
- > <Array(<CartResponse>, Integer, Hash)> get_cart_with_http_info(opts)
349
-
350
- ```ruby
351
- begin
352
- # Get cart
353
- data, status_code, headers = api_instance.get_cart_with_http_info(opts)
354
- p status_code # => 2xx
355
- p headers # => { ... }
356
- p data # => <CartResponse>
357
- rescue UltracartClient::ApiError => e
358
- puts "Error when calling CheckoutApi->get_cart_with_http_info: #{e}"
359
- end
360
- ```
361
-
362
- ### Parameters
363
-
364
- | Name | Type | Description | Notes |
365
- | ---- | ---- | ----------- | ----- |
366
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
367
-
368
- ### Return type
369
-
370
- [**CartResponse**](CartResponse.md)
371
-
372
- ### Authorization
373
-
374
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
375
-
376
- ### HTTP request headers
377
-
378
- - **Content-Type**: Not defined
379
- - **Accept**: application/json
380
-
381
-
382
- ## get_cart_by_cart_id
383
-
384
- > <CartResponse> get_cart_by_cart_id(cart_id, opts)
385
-
386
- Get cart (by cart id)
387
-
388
- Get a cart specified by the cart_id parameter.
389
-
390
- ### Examples
391
-
392
- ```ruby
393
- require 'time'
394
- require 'ultracart_api'
395
- require 'json'
396
- require 'yaml'
397
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
398
-
399
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
400
- # As such, this might not be the best way to use this object.
401
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
402
-
403
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
404
- cart_id = 'cart_id_example' # String | Cart ID to retrieve
405
- opts = {
406
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
407
- }
408
-
409
- begin
410
- # Get cart (by cart id)
411
- result = api_instance.get_cart_by_cart_id(cart_id, opts)
412
- p result
413
- rescue UltracartClient::ApiError => e
414
- puts "Error when calling CheckoutApi->get_cart_by_cart_id: #{e}"
415
- end
416
- ```
417
-
418
- #### Using the get_cart_by_cart_id_with_http_info variant
419
-
420
- This returns an Array which contains the response data, status code and headers.
421
-
422
- > <Array(<CartResponse>, Integer, Hash)> get_cart_by_cart_id_with_http_info(cart_id, opts)
423
-
424
- ```ruby
425
- begin
426
- # Get cart (by cart id)
427
- data, status_code, headers = api_instance.get_cart_by_cart_id_with_http_info(cart_id, opts)
428
- p status_code # => 2xx
429
- p headers # => { ... }
430
- p data # => <CartResponse>
431
- rescue UltracartClient::ApiError => e
432
- puts "Error when calling CheckoutApi->get_cart_by_cart_id_with_http_info: #{e}"
433
- end
434
- ```
435
-
436
- ### Parameters
437
-
438
- | Name | Type | Description | Notes |
439
- | ---- | ---- | ----------- | ----- |
440
- | **cart_id** | **String** | Cart ID to retrieve | |
441
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
442
-
443
- ### Return type
444
-
445
- [**CartResponse**](CartResponse.md)
446
-
447
- ### Authorization
448
-
449
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
450
-
451
- ### HTTP request headers
452
-
453
- - **Content-Type**: Not defined
454
- - **Accept**: application/json
455
-
456
-
457
- ## get_cart_by_return_code
458
-
459
- > <CartResponse> get_cart_by_return_code(return_code, opts)
460
-
461
- Get cart (by return code)
462
-
463
- Get a cart specified by the return code parameter.
464
-
465
- ### Examples
466
-
467
- ```ruby
468
- require 'time'
469
- require 'ultracart_api'
470
- require 'json'
471
- require 'yaml'
472
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
473
-
474
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
475
- # As such, this might not be the best way to use this object.
476
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
477
-
478
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
479
- return_code = 'return_code_example' # String | Return code to lookup cart ID by
480
- opts = {
481
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
482
- }
483
-
484
- begin
485
- # Get cart (by return code)
486
- result = api_instance.get_cart_by_return_code(return_code, opts)
487
- p result
488
- rescue UltracartClient::ApiError => e
489
- puts "Error when calling CheckoutApi->get_cart_by_return_code: #{e}"
490
- end
491
- ```
492
-
493
- #### Using the get_cart_by_return_code_with_http_info variant
494
-
495
- This returns an Array which contains the response data, status code and headers.
496
-
497
- > <Array(<CartResponse>, Integer, Hash)> get_cart_by_return_code_with_http_info(return_code, opts)
498
-
499
- ```ruby
500
- begin
501
- # Get cart (by return code)
502
- data, status_code, headers = api_instance.get_cart_by_return_code_with_http_info(return_code, opts)
503
- p status_code # => 2xx
504
- p headers # => { ... }
505
- p data # => <CartResponse>
506
- rescue UltracartClient::ApiError => e
507
- puts "Error when calling CheckoutApi->get_cart_by_return_code_with_http_info: #{e}"
508
- end
509
- ```
510
-
511
- ### Parameters
512
-
513
- | Name | Type | Description | Notes |
514
- | ---- | ---- | ----------- | ----- |
515
- | **return_code** | **String** | Return code to lookup cart ID by | |
516
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
517
-
518
- ### Return type
519
-
520
- [**CartResponse**](CartResponse.md)
521
-
522
- ### Authorization
523
-
524
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
525
-
526
- ### HTTP request headers
527
-
528
- - **Content-Type**: Not defined
529
- - **Accept**: application/json
530
-
531
-
532
- ## get_cart_by_return_token
533
-
534
- > <CartResponse> get_cart_by_return_token(opts)
535
-
536
- Get cart (by return token)
537
-
538
- Get a cart specified by the encrypted return token parameter.
539
-
540
- ### Examples
541
-
542
- ```ruby
543
- require 'time'
544
- require 'ultracart_api'
545
- require 'json'
546
- require 'yaml'
547
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
548
-
549
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
550
- # As such, this might not be the best way to use this object.
551
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
552
-
553
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
554
- opts = {
555
- return_token: 'return_token_example', # String | Return token provided by StoreFront Communications
556
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
557
- }
558
-
559
- begin
560
- # Get cart (by return token)
561
- result = api_instance.get_cart_by_return_token(opts)
562
- p result
563
- rescue UltracartClient::ApiError => e
564
- puts "Error when calling CheckoutApi->get_cart_by_return_token: #{e}"
565
- end
566
- ```
567
-
568
- #### Using the get_cart_by_return_token_with_http_info variant
569
-
570
- This returns an Array which contains the response data, status code and headers.
571
-
572
- > <Array(<CartResponse>, Integer, Hash)> get_cart_by_return_token_with_http_info(opts)
573
-
574
- ```ruby
575
- begin
576
- # Get cart (by return token)
577
- data, status_code, headers = api_instance.get_cart_by_return_token_with_http_info(opts)
578
- p status_code # => 2xx
579
- p headers # => { ... }
580
- p data # => <CartResponse>
581
- rescue UltracartClient::ApiError => e
582
- puts "Error when calling CheckoutApi->get_cart_by_return_token_with_http_info: #{e}"
583
- end
584
- ```
585
-
586
- ### Parameters
587
-
588
- | Name | Type | Description | Notes |
589
- | ---- | ---- | ----------- | ----- |
590
- | **return_token** | **String** | Return token provided by StoreFront Communications | [optional] |
591
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
592
-
593
- ### Return type
594
-
595
- [**CartResponse**](CartResponse.md)
596
-
597
- ### Authorization
598
-
599
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
600
-
601
- ### HTTP request headers
602
-
603
- - **Content-Type**: Not defined
604
- - **Accept**: application/json
605
-
606
-
607
- ## get_state_provinces_for_country
608
-
609
- > <CheckoutStateProvinceResponse> get_state_provinces_for_country(country_code)
610
-
611
- Get state/province list for a country code
612
-
613
- Lookup a state/province list for a given country code
614
-
615
- ### Examples
616
-
617
- ```ruby
618
- require 'time'
619
- require 'ultracart_api'
620
- require 'json'
621
- require 'yaml'
622
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
623
-
624
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
625
- # As such, this might not be the best way to use this object.
626
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
627
-
628
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
629
- country_code = 'country_code_example' # String | Two letter ISO country code
630
-
631
- begin
632
- # Get state/province list for a country code
633
- result = api_instance.get_state_provinces_for_country(country_code)
634
- p result
635
- rescue UltracartClient::ApiError => e
636
- puts "Error when calling CheckoutApi->get_state_provinces_for_country: #{e}"
637
- end
638
- ```
639
-
640
- #### Using the get_state_provinces_for_country_with_http_info variant
641
-
642
- This returns an Array which contains the response data, status code and headers.
643
-
644
- > <Array(<CheckoutStateProvinceResponse>, Integer, Hash)> get_state_provinces_for_country_with_http_info(country_code)
645
-
646
- ```ruby
647
- begin
648
- # Get state/province list for a country code
649
- data, status_code, headers = api_instance.get_state_provinces_for_country_with_http_info(country_code)
650
- p status_code # => 2xx
651
- p headers # => { ... }
652
- p data # => <CheckoutStateProvinceResponse>
653
- rescue UltracartClient::ApiError => e
654
- puts "Error when calling CheckoutApi->get_state_provinces_for_country_with_http_info: #{e}"
655
- end
656
- ```
657
-
658
- ### Parameters
659
-
660
- | Name | Type | Description | Notes |
661
- | ---- | ---- | ----------- | ----- |
662
- | **country_code** | **String** | Two letter ISO country code | |
663
-
664
- ### Return type
665
-
666
- [**CheckoutStateProvinceResponse**](CheckoutStateProvinceResponse.md)
667
-
668
- ### Authorization
669
-
670
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
671
-
672
- ### HTTP request headers
673
-
674
- - **Content-Type**: Not defined
675
- - **Accept**: application/json
676
-
677
-
678
- ## handoff_cart
679
-
680
- > <CheckoutHandoffResponse> handoff_cart(handoff_request, opts)
681
-
682
- Handoff cart
683
-
684
- Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
685
-
686
- ### Examples
687
-
688
- ```ruby
689
- require 'time'
690
- require 'ultracart_api'
691
- require 'json'
692
- require 'yaml'
693
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
694
-
695
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
696
- # As such, this might not be the best way to use this object.
697
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
698
-
699
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
700
- handoff_request = UltracartClient::CheckoutHandoffRequest.new # CheckoutHandoffRequest | Handoff request
701
- opts = {
702
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
703
- }
704
-
705
- begin
706
- # Handoff cart
707
- result = api_instance.handoff_cart(handoff_request, opts)
708
- p result
709
- rescue UltracartClient::ApiError => e
710
- puts "Error when calling CheckoutApi->handoff_cart: #{e}"
711
- end
712
- ```
713
-
714
- #### Using the handoff_cart_with_http_info variant
715
-
716
- This returns an Array which contains the response data, status code and headers.
717
-
718
- > <Array(<CheckoutHandoffResponse>, Integer, Hash)> handoff_cart_with_http_info(handoff_request, opts)
719
-
720
- ```ruby
721
- begin
722
- # Handoff cart
723
- data, status_code, headers = api_instance.handoff_cart_with_http_info(handoff_request, opts)
724
- p status_code # => 2xx
725
- p headers # => { ... }
726
- p data # => <CheckoutHandoffResponse>
727
- rescue UltracartClient::ApiError => e
728
- puts "Error when calling CheckoutApi->handoff_cart_with_http_info: #{e}"
729
- end
730
- ```
731
-
732
- ### Parameters
733
-
734
- | Name | Type | Description | Notes |
735
- | ---- | ---- | ----------- | ----- |
736
- | **handoff_request** | [**CheckoutHandoffRequest**](CheckoutHandoffRequest.md) | Handoff request | |
737
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
738
-
739
- ### Return type
740
-
741
- [**CheckoutHandoffResponse**](CheckoutHandoffResponse.md)
742
-
743
- ### Authorization
744
-
745
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
746
-
747
- ### HTTP request headers
748
-
749
- - **Content-Type**: application/json
750
- - **Accept**: application/json
751
-
752
-
753
- ## login
754
-
755
- > <CartProfileLoginResponse> login(login_request, opts)
756
-
757
- Profile login
758
-
759
- Login in to the customer profile specified by cart.billing.email and password
760
-
761
- ### Examples
762
-
763
- ```ruby
764
- require 'time'
765
- require 'ultracart_api'
766
- require 'json'
767
- require 'yaml'
768
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
769
-
770
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
771
- # As such, this might not be the best way to use this object.
772
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
773
-
774
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
775
- login_request = UltracartClient::CartProfileLoginRequest.new # CartProfileLoginRequest | Login request
776
- opts = {
777
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
778
- }
779
-
780
- begin
781
- # Profile login
782
- result = api_instance.login(login_request, opts)
783
- p result
784
- rescue UltracartClient::ApiError => e
785
- puts "Error when calling CheckoutApi->login: #{e}"
786
- end
787
- ```
788
-
789
- #### Using the login_with_http_info variant
790
-
791
- This returns an Array which contains the response data, status code and headers.
792
-
793
- > <Array(<CartProfileLoginResponse>, Integer, Hash)> login_with_http_info(login_request, opts)
794
-
795
- ```ruby
796
- begin
797
- # Profile login
798
- data, status_code, headers = api_instance.login_with_http_info(login_request, opts)
799
- p status_code # => 2xx
800
- p headers # => { ... }
801
- p data # => <CartProfileLoginResponse>
802
- rescue UltracartClient::ApiError => e
803
- puts "Error when calling CheckoutApi->login_with_http_info: #{e}"
804
- end
805
- ```
806
-
807
- ### Parameters
808
-
809
- | Name | Type | Description | Notes |
810
- | ---- | ---- | ----------- | ----- |
811
- | **login_request** | [**CartProfileLoginRequest**](CartProfileLoginRequest.md) | Login request | |
812
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
813
-
814
- ### Return type
815
-
816
- [**CartProfileLoginResponse**](CartProfileLoginResponse.md)
817
-
818
- ### Authorization
819
-
820
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
821
-
822
- ### HTTP request headers
823
-
824
- - **Content-Type**: application/json
825
- - **Accept**: application/json
826
-
827
-
828
- ## logout
829
-
830
- > <CartResponse> logout(cart, opts)
831
-
832
- Profile logout
833
-
834
- Log the cart out of the current profile. No error will occur if they are not logged in.
835
-
836
- ### Examples
837
-
838
- ```ruby
839
- require 'time'
840
- require 'ultracart_api'
841
- require 'json'
842
- require 'yaml'
843
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
844
-
845
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
846
- # As such, this might not be the best way to use this object.
847
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
848
-
849
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
850
- cart = UltracartClient::Cart.new # Cart | Cart
851
- opts = {
852
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
853
- }
854
-
855
- begin
856
- # Profile logout
857
- result = api_instance.logout(cart, opts)
858
- p result
859
- rescue UltracartClient::ApiError => e
860
- puts "Error when calling CheckoutApi->logout: #{e}"
861
- end
862
- ```
863
-
864
- #### Using the logout_with_http_info variant
865
-
866
- This returns an Array which contains the response data, status code and headers.
867
-
868
- > <Array(<CartResponse>, Integer, Hash)> logout_with_http_info(cart, opts)
869
-
870
- ```ruby
871
- begin
872
- # Profile logout
873
- data, status_code, headers = api_instance.logout_with_http_info(cart, opts)
874
- p status_code # => 2xx
875
- p headers # => { ... }
876
- p data # => <CartResponse>
877
- rescue UltracartClient::ApiError => e
878
- puts "Error when calling CheckoutApi->logout_with_http_info: #{e}"
879
- end
880
- ```
881
-
882
- ### Parameters
883
-
884
- | Name | Type | Description | Notes |
885
- | ---- | ---- | ----------- | ----- |
886
- | **cart** | [**Cart**](Cart.md) | Cart | |
887
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
888
-
889
- ### Return type
890
-
891
- [**CartResponse**](CartResponse.md)
892
-
893
- ### Authorization
894
-
895
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
896
-
897
- ### HTTP request headers
898
-
899
- - **Content-Type**: application/json
900
- - **Accept**: application/json
901
-
902
-
903
- ## register
904
-
905
- > <CartProfileRegisterResponse> register(register_request, opts)
906
-
907
- Profile registration
908
-
909
- Register a new customer profile. Requires the cart.billing object to be populated along with the password.
910
-
911
- ### Examples
912
-
913
- ```ruby
914
- require 'time'
915
- require 'ultracart_api'
916
- require 'json'
917
- require 'yaml'
918
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
919
-
920
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
921
- # As such, this might not be the best way to use this object.
922
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
923
-
924
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
925
- register_request = UltracartClient::CartProfileRegisterRequest.new # CartProfileRegisterRequest | Register request
926
- opts = {
927
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
928
- }
929
-
930
- begin
931
- # Profile registration
932
- result = api_instance.register(register_request, opts)
933
- p result
934
- rescue UltracartClient::ApiError => e
935
- puts "Error when calling CheckoutApi->register: #{e}"
936
- end
937
- ```
938
-
939
- #### Using the register_with_http_info variant
940
-
941
- This returns an Array which contains the response data, status code and headers.
942
-
943
- > <Array(<CartProfileRegisterResponse>, Integer, Hash)> register_with_http_info(register_request, opts)
944
-
945
- ```ruby
946
- begin
947
- # Profile registration
948
- data, status_code, headers = api_instance.register_with_http_info(register_request, opts)
949
- p status_code # => 2xx
950
- p headers # => { ... }
951
- p data # => <CartProfileRegisterResponse>
952
- rescue UltracartClient::ApiError => e
953
- puts "Error when calling CheckoutApi->register_with_http_info: #{e}"
954
- end
955
- ```
956
-
957
- ### Parameters
958
-
959
- | Name | Type | Description | Notes |
960
- | ---- | ---- | ----------- | ----- |
961
- | **register_request** | [**CartProfileRegisterRequest**](CartProfileRegisterRequest.md) | Register request | |
962
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
963
-
964
- ### Return type
965
-
966
- [**CartProfileRegisterResponse**](CartProfileRegisterResponse.md)
967
-
968
- ### Authorization
969
-
970
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
971
-
972
- ### HTTP request headers
973
-
974
- - **Content-Type**: application/json
975
- - **Accept**: application/json
976
-
977
-
978
- ## register_affiliate_click
979
-
980
- > <RegisterAffiliateClickResponse> register_affiliate_click(register_affiliate_click_request, opts)
981
-
982
- Register affiliate click
983
-
984
- Register an affiliate click. Used by custom checkouts that are completely API based and do not perform checkout handoff.
985
-
986
- ### Examples
987
-
988
- ```ruby
989
- require 'time'
990
- require 'ultracart_api'
991
- require 'json'
992
- require 'yaml'
993
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
994
-
995
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
996
- # As such, this might not be the best way to use this object.
997
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
998
-
999
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1000
- register_affiliate_click_request = UltracartClient::RegisterAffiliateClickRequest.new # RegisterAffiliateClickRequest | Register affiliate click request
1001
- opts = {
1002
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
1003
- }
1004
-
1005
- begin
1006
- # Register affiliate click
1007
- result = api_instance.register_affiliate_click(register_affiliate_click_request, opts)
1008
- p result
1009
- rescue UltracartClient::ApiError => e
1010
- puts "Error when calling CheckoutApi->register_affiliate_click: #{e}"
1011
- end
1012
- ```
1013
-
1014
- #### Using the register_affiliate_click_with_http_info variant
1015
-
1016
- This returns an Array which contains the response data, status code and headers.
1017
-
1018
- > <Array(<RegisterAffiliateClickResponse>, Integer, Hash)> register_affiliate_click_with_http_info(register_affiliate_click_request, opts)
1019
-
1020
- ```ruby
1021
- begin
1022
- # Register affiliate click
1023
- data, status_code, headers = api_instance.register_affiliate_click_with_http_info(register_affiliate_click_request, opts)
1024
- p status_code # => 2xx
1025
- p headers # => { ... }
1026
- p data # => <RegisterAffiliateClickResponse>
1027
- rescue UltracartClient::ApiError => e
1028
- puts "Error when calling CheckoutApi->register_affiliate_click_with_http_info: #{e}"
1029
- end
1030
- ```
1031
-
1032
- ### Parameters
1033
-
1034
- | Name | Type | Description | Notes |
1035
- | ---- | ---- | ----------- | ----- |
1036
- | **register_affiliate_click_request** | [**RegisterAffiliateClickRequest**](RegisterAffiliateClickRequest.md) | Register affiliate click request | |
1037
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1038
-
1039
- ### Return type
1040
-
1041
- [**RegisterAffiliateClickResponse**](RegisterAffiliateClickResponse.md)
1042
-
1043
- ### Authorization
1044
-
1045
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1046
-
1047
- ### HTTP request headers
1048
-
1049
- - **Content-Type**: application/json
1050
- - **Accept**: application/json
1051
-
1052
-
1053
- ## related_items_for_cart
1054
-
1055
- > <ItemsResponse> related_items_for_cart(cart, opts)
1056
-
1057
- Related items
1058
-
1059
- Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
1060
-
1061
- ### Examples
1062
-
1063
- ```ruby
1064
- require 'time'
1065
- require 'ultracart_api'
1066
- require 'json'
1067
- require 'yaml'
1068
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1069
-
1070
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1071
- # As such, this might not be the best way to use this object.
1072
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1073
-
1074
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1075
- cart = UltracartClient::Cart.new # Cart | Cart
1076
- opts = {
1077
- _expand: '_expand_example' # String | The object expansion to perform on the result. See item resource documentation for examples
1078
- }
1079
-
1080
- begin
1081
- # Related items
1082
- result = api_instance.related_items_for_cart(cart, opts)
1083
- p result
1084
- rescue UltracartClient::ApiError => e
1085
- puts "Error when calling CheckoutApi->related_items_for_cart: #{e}"
1086
- end
1087
- ```
1088
-
1089
- #### Using the related_items_for_cart_with_http_info variant
1090
-
1091
- This returns an Array which contains the response data, status code and headers.
1092
-
1093
- > <Array(<ItemsResponse>, Integer, Hash)> related_items_for_cart_with_http_info(cart, opts)
1094
-
1095
- ```ruby
1096
- begin
1097
- # Related items
1098
- data, status_code, headers = api_instance.related_items_for_cart_with_http_info(cart, opts)
1099
- p status_code # => 2xx
1100
- p headers # => { ... }
1101
- p data # => <ItemsResponse>
1102
- rescue UltracartClient::ApiError => e
1103
- puts "Error when calling CheckoutApi->related_items_for_cart_with_http_info: #{e}"
1104
- end
1105
- ```
1106
-
1107
- ### Parameters
1108
-
1109
- | Name | Type | Description | Notes |
1110
- | ---- | ---- | ----------- | ----- |
1111
- | **cart** | [**Cart**](Cart.md) | Cart | |
1112
- | **_expand** | **String** | The object expansion to perform on the result. See item resource documentation for examples | [optional] |
1113
-
1114
- ### Return type
1115
-
1116
- [**ItemsResponse**](ItemsResponse.md)
1117
-
1118
- ### Authorization
1119
-
1120
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1121
-
1122
- ### HTTP request headers
1123
-
1124
- - **Content-Type**: application/json
1125
- - **Accept**: application/json
1126
-
1127
-
1128
- ## related_items_for_item
1129
-
1130
- > <ItemsResponse> related_items_for_item(item_id, cart, opts)
1131
-
1132
- Related items (specific item)
1133
-
1134
- Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
1135
-
1136
- ### Examples
1137
-
1138
- ```ruby
1139
- require 'time'
1140
- require 'ultracart_api'
1141
- require 'json'
1142
- require 'yaml'
1143
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1144
-
1145
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1146
- # As such, this might not be the best way to use this object.
1147
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1148
-
1149
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1150
- item_id = 'item_id_example' # String | Item ID to retrieve related items for
1151
- cart = UltracartClient::Cart.new # Cart | Cart
1152
- opts = {
1153
- _expand: '_expand_example' # String | The object expansion to perform on the result. See item resource documentation for examples
1154
- }
1155
-
1156
- begin
1157
- # Related items (specific item)
1158
- result = api_instance.related_items_for_item(item_id, cart, opts)
1159
- p result
1160
- rescue UltracartClient::ApiError => e
1161
- puts "Error when calling CheckoutApi->related_items_for_item: #{e}"
1162
- end
1163
- ```
1164
-
1165
- #### Using the related_items_for_item_with_http_info variant
1166
-
1167
- This returns an Array which contains the response data, status code and headers.
1168
-
1169
- > <Array(<ItemsResponse>, Integer, Hash)> related_items_for_item_with_http_info(item_id, cart, opts)
1170
-
1171
- ```ruby
1172
- begin
1173
- # Related items (specific item)
1174
- data, status_code, headers = api_instance.related_items_for_item_with_http_info(item_id, cart, opts)
1175
- p status_code # => 2xx
1176
- p headers # => { ... }
1177
- p data # => <ItemsResponse>
1178
- rescue UltracartClient::ApiError => e
1179
- puts "Error when calling CheckoutApi->related_items_for_item_with_http_info: #{e}"
1180
- end
1181
- ```
1182
-
1183
- ### Parameters
1184
-
1185
- | Name | Type | Description | Notes |
1186
- | ---- | ---- | ----------- | ----- |
1187
- | **item_id** | **String** | Item ID to retrieve related items for | |
1188
- | **cart** | [**Cart**](Cart.md) | Cart | |
1189
- | **_expand** | **String** | The object expansion to perform on the result. See item resource documentation for examples | [optional] |
1190
-
1191
- ### Return type
1192
-
1193
- [**ItemsResponse**](ItemsResponse.md)
1194
-
1195
- ### Authorization
1196
-
1197
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1198
-
1199
- ### HTTP request headers
1200
-
1201
- - **Content-Type**: application/json
1202
- - **Accept**: application/json
1203
-
1204
-
1205
- ## setup_browser_key
1206
-
1207
- > <CheckoutSetupBrowserKeyResponse> setup_browser_key(browser_key_request)
1208
-
1209
- Setup Browser Application
1210
-
1211
- Setup a browser key authenticated application with checkout permissions. This REST call must be made with an authentication scheme that is not browser key. The new application will be linked to the application that makes this call. If this application is disabled / deleted, then so will the application setup by this call. The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
1212
-
1213
- ### Examples
1214
-
1215
- ```ruby
1216
- require 'time'
1217
- require 'ultracart_api'
1218
- require 'json'
1219
- require 'yaml'
1220
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1221
-
1222
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1223
- # As such, this might not be the best way to use this object.
1224
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1225
-
1226
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1227
- browser_key_request = UltracartClient::CheckoutSetupBrowserKeyRequest.new # CheckoutSetupBrowserKeyRequest | Setup browser key request
1228
-
1229
- begin
1230
- # Setup Browser Application
1231
- result = api_instance.setup_browser_key(browser_key_request)
1232
- p result
1233
- rescue UltracartClient::ApiError => e
1234
- puts "Error when calling CheckoutApi->setup_browser_key: #{e}"
1235
- end
1236
- ```
1237
-
1238
- #### Using the setup_browser_key_with_http_info variant
1239
-
1240
- This returns an Array which contains the response data, status code and headers.
1241
-
1242
- > <Array(<CheckoutSetupBrowserKeyResponse>, Integer, Hash)> setup_browser_key_with_http_info(browser_key_request)
1243
-
1244
- ```ruby
1245
- begin
1246
- # Setup Browser Application
1247
- data, status_code, headers = api_instance.setup_browser_key_with_http_info(browser_key_request)
1248
- p status_code # => 2xx
1249
- p headers # => { ... }
1250
- p data # => <CheckoutSetupBrowserKeyResponse>
1251
- rescue UltracartClient::ApiError => e
1252
- puts "Error when calling CheckoutApi->setup_browser_key_with_http_info: #{e}"
1253
- end
1254
- ```
1255
-
1256
- ### Parameters
1257
-
1258
- | Name | Type | Description | Notes |
1259
- | ---- | ---- | ----------- | ----- |
1260
- | **browser_key_request** | [**CheckoutSetupBrowserKeyRequest**](CheckoutSetupBrowserKeyRequest.md) | Setup browser key request | |
1261
-
1262
- ### Return type
1263
-
1264
- [**CheckoutSetupBrowserKeyResponse**](CheckoutSetupBrowserKeyResponse.md)
1265
-
1266
- ### Authorization
1267
-
1268
- [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1269
-
1270
- ### HTTP request headers
1271
-
1272
- - **Content-Type**: application/json
1273
- - **Accept**: application/json
1274
-
1275
-
1276
- ## update_cart
1277
-
1278
- > <CartResponse> update_cart(cart, opts)
1279
-
1280
- Update cart
1281
-
1282
- Update the cart.
1283
-
1284
- ### Examples
1285
-
1286
- ```ruby
1287
- require 'time'
1288
- require 'ultracart_api'
1289
- require 'json'
1290
- require 'yaml'
1291
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1292
-
1293
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1294
- # As such, this might not be the best way to use this object.
1295
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1296
-
1297
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1298
- cart = UltracartClient::Cart.new # Cart | Cart
1299
- opts = {
1300
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
1301
- }
1302
-
1303
- begin
1304
- # Update cart
1305
- result = api_instance.update_cart(cart, opts)
1306
- p result
1307
- rescue UltracartClient::ApiError => e
1308
- puts "Error when calling CheckoutApi->update_cart: #{e}"
1309
- end
1310
- ```
1311
-
1312
- #### Using the update_cart_with_http_info variant
1313
-
1314
- This returns an Array which contains the response data, status code and headers.
1315
-
1316
- > <Array(<CartResponse>, Integer, Hash)> update_cart_with_http_info(cart, opts)
1317
-
1318
- ```ruby
1319
- begin
1320
- # Update cart
1321
- data, status_code, headers = api_instance.update_cart_with_http_info(cart, opts)
1322
- p status_code # => 2xx
1323
- p headers # => { ... }
1324
- p data # => <CartResponse>
1325
- rescue UltracartClient::ApiError => e
1326
- puts "Error when calling CheckoutApi->update_cart_with_http_info: #{e}"
1327
- end
1328
- ```
1329
-
1330
- ### Parameters
1331
-
1332
- | Name | Type | Description | Notes |
1333
- | ---- | ---- | ----------- | ----- |
1334
- | **cart** | [**Cart**](Cart.md) | Cart | |
1335
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1336
-
1337
- ### Return type
1338
-
1339
- [**CartResponse**](CartResponse.md)
1340
-
1341
- ### Authorization
1342
-
1343
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1344
-
1345
- ### HTTP request headers
1346
-
1347
- - **Content-Type**: application/json
1348
- - **Accept**: application/json
1349
-
1350
-
1351
- ## validate_cart
1352
-
1353
- > <CartValidationResponse> validate_cart(validation_request, opts)
1354
-
1355
- Validate
1356
-
1357
- Validate the cart for errors. Specific checks can be passed and multiple validations can occur throughout your checkout flow.
1358
-
1359
- ### Examples
1360
-
1361
- ```ruby
1362
- require 'time'
1363
- require 'ultracart_api'
1364
- require 'json'
1365
- require 'yaml'
1366
- require_relative '../constants' # https://github.com/UltraCart/sdk_samples/blob/master/ruby/constants.rb
1367
-
1368
- # This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
1369
- # As such, this might not be the best way to use this object.
1370
- # Please see https://github.com/UltraCart/sdk_samples for working examples.
1371
-
1372
- api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
1373
- validation_request = UltracartClient::CartValidationRequest.new # CartValidationRequest | Validation request
1374
- opts = {
1375
- _expand: '_expand_example' # String | The object expansion to perform on the result. See documentation for examples
1376
- }
1377
-
1378
- begin
1379
- # Validate
1380
- result = api_instance.validate_cart(validation_request, opts)
1381
- p result
1382
- rescue UltracartClient::ApiError => e
1383
- puts "Error when calling CheckoutApi->validate_cart: #{e}"
1384
- end
1385
- ```
1386
-
1387
- #### Using the validate_cart_with_http_info variant
1388
-
1389
- This returns an Array which contains the response data, status code and headers.
1390
-
1391
- > <Array(<CartValidationResponse>, Integer, Hash)> validate_cart_with_http_info(validation_request, opts)
1392
-
1393
- ```ruby
1394
- begin
1395
- # Validate
1396
- data, status_code, headers = api_instance.validate_cart_with_http_info(validation_request, opts)
1397
- p status_code # => 2xx
1398
- p headers # => { ... }
1399
- p data # => <CartValidationResponse>
1400
- rescue UltracartClient::ApiError => e
1401
- puts "Error when calling CheckoutApi->validate_cart_with_http_info: #{e}"
1402
- end
1403
- ```
1404
-
1405
- ### Parameters
1406
-
1407
- | Name | Type | Description | Notes |
1408
- | ---- | ---- | ----------- | ----- |
1409
- | **validation_request** | [**CartValidationRequest**](CartValidationRequest.md) | Validation request | |
1410
- | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1411
-
1412
- ### Return type
1413
-
1414
- [**CartValidationResponse**](CartValidationResponse.md)
1415
-
1416
- ### Authorization
1417
-
1418
- [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1419
-
1420
- ### HTTP request headers
1421
-
1422
- - **Content-Type**: application/json
1423
- - **Accept**: application/json
1424
-
1
+ # UltracartClient::CheckoutApi
2
+
3
+ All URIs are relative to *https://secure.ultracart.com/rest/v2*
4
+
5
+ | Method | HTTP request | Description |
6
+ | ------ | ------------ | ----------- |
7
+ | [**city_state**](CheckoutApi.md#city_state) | **POST** /checkout/city_state | City/State for Zip |
8
+ | [**finalize_order**](CheckoutApi.md#finalize_order) | **POST** /checkout/cart/finalizeOrder | Finalize Order |
9
+ | [**get_affirm_checkout**](CheckoutApi.md#get_affirm_checkout) | **GET** /checkout/cart/{cart_id}/affirmCheckout | Get affirm checkout (by cart id) |
10
+ | [**get_allowed_countries**](CheckoutApi.md#get_allowed_countries) | **POST** /checkout/allowedCountries | Allowed countries |
11
+ | [**get_cart**](CheckoutApi.md#get_cart) | **GET** /checkout/cart | Get cart |
12
+ | [**get_cart_by_cart_id**](CheckoutApi.md#get_cart_by_cart_id) | **GET** /checkout/cart/{cart_id} | Get cart (by cart id) |
13
+ | [**get_cart_by_return_code**](CheckoutApi.md#get_cart_by_return_code) | **GET** /checkout/return/{return_code} | Get cart (by return code) |
14
+ | [**get_cart_by_return_token**](CheckoutApi.md#get_cart_by_return_token) | **GET** /checkout/return_token | Get cart (by return token) |
15
+ | [**get_state_provinces_for_country**](CheckoutApi.md#get_state_provinces_for_country) | **POST** /checkout/stateProvincesForCountry/{country_code} | Get state/province list for a country code |
16
+ | [**handoff_cart**](CheckoutApi.md#handoff_cart) | **POST** /checkout/cart/handoff | Handoff cart |
17
+ | [**login**](CheckoutApi.md#login) | **POST** /checkout/cart/profile/login | Profile login |
18
+ | [**logout**](CheckoutApi.md#logout) | **POST** /checkout/cart/profile/logout | Profile logout |
19
+ | [**register**](CheckoutApi.md#register) | **POST** /checkout/cart/profile/register | Profile registration |
20
+ | [**register_affiliate_click**](CheckoutApi.md#register_affiliate_click) | **POST** /checkout/affiliateClick/register | Register affiliate click |
21
+ | [**related_items_for_cart**](CheckoutApi.md#related_items_for_cart) | **POST** /checkout/related_items | Related items |
22
+ | [**related_items_for_item**](CheckoutApi.md#related_items_for_item) | **POST** /checkout/relatedItems/{item_id} | Related items (specific item) |
23
+ | [**setup_browser_key**](CheckoutApi.md#setup_browser_key) | **PUT** /checkout/browser_key | Setup Browser Application |
24
+ | [**update_cart**](CheckoutApi.md#update_cart) | **PUT** /checkout/cart | Update cart |
25
+ | [**validate_cart**](CheckoutApi.md#validate_cart) | **POST** /checkout/cart/validate | Validate |
26
+
27
+
28
+ ## city_state
29
+
30
+ > <CityStateZip> city_state(cart)
31
+
32
+ City/State for Zip
33
+
34
+ Look up the city and state for the shipping zip code. Useful for building an auto complete for parts of the shipping address
35
+
36
+
37
+ ### Examples
38
+
39
+ ```ruby
40
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
41
+ # Takes a postal code and returns back a city and state (US Only)
42
+
43
+ require 'ultracart_api'
44
+ require_relative '../constants'
45
+
46
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
47
+
48
+ cart_id = '123456789123456789123456789123456789' # you should have the cart id from session or cookie
49
+ cart = UltracartClient::Cart.new
50
+ cart.cart_id = cart_id # required
51
+ cart.shipping = UltracartClient::CartShipping.new
52
+ cart.shipping.postal_code = '44233'
53
+
54
+ api_response = checkout_api.city_state(cart)
55
+ puts "City: #{api_response.city}"
56
+ puts "State: #{api_response.state}"
57
+ ```
58
+
59
+
60
+ #### Using the city_state_with_http_info variant
61
+
62
+ This returns an Array which contains the response data, status code and headers.
63
+
64
+ > <Array(<CityStateZip>, Integer, Hash)> city_state_with_http_info(cart)
65
+
66
+ ```ruby
67
+ begin
68
+ # City/State for Zip
69
+ data, status_code, headers = api_instance.city_state_with_http_info(cart)
70
+ p status_code # => 2xx
71
+ p headers # => { ... }
72
+ p data # => <CityStateZip>
73
+ rescue UltracartClient::ApiError => e
74
+ puts "Error when calling CheckoutApi->city_state_with_http_info: #{e}"
75
+ end
76
+ ```
77
+
78
+ ### Parameters
79
+
80
+ | Name | Type | Description | Notes |
81
+ | ---- | ---- | ----------- | ----- |
82
+ | **cart** | [**Cart**](Cart.md) | Cart | |
83
+
84
+ ### Return type
85
+
86
+ [**CityStateZip**](CityStateZip.md)
87
+
88
+ ### Authorization
89
+
90
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
91
+
92
+ ### HTTP request headers
93
+
94
+ - **Content-Type**: application/json
95
+ - **Accept**: application/json
96
+
97
+
98
+ ## finalize_order
99
+
100
+ > <CartFinalizeOrderResponse> finalize_order(finalize_request)
101
+
102
+ Finalize Order
103
+
104
+ Finalize the cart into an order. This method can not be called with browser key authentication. It is ONLY meant for server side code to call.
105
+
106
+
107
+ ### Examples
108
+
109
+ ```ruby
110
+ require 'ultracart_api'
111
+ require_relative '../constants'
112
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
113
+
114
+ # Note: You probably should NOT be using this method. Use handoff_cart() instead.
115
+ # This method is a server-side only (no browser key allowed) method for turning a cart into an order.
116
+ # It exists for merchants who wish to provide their own upsells, but again, a warning, using this method
117
+ # will exclude the customer checkout from a vast and powerful suite of functionality provided free by UltraCart.
118
+ # Still, some merchants need this functionality, so here it is. If you're unsure, you don't need it. Use handoff.
119
+
120
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
121
+
122
+ expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
123
+ # Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
124
+ # affiliate checkout customer_profile
125
+ # billing coupons gift
126
+ # gift_certificate items.attributes items.multimedia
127
+ # items items.multimedia.thumbnails items.physical
128
+ # marketing payment settings.gift
129
+ # settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
130
+ # settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
131
+ # settings.terms shipping taxes
132
+ # summary upsell_after
133
+
134
+ cart_id = nil
135
+ cart_id = cookies[Constants::CART_ID_COOKIE_NAME] if cookies[Constants::CART_ID_COOKIE_NAME]
136
+
137
+ cart = nil
138
+ if cart_id.nil?
139
+ api_response = checkout_api.get_cart(_expand: expansion)
140
+ else
141
+ api_response = checkout_api.get_cart_by_cart_id(cart_id, _expand: expansion)
142
+ end
143
+ cart = api_response.cart
144
+
145
+ # TODO - add some items, collect billing and shipping, use hosted fields to collect payment, etc.
146
+
147
+ finalize_request = UltracartClient::CartFinalizeOrderRequest.new
148
+ finalize_request.cart = cart
149
+ finalize_options = UltracartClient::CartFinalizeOrderRequestOptions.new # Lots of options here. Contact support if you're unsure what you need.
150
+ finalize_request.options = finalize_options
151
+
152
+ api_response = checkout_api.finalize_order(finalize_request)
153
+ # api_response.successful
154
+ # api_response.errors
155
+ # api_response.order_id
156
+ # api_response.order
157
+
158
+ puts api_response.inspect
159
+ ```
160
+
161
+
162
+ #### Using the finalize_order_with_http_info variant
163
+
164
+ This returns an Array which contains the response data, status code and headers.
165
+
166
+ > <Array(<CartFinalizeOrderResponse>, Integer, Hash)> finalize_order_with_http_info(finalize_request)
167
+
168
+ ```ruby
169
+ begin
170
+ # Finalize Order
171
+ data, status_code, headers = api_instance.finalize_order_with_http_info(finalize_request)
172
+ p status_code # => 2xx
173
+ p headers # => { ... }
174
+ p data # => <CartFinalizeOrderResponse>
175
+ rescue UltracartClient::ApiError => e
176
+ puts "Error when calling CheckoutApi->finalize_order_with_http_info: #{e}"
177
+ end
178
+ ```
179
+
180
+ ### Parameters
181
+
182
+ | Name | Type | Description | Notes |
183
+ | ---- | ---- | ----------- | ----- |
184
+ | **finalize_request** | [**CartFinalizeOrderRequest**](CartFinalizeOrderRequest.md) | Finalize request | |
185
+
186
+ ### Return type
187
+
188
+ [**CartFinalizeOrderResponse**](CartFinalizeOrderResponse.md)
189
+
190
+ ### Authorization
191
+
192
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
193
+
194
+ ### HTTP request headers
195
+
196
+ - **Content-Type**: application/json
197
+ - **Accept**: application/json
198
+
199
+
200
+ ## get_affirm_checkout
201
+
202
+ > <CartAffirmCheckoutResponse> get_affirm_checkout(cart_id)
203
+
204
+ Get affirm checkout (by cart id)
205
+
206
+ Get a Affirm checkout object for the specified cart_id parameter.
207
+
208
+
209
+ ### Examples
210
+
211
+ ```ruby
212
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
213
+ # For a given cart id (the cart should be fully updated in UltraCart), returns back the json object
214
+ # needed to proceed with an Affirm checkout. See https://www.affirm.com/ for details about Affirm.
215
+ # This sample does not show the construction of the affirm checkout widgets. See the affirm api for those examples.
216
+
217
+ require 'ultracart_api'
218
+ require_relative '../constants'
219
+
220
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
221
+ cart_id = '123456789123456789123456789123456789' # this should be retrieved from a session or cookie
222
+ api_response = checkout_api.get_affirm_checkout(cart_id)
223
+ if !api_response.errors.nil? && api_response.errors.length > 0
224
+ # TODO: display errors to customer about the failure
225
+ api_response.errors.each do |error|
226
+ puts error.inspect
227
+ end
228
+ else
229
+ puts api_response.checkout_json.inspect # this is the object to send to Affirm.
230
+ end
231
+ ```
232
+
233
+
234
+ #### Using the get_affirm_checkout_with_http_info variant
235
+
236
+ This returns an Array which contains the response data, status code and headers.
237
+
238
+ > <Array(<CartAffirmCheckoutResponse>, Integer, Hash)> get_affirm_checkout_with_http_info(cart_id)
239
+
240
+ ```ruby
241
+ begin
242
+ # Get affirm checkout (by cart id)
243
+ data, status_code, headers = api_instance.get_affirm_checkout_with_http_info(cart_id)
244
+ p status_code # => 2xx
245
+ p headers # => { ... }
246
+ p data # => <CartAffirmCheckoutResponse>
247
+ rescue UltracartClient::ApiError => e
248
+ puts "Error when calling CheckoutApi->get_affirm_checkout_with_http_info: #{e}"
249
+ end
250
+ ```
251
+
252
+ ### Parameters
253
+
254
+ | Name | Type | Description | Notes |
255
+ | ---- | ---- | ----------- | ----- |
256
+ | **cart_id** | **String** | Cart ID to retrieve | |
257
+
258
+ ### Return type
259
+
260
+ [**CartAffirmCheckoutResponse**](CartAffirmCheckoutResponse.md)
261
+
262
+ ### Authorization
263
+
264
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
265
+
266
+ ### HTTP request headers
267
+
268
+ - **Content-Type**: Not defined
269
+ - **Accept**: application/json
270
+
271
+
272
+ ## get_allowed_countries
273
+
274
+ > <CheckoutAllowedCountriesResponse> get_allowed_countries
275
+
276
+ Allowed countries
277
+
278
+ Lookup the allowed countries for this merchant id
279
+
280
+
281
+ ### Examples
282
+
283
+ ```ruby
284
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
285
+ # A simple method for populating the country list boxes with all the countries this merchant has configured to accept.
286
+
287
+ require 'ultracart_api'
288
+ require_relative '../constants'
289
+
290
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
291
+
292
+ api_response = checkout_api.get_allowed_countries
293
+ allowed_countries = api_response.countries
294
+
295
+ allowed_countries.each do |country|
296
+ puts country.inspect # contains both iso2code and name
297
+ end
298
+ ```
299
+
300
+
301
+ #### Using the get_allowed_countries_with_http_info variant
302
+
303
+ This returns an Array which contains the response data, status code and headers.
304
+
305
+ > <Array(<CheckoutAllowedCountriesResponse>, Integer, Hash)> get_allowed_countries_with_http_info
306
+
307
+ ```ruby
308
+ begin
309
+ # Allowed countries
310
+ data, status_code, headers = api_instance.get_allowed_countries_with_http_info
311
+ p status_code # => 2xx
312
+ p headers # => { ... }
313
+ p data # => <CheckoutAllowedCountriesResponse>
314
+ rescue UltracartClient::ApiError => e
315
+ puts "Error when calling CheckoutApi->get_allowed_countries_with_http_info: #{e}"
316
+ end
317
+ ```
318
+
319
+ ### Parameters
320
+
321
+ This endpoint does not need any parameter.
322
+
323
+ ### Return type
324
+
325
+ [**CheckoutAllowedCountriesResponse**](CheckoutAllowedCountriesResponse.md)
326
+
327
+ ### Authorization
328
+
329
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
330
+
331
+ ### HTTP request headers
332
+
333
+ - **Content-Type**: Not defined
334
+ - **Accept**: application/json
335
+
336
+
337
+ ## get_cart
338
+
339
+ > <CartResponse> get_cart(opts)
340
+
341
+ Get cart
342
+
343
+ If the cookie is set on the browser making the request then it will return their active cart. Otherwise it will create a new cart.
344
+
345
+
346
+ ### Examples
347
+
348
+ ```ruby
349
+ # frozen_string_literal: true
350
+
351
+ require 'json'
352
+ require 'yaml'
353
+ require 'ultracart_api'
354
+ require_relative '../constants'
355
+
356
+ api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
357
+
358
+ # this example is the same for both get_cart.rb and get_cart_by_id.rb. They work as a pair and are called
359
+ # depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
360
+ # carts, getCartByCartId(cart_id) is used.
361
+
362
+ expansion = 'items' # for this example, we're just getting a cart to insert some items into it.
363
+
364
+ # do you have the cart id from a cookie or some other server side state engine?
365
+ cart_id = nil
366
+ # run this example once to get a cart id, then you can add it here to test.
367
+ # the cart id below will not work for you.
368
+ # cart_id = 'C6A8693A3C78C6017FDA7A50EE380100'
369
+
370
+ api_response = if cart_id.nil?
371
+ api.get_cart({ '_expand': expansion })
372
+ else
373
+ api.get_cart_by_cart_id(cart_id, { '_expand': expansion })
374
+ end
375
+
376
+ cart = api_response.cart
377
+
378
+ puts cart.to_yaml
379
+ ```
380
+
381
+
382
+ #### Using the get_cart_with_http_info variant
383
+
384
+ This returns an Array which contains the response data, status code and headers.
385
+
386
+ > <Array(<CartResponse>, Integer, Hash)> get_cart_with_http_info(opts)
387
+
388
+ ```ruby
389
+ begin
390
+ # Get cart
391
+ data, status_code, headers = api_instance.get_cart_with_http_info(opts)
392
+ p status_code # => 2xx
393
+ p headers # => { ... }
394
+ p data # => <CartResponse>
395
+ rescue UltracartClient::ApiError => e
396
+ puts "Error when calling CheckoutApi->get_cart_with_http_info: #{e}"
397
+ end
398
+ ```
399
+
400
+ ### Parameters
401
+
402
+ | Name | Type | Description | Notes |
403
+ | ---- | ---- | ----------- | ----- |
404
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
405
+
406
+ ### Return type
407
+
408
+ [**CartResponse**](CartResponse.md)
409
+
410
+ ### Authorization
411
+
412
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
413
+
414
+ ### HTTP request headers
415
+
416
+ - **Content-Type**: Not defined
417
+ - **Accept**: application/json
418
+
419
+
420
+ ## get_cart_by_cart_id
421
+
422
+ > <CartResponse> get_cart_by_cart_id(cart_id, opts)
423
+
424
+ Get cart (by cart id)
425
+
426
+ Get a cart specified by the cart_id parameter.
427
+
428
+
429
+ ### Examples
430
+
431
+ ```ruby
432
+ # frozen_string_literal: true
433
+
434
+ require 'json'
435
+ require 'yaml'
436
+ require 'ultracart_api'
437
+ require_relative '../constants'
438
+
439
+ api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY, Constants::VERIFY_SSL, Constants::DEBUG_MODE)
440
+
441
+ # this example is the same for both get_cart.rb and get_cart_by_id.rb. They work as a pair and are called
442
+ # depending on the presence of an existing cart id or not. For new carts, getCart() is used. For existing
443
+ # carts, getCartByCartId(cart_id) is used.
444
+
445
+ expansion = 'items' # for this example, we're just getting a cart to insert some items into it.
446
+
447
+ # do you have the cart id from a cookie or some other server side state engine?
448
+ cart_id = nil
449
+ # run this example once to get a cart id, then you can add it here to test.
450
+ # the cart id below will not work for you.
451
+ # cart_id = 'C6A8693A3C78C6017FDA7A50EE380100'
452
+
453
+ api_response = if cart_id.nil?
454
+ api.get_cart({ '_expand': expansion })
455
+ else
456
+ api.get_cart_by_cart_id(cart_id, { '_expand': expansion })
457
+ end
458
+
459
+ cart = api_response.cart
460
+
461
+ puts cart.to_yaml
462
+ ```
463
+
464
+
465
+ #### Using the get_cart_by_cart_id_with_http_info variant
466
+
467
+ This returns an Array which contains the response data, status code and headers.
468
+
469
+ > <Array(<CartResponse>, Integer, Hash)> get_cart_by_cart_id_with_http_info(cart_id, opts)
470
+
471
+ ```ruby
472
+ begin
473
+ # Get cart (by cart id)
474
+ data, status_code, headers = api_instance.get_cart_by_cart_id_with_http_info(cart_id, opts)
475
+ p status_code # => 2xx
476
+ p headers # => { ... }
477
+ p data # => <CartResponse>
478
+ rescue UltracartClient::ApiError => e
479
+ puts "Error when calling CheckoutApi->get_cart_by_cart_id_with_http_info: #{e}"
480
+ end
481
+ ```
482
+
483
+ ### Parameters
484
+
485
+ | Name | Type | Description | Notes |
486
+ | ---- | ---- | ----------- | ----- |
487
+ | **cart_id** | **String** | Cart ID to retrieve | |
488
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
489
+
490
+ ### Return type
491
+
492
+ [**CartResponse**](CartResponse.md)
493
+
494
+ ### Authorization
495
+
496
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
497
+
498
+ ### HTTP request headers
499
+
500
+ - **Content-Type**: Not defined
501
+ - **Accept**: application/json
502
+
503
+
504
+ ## get_cart_by_return_code
505
+
506
+ > <CartResponse> get_cart_by_return_code(return_code, opts)
507
+
508
+ Get cart (by return code)
509
+
510
+ Get a cart specified by the return code parameter.
511
+
512
+
513
+ ### Examples
514
+
515
+ ```ruby
516
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
517
+
518
+ # this example returns a shopping cart given a return_code. The return_code is generated by UltraCart
519
+ # and usually emailed to a customer. The email will provide a link to this script where you may use the
520
+ # return_code to retrieve the customer's cart.
521
+
522
+ require 'ultracart_api'
523
+ require_relative '../constants'
524
+
525
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
526
+
527
+ expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
528
+ # Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
529
+ # affiliate checkout customer_profile
530
+ # billing coupons gift
531
+ # gift_certificate items.attributes items.multimedia
532
+ # items items.multimedia.thumbnails items.physical
533
+ # marketing payment settings.gift
534
+ # settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
535
+ # settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
536
+ # settings.terms shipping taxes
537
+ # summary upsell_after
538
+
539
+ return_code = '1234567890' # usually retrieved from a query parameter
540
+ api_response = checkout_api.get_cart_by_return_code(return_code, _expand: expansion)
541
+ cart = api_response.cart
542
+
543
+ # TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
544
+ cookies[Constants::CART_ID_COOKIE_NAME] = { value: cart.cart_id, expires: Time.now + 1209600, path: "/" }
545
+
546
+ puts cart.inspect
547
+ ```
548
+
549
+
550
+ #### Using the get_cart_by_return_code_with_http_info variant
551
+
552
+ This returns an Array which contains the response data, status code and headers.
553
+
554
+ > <Array(<CartResponse>, Integer, Hash)> get_cart_by_return_code_with_http_info(return_code, opts)
555
+
556
+ ```ruby
557
+ begin
558
+ # Get cart (by return code)
559
+ data, status_code, headers = api_instance.get_cart_by_return_code_with_http_info(return_code, opts)
560
+ p status_code # => 2xx
561
+ p headers # => { ... }
562
+ p data # => <CartResponse>
563
+ rescue UltracartClient::ApiError => e
564
+ puts "Error when calling CheckoutApi->get_cart_by_return_code_with_http_info: #{e}"
565
+ end
566
+ ```
567
+
568
+ ### Parameters
569
+
570
+ | Name | Type | Description | Notes |
571
+ | ---- | ---- | ----------- | ----- |
572
+ | **return_code** | **String** | Return code to lookup cart ID by | |
573
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
574
+
575
+ ### Return type
576
+
577
+ [**CartResponse**](CartResponse.md)
578
+
579
+ ### Authorization
580
+
581
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
582
+
583
+ ### HTTP request headers
584
+
585
+ - **Content-Type**: Not defined
586
+ - **Accept**: application/json
587
+
588
+
589
+ ## get_cart_by_return_token
590
+
591
+ > <CartResponse> get_cart_by_return_token(opts)
592
+
593
+ Get cart (by return token)
594
+
595
+ Get a cart specified by the encrypted return token parameter.
596
+
597
+
598
+ ### Examples
599
+
600
+ ```ruby
601
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
602
+
603
+ # this example returns a shopping cart given a return_token. The return token is generated by StoreFront Communications
604
+ # and usually emailed to a customer. The link within the email will (when you configure your storefront communications)
605
+ # provide a link to this script where you may use the token to retrieve the customer's cart.
606
+
607
+ require 'ultracart_api'
608
+ require_relative '../constants'
609
+
610
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
611
+
612
+ expansion = "items,billing,shipping,coupons,checkout,payment,summary,taxes"
613
+ # Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html
614
+ # affiliate checkout customer_profile
615
+ # billing coupons gift
616
+ # gift_certificate items.attributes items.multimedia
617
+ # items items.multimedia.thumbnails items.physical
618
+ # marketing payment settings.gift
619
+ # settings.billing.provinces settings.shipping.deliver_on_date settings.shipping.estimates
620
+ # settings.shipping.provinces settings.shipping.ship_on_date settings.taxes
621
+ # settings.terms shipping taxes
622
+ # summary upsell_after
623
+
624
+ cart_token = '1234567890' # usually retrieved from a query parameter
625
+ api_response = checkout_api.get_cart_by_return_token(cart_token, _expand: expansion)
626
+ cart = api_response.cart
627
+
628
+ # TODO: set or re-set the cart cookie if this is part of a multi-page process. two weeks is a generous cart id time.
629
+ cookies[Constants::CART_ID_COOKIE_NAME] = { value: cart.cart_id, expires: Time.now + 1209600, path: "/" }
630
+
631
+ puts cart.inspect
632
+ ```
633
+
634
+
635
+ #### Using the get_cart_by_return_token_with_http_info variant
636
+
637
+ This returns an Array which contains the response data, status code and headers.
638
+
639
+ > <Array(<CartResponse>, Integer, Hash)> get_cart_by_return_token_with_http_info(opts)
640
+
641
+ ```ruby
642
+ begin
643
+ # Get cart (by return token)
644
+ data, status_code, headers = api_instance.get_cart_by_return_token_with_http_info(opts)
645
+ p status_code # => 2xx
646
+ p headers # => { ... }
647
+ p data # => <CartResponse>
648
+ rescue UltracartClient::ApiError => e
649
+ puts "Error when calling CheckoutApi->get_cart_by_return_token_with_http_info: #{e}"
650
+ end
651
+ ```
652
+
653
+ ### Parameters
654
+
655
+ | Name | Type | Description | Notes |
656
+ | ---- | ---- | ----------- | ----- |
657
+ | **return_token** | **String** | Return token provided by StoreFront Communications | [optional] |
658
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
659
+
660
+ ### Return type
661
+
662
+ [**CartResponse**](CartResponse.md)
663
+
664
+ ### Authorization
665
+
666
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
667
+
668
+ ### HTTP request headers
669
+
670
+ - **Content-Type**: Not defined
671
+ - **Accept**: application/json
672
+
673
+
674
+ ## get_state_provinces_for_country
675
+
676
+ > <CheckoutStateProvinceResponse> get_state_provinces_for_country(country_code)
677
+
678
+ Get state/province list for a country code
679
+
680
+ Lookup a state/province list for a given country code
681
+
682
+
683
+ ### Examples
684
+
685
+ ```ruby
686
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
687
+ # A simple method for populating the state_region list boxes with all the states/regions allowed for a country code.
688
+
689
+ require 'ultracart_api'
690
+ require_relative '../constants'
691
+
692
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
693
+
694
+ country_code = 'US'
695
+
696
+ api_response = checkout_api.get_state_provinces_for_country(country_code)
697
+ provinces = api_response.state_provinces
698
+
699
+ provinces.each do |province|
700
+ puts province.inspect # contains both name and abbreviation
701
+ end
702
+ ```
703
+
704
+
705
+ #### Using the get_state_provinces_for_country_with_http_info variant
706
+
707
+ This returns an Array which contains the response data, status code and headers.
708
+
709
+ > <Array(<CheckoutStateProvinceResponse>, Integer, Hash)> get_state_provinces_for_country_with_http_info(country_code)
710
+
711
+ ```ruby
712
+ begin
713
+ # Get state/province list for a country code
714
+ data, status_code, headers = api_instance.get_state_provinces_for_country_with_http_info(country_code)
715
+ p status_code # => 2xx
716
+ p headers # => { ... }
717
+ p data # => <CheckoutStateProvinceResponse>
718
+ rescue UltracartClient::ApiError => e
719
+ puts "Error when calling CheckoutApi->get_state_provinces_for_country_with_http_info: #{e}"
720
+ end
721
+ ```
722
+
723
+ ### Parameters
724
+
725
+ | Name | Type | Description | Notes |
726
+ | ---- | ---- | ----------- | ----- |
727
+ | **country_code** | **String** | Two letter ISO country code | |
728
+
729
+ ### Return type
730
+
731
+ [**CheckoutStateProvinceResponse**](CheckoutStateProvinceResponse.md)
732
+
733
+ ### Authorization
734
+
735
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
736
+
737
+ ### HTTP request headers
738
+
739
+ - **Content-Type**: Not defined
740
+ - **Accept**: application/json
741
+
742
+
743
+ ## handoff_cart
744
+
745
+ > <CheckoutHandoffResponse> handoff_cart(handoff_request, opts)
746
+
747
+ Handoff cart
748
+
749
+ Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
750
+
751
+
752
+ ### Examples
753
+
754
+ ```ruby
755
+ require 'ultracart_api'
756
+ require_relative '../constants'
757
+
758
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
759
+
760
+ # This example uses the get_cart.rb code as a starting point because we must get a cart to hand off a cart.
761
+ # Here, we are handing off the cart to the UltraCart engine with an operation of 'view', meaning that we
762
+ # simply added some items to the cart and wish for UltraCart to gather the remaining customer information
763
+ # as part of a normal checkout operation.
764
+ # Valid operations are: "view", "checkout", "paypal", "paypalcredit", "affirm", "sezzle"
765
+ # Besides "view", the other operations are finalizers.
766
+ # "checkout": Finalize the transaction using a customer's personal credit card (traditional checkout)
767
+ # "paypal": Finalize the transaction by sending the customer to PayPal
768
+
769
+ # get_cart.rb code start ----------------------------------------------------------------------------
770
+
771
+ # This example is the same for both get_cart.rb and get_cart_by_cart_id.rb. They work as a pair and are called
772
+ # depending on the presence of an existing cart ID or not. For new carts, get_cart() is used. For existing
773
+ # carts, get_cart_by_cart_id(cart_id) is used.
774
+
775
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
776
+
777
+ expansion = "items" # For this example, we're just getting a cart to insert some items into it.
778
+
779
+ cart_id = nil
780
+ cart_id = ENV['HTTP_COOKIE'].scan(/UltraCartShoppingCartID=([^;]+)/).flatten.first if ENV['HTTP_COOKIE']
781
+
782
+ cart = nil
783
+ if cart_id.nil?
784
+ api_response = checkout_api.get_cart(expansion: expansion)
785
+ else
786
+ api_response = checkout_api.get_cart_by_cart_id(cart_id, expansion: expansion)
787
+ end
788
+ cart = api_response.cart
789
+
790
+ # get_cart.rb code end ----------------------------------------------------------------------------
791
+
792
+ # Although the above code checks for a cookie and retrieves or creates a cart based on the cookie presence, typically
793
+ # a Ruby script calling the handoff() method will have an existing cart, so you may wish to check for a cookie and
794
+ # redirect if there isn't one. However, it is possible that you wish to create a cart, update it, and hand it off
795
+ # to UltraCart all within one script, so we've left the conditional cart creation calls intact.
796
+
797
+ handoff_request = UltracartClient::CheckoutHandoffRequest.new
798
+ handoff_request.cart = cart
799
+ handoff_request.operation = "view"
800
+ handoff_request.error_return_url = "/some/page/on/this/ruby/server/that/can/handle/errors/if/ultracart/encounters/an/issue/with/this/cart.rb"
801
+ handoff_request.error_parameter_name = "uc_error" # Name this whatever the script supplied in ->setErrorReturnUrl() will check for in the params.
802
+ handoff_request.secure_host_name = "mystorefront.com" # Set to desired storefront. Some merchants have multiple storefronts.
803
+
804
+ api_response = checkout_api.handoff_cart(handoff_request, { '_expand' => expansion })
805
+
806
+ if !api_response.errors.nil? && !api_response.errors.empty?
807
+ # TODO: Handle errors that might happen before handoff and manage those
808
+ else
809
+ redirect_url = api_response.redirect_to_url
810
+ puts "Location: #{redirect_url}\n\n"
811
+ end
812
+ ```
813
+
814
+
815
+ #### Using the handoff_cart_with_http_info variant
816
+
817
+ This returns an Array which contains the response data, status code and headers.
818
+
819
+ > <Array(<CheckoutHandoffResponse>, Integer, Hash)> handoff_cart_with_http_info(handoff_request, opts)
820
+
821
+ ```ruby
822
+ begin
823
+ # Handoff cart
824
+ data, status_code, headers = api_instance.handoff_cart_with_http_info(handoff_request, opts)
825
+ p status_code # => 2xx
826
+ p headers # => { ... }
827
+ p data # => <CheckoutHandoffResponse>
828
+ rescue UltracartClient::ApiError => e
829
+ puts "Error when calling CheckoutApi->handoff_cart_with_http_info: #{e}"
830
+ end
831
+ ```
832
+
833
+ ### Parameters
834
+
835
+ | Name | Type | Description | Notes |
836
+ | ---- | ---- | ----------- | ----- |
837
+ | **handoff_request** | [**CheckoutHandoffRequest**](CheckoutHandoffRequest.md) | Handoff request | |
838
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
839
+
840
+ ### Return type
841
+
842
+ [**CheckoutHandoffResponse**](CheckoutHandoffResponse.md)
843
+
844
+ ### Authorization
845
+
846
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
847
+
848
+ ### HTTP request headers
849
+
850
+ - **Content-Type**: application/json
851
+ - **Accept**: application/json
852
+
853
+
854
+ ## login
855
+
856
+ > <CartProfileLoginResponse> login(login_request, opts)
857
+
858
+ Profile login
859
+
860
+ Login in to the customer profile specified by cart.billing.email and password
861
+
862
+
863
+ ### Examples
864
+
865
+ ```ruby
866
+ require 'ultracart_api'
867
+ require_relative '../constants'
868
+
869
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
870
+
871
+ # This example logs a user into the UltraCart system.
872
+ # This example assumes you already have a shopping cart object created.
873
+ # For new carts, get_cart() is used. For existing carts, get_cart_by_cart_id(cart_id) is used.
874
+
875
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
876
+
877
+ # Note: customer_profile is a required expansion for login to work properly
878
+ expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
879
+ # Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
880
+
881
+ # Create a new cart (change this to an existing if you have one)
882
+ cart = checkout_api.get_cart(expansion: expansion).cart
883
+
884
+ email = 'test@test.com' # Collect this from user.
885
+ password = 'ABC123' # Collect this from user.
886
+
887
+ cart.billing = UltracartClient::CartBilling.new
888
+ cart.billing.email = email
889
+
890
+ login_request = UltracartClient::CartProfileLoginRequest.new
891
+ login_request.cart = cart # Will look for billing.email
892
+ login_request.password = password
893
+
894
+ api_response = checkout_api.login(login_request)
895
+ cart = api_response.cart
896
+
897
+ if api_response.success
898
+ # Proceed with successful login.
899
+ else
900
+ # Notify customer login failed.
901
+ end
902
+ ```
903
+
904
+
905
+ #### Using the login_with_http_info variant
906
+
907
+ This returns an Array which contains the response data, status code and headers.
908
+
909
+ > <Array(<CartProfileLoginResponse>, Integer, Hash)> login_with_http_info(login_request, opts)
910
+
911
+ ```ruby
912
+ begin
913
+ # Profile login
914
+ data, status_code, headers = api_instance.login_with_http_info(login_request, opts)
915
+ p status_code # => 2xx
916
+ p headers # => { ... }
917
+ p data # => <CartProfileLoginResponse>
918
+ rescue UltracartClient::ApiError => e
919
+ puts "Error when calling CheckoutApi->login_with_http_info: #{e}"
920
+ end
921
+ ```
922
+
923
+ ### Parameters
924
+
925
+ | Name | Type | Description | Notes |
926
+ | ---- | ---- | ----------- | ----- |
927
+ | **login_request** | [**CartProfileLoginRequest**](CartProfileLoginRequest.md) | Login request | |
928
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
929
+
930
+ ### Return type
931
+
932
+ [**CartProfileLoginResponse**](CartProfileLoginResponse.md)
933
+
934
+ ### Authorization
935
+
936
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
937
+
938
+ ### HTTP request headers
939
+
940
+ - **Content-Type**: application/json
941
+ - **Accept**: application/json
942
+
943
+
944
+ ## logout
945
+
946
+ > <CartResponse> logout(cart, opts)
947
+
948
+ Profile logout
949
+
950
+ Log the cart out of the current profile. No error will occur if they are not logged in.
951
+
952
+
953
+ ### Examples
954
+
955
+ ```ruby
956
+ require 'ultracart_api'
957
+ require_relative '../constants'
958
+
959
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
960
+
961
+ # This example logs a user OUT of the UltraCart system.
962
+ # It assumes the shopping cart has already had a successful login.
963
+ # See login sdk_sample for logging in help.
964
+ # For new carts, get_cart() is used. For existing carts, get_cart_by_cart_id(cart_id) is used.
965
+
966
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
967
+
968
+ # Note: customer_profile is a required expansion for login to work properly
969
+ expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
970
+ # Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
971
+
972
+ # Create a new cart (change this to an existing if you have one)
973
+ cart = checkout_api.get_cart(expansion: expansion).cart
974
+
975
+ email = 'test@test.com' # Collect this from user.
976
+ password = 'ABC123' # Collect this from user.
977
+
978
+ cart.billing = UltracartClient::CartBilling.new
979
+ cart.billing.email = email
980
+
981
+ login_request = UltracartClient::CartProfileLoginRequest.new
982
+ login_request.cart = cart # Will look for billing.email
983
+ login_request.password = password
984
+
985
+ api_response = checkout_api.login(login_request)
986
+ cart = api_response.cart
987
+
988
+ if api_response.success
989
+ checkout_api.logout(cart, { '_expand' => expansion }) # <-- Here is the logout call.
990
+ else
991
+ # Notify customer login failed. Until they log in, you can't log them out.
992
+ end
993
+ ```
994
+
995
+
996
+ #### Using the logout_with_http_info variant
997
+
998
+ This returns an Array which contains the response data, status code and headers.
999
+
1000
+ > <Array(<CartResponse>, Integer, Hash)> logout_with_http_info(cart, opts)
1001
+
1002
+ ```ruby
1003
+ begin
1004
+ # Profile logout
1005
+ data, status_code, headers = api_instance.logout_with_http_info(cart, opts)
1006
+ p status_code # => 2xx
1007
+ p headers # => { ... }
1008
+ p data # => <CartResponse>
1009
+ rescue UltracartClient::ApiError => e
1010
+ puts "Error when calling CheckoutApi->logout_with_http_info: #{e}"
1011
+ end
1012
+ ```
1013
+
1014
+ ### Parameters
1015
+
1016
+ | Name | Type | Description | Notes |
1017
+ | ---- | ---- | ----------- | ----- |
1018
+ | **cart** | [**Cart**](Cart.md) | Cart | |
1019
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1020
+
1021
+ ### Return type
1022
+
1023
+ [**CartResponse**](CartResponse.md)
1024
+
1025
+ ### Authorization
1026
+
1027
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1028
+
1029
+ ### HTTP request headers
1030
+
1031
+ - **Content-Type**: application/json
1032
+ - **Accept**: application/json
1033
+
1034
+
1035
+ ## register
1036
+
1037
+ > <CartProfileRegisterResponse> register(register_request, opts)
1038
+
1039
+ Profile registration
1040
+
1041
+ Register a new customer profile. Requires the cart.billing object to be populated along with the password.
1042
+
1043
+
1044
+ ### Examples
1045
+
1046
+ ```ruby
1047
+ require 'ultracart_api'
1048
+ require_relative '../constants'
1049
+
1050
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
1051
+
1052
+ # Registers a user in your merchant system. This will create a customer profile.
1053
+ # For new carts, get_cart() is used. For existing carts, get_cart_by_cart_id(cart_id) is used.
1054
+
1055
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
1056
+
1057
+ # Note: customer_profile is a required expansion for login to work properly
1058
+ expansion = "customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes"
1059
+ # Possible Expansion Variables: (see https://www.ultracart.com/api/#resource_checkout.html)
1060
+
1061
+ # Create a new cart (change this to an existing if you have one)
1062
+ cart = checkout_api.get_cart(expansion: expansion).cart
1063
+
1064
+ email = 'test@test.com' # Collect this from user.
1065
+ password = 'ABC123' # Collect this from user.
1066
+
1067
+ cart.billing = UltracartClient::CartBilling.new
1068
+ cart.billing.email = email # This is the username.
1069
+
1070
+ register_request = UltracartClient::CartProfileRegisterRequest.new
1071
+ register_request.cart = cart # Will look for billing.email
1072
+ register_request.password = password
1073
+
1074
+ api_response = checkout_api.register(register_request)
1075
+ cart = api_response.cart # Important! Get the cart from the response.
1076
+
1077
+ if api_response.success
1078
+ puts 'Successfully registered new customer profile!'
1079
+ else
1080
+ api_response.errors.each { |error| puts error.inspect }
1081
+ end
1082
+ ```
1083
+
1084
+
1085
+ #### Using the register_with_http_info variant
1086
+
1087
+ This returns an Array which contains the response data, status code and headers.
1088
+
1089
+ > <Array(<CartProfileRegisterResponse>, Integer, Hash)> register_with_http_info(register_request, opts)
1090
+
1091
+ ```ruby
1092
+ begin
1093
+ # Profile registration
1094
+ data, status_code, headers = api_instance.register_with_http_info(register_request, opts)
1095
+ p status_code # => 2xx
1096
+ p headers # => { ... }
1097
+ p data # => <CartProfileRegisterResponse>
1098
+ rescue UltracartClient::ApiError => e
1099
+ puts "Error when calling CheckoutApi->register_with_http_info: #{e}"
1100
+ end
1101
+ ```
1102
+
1103
+ ### Parameters
1104
+
1105
+ | Name | Type | Description | Notes |
1106
+ | ---- | ---- | ----------- | ----- |
1107
+ | **register_request** | [**CartProfileRegisterRequest**](CartProfileRegisterRequest.md) | Register request | |
1108
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1109
+
1110
+ ### Return type
1111
+
1112
+ [**CartProfileRegisterResponse**](CartProfileRegisterResponse.md)
1113
+
1114
+ ### Authorization
1115
+
1116
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1117
+
1118
+ ### HTTP request headers
1119
+
1120
+ - **Content-Type**: application/json
1121
+ - **Accept**: application/json
1122
+
1123
+
1124
+ ## register_affiliate_click
1125
+
1126
+ > <RegisterAffiliateClickResponse> register_affiliate_click(register_affiliate_click_request, opts)
1127
+
1128
+ Register affiliate click
1129
+
1130
+ Register an affiliate click. Used by custom checkouts that are completely API based and do not perform checkout handoff.
1131
+
1132
+
1133
+ ### Examples
1134
+
1135
+ ```ruby
1136
+ require 'ultracart_api'
1137
+ require_relative '../constants'
1138
+
1139
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
1140
+ # Records an affiliate click.
1141
+
1142
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
1143
+
1144
+ click_request = UltracartClient::RegisterAffiliateClickRequest.new
1145
+ click_request.ip_address = ENV['HTTP_X_FORWARDED_FOR'] || ENV['REMOTE_ADDR']
1146
+ click_request.user_agent = ENV['HTTP_USER_AGENT'] || ''
1147
+ click_request.referrer_url = ENV['HTTP_REFERER'] || ''
1148
+ click_request.affid = 123_456_789 # You should know this from your UltraCart affiliate system.
1149
+ click_request.subid = 'TODO:SupplyThisValue'
1150
+ # click_request.landing_page_url = nil # If you have a landing page URL.
1151
+
1152
+ api_response = checkout_api.register_affiliate_click(click_request)
1153
+
1154
+ puts api_response.inspect
1155
+ ```
1156
+
1157
+
1158
+ #### Using the register_affiliate_click_with_http_info variant
1159
+
1160
+ This returns an Array which contains the response data, status code and headers.
1161
+
1162
+ > <Array(<RegisterAffiliateClickResponse>, Integer, Hash)> register_affiliate_click_with_http_info(register_affiliate_click_request, opts)
1163
+
1164
+ ```ruby
1165
+ begin
1166
+ # Register affiliate click
1167
+ data, status_code, headers = api_instance.register_affiliate_click_with_http_info(register_affiliate_click_request, opts)
1168
+ p status_code # => 2xx
1169
+ p headers # => { ... }
1170
+ p data # => <RegisterAffiliateClickResponse>
1171
+ rescue UltracartClient::ApiError => e
1172
+ puts "Error when calling CheckoutApi->register_affiliate_click_with_http_info: #{e}"
1173
+ end
1174
+ ```
1175
+
1176
+ ### Parameters
1177
+
1178
+ | Name | Type | Description | Notes |
1179
+ | ---- | ---- | ----------- | ----- |
1180
+ | **register_affiliate_click_request** | [**RegisterAffiliateClickRequest**](RegisterAffiliateClickRequest.md) | Register affiliate click request | |
1181
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1182
+
1183
+ ### Return type
1184
+
1185
+ [**RegisterAffiliateClickResponse**](RegisterAffiliateClickResponse.md)
1186
+
1187
+ ### Authorization
1188
+
1189
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1190
+
1191
+ ### HTTP request headers
1192
+
1193
+ - **Content-Type**: application/json
1194
+ - **Accept**: application/json
1195
+
1196
+
1197
+ ## related_items_for_cart
1198
+
1199
+ > <ItemsResponse> related_items_for_cart(cart, opts)
1200
+
1201
+ Related items
1202
+
1203
+ Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
1204
+
1205
+
1206
+ ### Examples
1207
+
1208
+ ```ruby
1209
+ require 'ultracart_api'
1210
+ require_relative '../constants'
1211
+
1212
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
1213
+ # Retrieves items related to the items within the cart. Item relations are configured in the UltraCart backend.
1214
+ # See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
1215
+
1216
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
1217
+
1218
+ expansion = 'customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes'
1219
+
1220
+ cart_id = ENV['HTTP_ULTRACARTSHOPPINGCARTID']
1221
+
1222
+ cart = if cart_id.nil?
1223
+ checkout_api.get_cart({_expand: expansion}).cart
1224
+ else
1225
+ checkout_api.get_cart_by_cart_id(cart_id, {_expand: expansion}).cart
1226
+ end
1227
+
1228
+ # TODO - add some items to the cart and update.
1229
+
1230
+ items = []
1231
+ cart_item = UltracartClient::CartItem.new
1232
+ cart_item.item_id = 'ITEM_ABC'
1233
+ cart_item.quantity = 1
1234
+ items << cart_item
1235
+ cart.items = items
1236
+
1237
+ # Update the cart
1238
+ cart = checkout_api.update_cart(cart, { '_expand' => expansion }).cart
1239
+
1240
+ api_response = checkout_api.related_items_for_cart(cart)
1241
+ related_items = api_response.items
1242
+
1243
+ puts related_items.inspect
1244
+ ```
1245
+
1246
+
1247
+ #### Using the related_items_for_cart_with_http_info variant
1248
+
1249
+ This returns an Array which contains the response data, status code and headers.
1250
+
1251
+ > <Array(<ItemsResponse>, Integer, Hash)> related_items_for_cart_with_http_info(cart, opts)
1252
+
1253
+ ```ruby
1254
+ begin
1255
+ # Related items
1256
+ data, status_code, headers = api_instance.related_items_for_cart_with_http_info(cart, opts)
1257
+ p status_code # => 2xx
1258
+ p headers # => { ... }
1259
+ p data # => <ItemsResponse>
1260
+ rescue UltracartClient::ApiError => e
1261
+ puts "Error when calling CheckoutApi->related_items_for_cart_with_http_info: #{e}"
1262
+ end
1263
+ ```
1264
+
1265
+ ### Parameters
1266
+
1267
+ | Name | Type | Description | Notes |
1268
+ | ---- | ---- | ----------- | ----- |
1269
+ | **cart** | [**Cart**](Cart.md) | Cart | |
1270
+ | **_expand** | **String** | The object expansion to perform on the result. See item resource documentation for examples | [optional] |
1271
+
1272
+ ### Return type
1273
+
1274
+ [**ItemsResponse**](ItemsResponse.md)
1275
+
1276
+ ### Authorization
1277
+
1278
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1279
+
1280
+ ### HTTP request headers
1281
+
1282
+ - **Content-Type**: application/json
1283
+ - **Accept**: application/json
1284
+
1285
+
1286
+ ## related_items_for_item
1287
+
1288
+ > <ItemsResponse> related_items_for_item(item_id, cart, opts)
1289
+
1290
+ Related items (specific item)
1291
+
1292
+ Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
1293
+
1294
+
1295
+ ### Examples
1296
+
1297
+ ```ruby
1298
+ require 'ultracart_api'
1299
+ require_relative '../constants'
1300
+
1301
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
1302
+ # Retrieves items related to the items within the cart, in addition to another item ID you supply.
1303
+ # Item relations are configured in the UltraCart backend.
1304
+ # See: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/1377171/Related+Items
1305
+
1306
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
1307
+
1308
+ expansion = 'customer_profile,items,billing,shipping,coupons,checkout,payment,summary,taxes'
1309
+
1310
+ cart_id = ENV['HTTP_ULTRACARTSHOPPINGCARTID']
1311
+
1312
+ cart = if cart_id.nil?
1313
+ checkout_api.get_cart({_expand: expansion}).cart
1314
+ else
1315
+ checkout_api.get_cart_by_cart_id(cart_id, {_expand: expansion}).cart
1316
+ end
1317
+
1318
+ # TODO - add some items to the cart and update.
1319
+
1320
+ items = []
1321
+ cart_item = UltracartClient::CartItem.new
1322
+ cart_item.item_id = 'ITEM_ABC'
1323
+ cart_item.quantity = 1
1324
+ items << cart_item
1325
+ cart.items = items
1326
+
1327
+ # Update the cart
1328
+ cart = checkout_api.update_cart(cart, { '_expand' => expansion }).cart
1329
+
1330
+ another_item_id = 'ITEM_ZZZ'
1331
+
1332
+ api_response = checkout_api.related_items_for_item(another_item_id, cart, { '_expand' => expansion })
1333
+ related_items = api_response.items
1334
+
1335
+ puts related_items.inspect
1336
+ ```
1337
+
1338
+
1339
+ #### Using the related_items_for_item_with_http_info variant
1340
+
1341
+ This returns an Array which contains the response data, status code and headers.
1342
+
1343
+ > <Array(<ItemsResponse>, Integer, Hash)> related_items_for_item_with_http_info(item_id, cart, opts)
1344
+
1345
+ ```ruby
1346
+ begin
1347
+ # Related items (specific item)
1348
+ data, status_code, headers = api_instance.related_items_for_item_with_http_info(item_id, cart, opts)
1349
+ p status_code # => 2xx
1350
+ p headers # => { ... }
1351
+ p data # => <ItemsResponse>
1352
+ rescue UltracartClient::ApiError => e
1353
+ puts "Error when calling CheckoutApi->related_items_for_item_with_http_info: #{e}"
1354
+ end
1355
+ ```
1356
+
1357
+ ### Parameters
1358
+
1359
+ | Name | Type | Description | Notes |
1360
+ | ---- | ---- | ----------- | ----- |
1361
+ | **item_id** | **String** | Item ID to retrieve related items for | |
1362
+ | **cart** | [**Cart**](Cart.md) | Cart | |
1363
+ | **_expand** | **String** | The object expansion to perform on the result. See item resource documentation for examples | [optional] |
1364
+
1365
+ ### Return type
1366
+
1367
+ [**ItemsResponse**](ItemsResponse.md)
1368
+
1369
+ ### Authorization
1370
+
1371
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1372
+
1373
+ ### HTTP request headers
1374
+
1375
+ - **Content-Type**: application/json
1376
+ - **Accept**: application/json
1377
+
1378
+
1379
+ ## setup_browser_key
1380
+
1381
+ > <CheckoutSetupBrowserKeyResponse> setup_browser_key(browser_key_request)
1382
+
1383
+ Setup Browser Application
1384
+
1385
+ Setup a browser key authenticated application with checkout permissions. This REST call must be made with an authentication scheme that is not browser key. The new application will be linked to the application that makes this call. If this application is disabled / deleted, then so will the application setup by this call. The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
1386
+
1387
+
1388
+ ### Examples
1389
+
1390
+ ```ruby
1391
+ require 'ultracart_api'
1392
+ require_relative '../constants'
1393
+
1394
+ # This is a checkout API method. It creates a browser key for use in a client-side checkout.
1395
+ # This call must be made server-side with a Simple API Key or an OAuth access token.
1396
+
1397
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
1398
+
1399
+ key_request = UltracartClient::CheckoutSetupBrowserKeyRequest.new
1400
+ key_request.allowed_referrers = ["https://www.mywebsite.com"]
1401
+
1402
+ browser_key = checkout_api.setup_browser_key(key_request).browser_key
1403
+
1404
+ puts browser_key.inspect
1405
+ ```
1406
+
1407
+
1408
+ #### Using the setup_browser_key_with_http_info variant
1409
+
1410
+ This returns an Array which contains the response data, status code and headers.
1411
+
1412
+ > <Array(<CheckoutSetupBrowserKeyResponse>, Integer, Hash)> setup_browser_key_with_http_info(browser_key_request)
1413
+
1414
+ ```ruby
1415
+ begin
1416
+ # Setup Browser Application
1417
+ data, status_code, headers = api_instance.setup_browser_key_with_http_info(browser_key_request)
1418
+ p status_code # => 2xx
1419
+ p headers # => { ... }
1420
+ p data # => <CheckoutSetupBrowserKeyResponse>
1421
+ rescue UltracartClient::ApiError => e
1422
+ puts "Error when calling CheckoutApi->setup_browser_key_with_http_info: #{e}"
1423
+ end
1424
+ ```
1425
+
1426
+ ### Parameters
1427
+
1428
+ | Name | Type | Description | Notes |
1429
+ | ---- | ---- | ----------- | ----- |
1430
+ | **browser_key_request** | [**CheckoutSetupBrowserKeyRequest**](CheckoutSetupBrowserKeyRequest.md) | Setup browser key request | |
1431
+
1432
+ ### Return type
1433
+
1434
+ [**CheckoutSetupBrowserKeyResponse**](CheckoutSetupBrowserKeyResponse.md)
1435
+
1436
+ ### Authorization
1437
+
1438
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1439
+
1440
+ ### HTTP request headers
1441
+
1442
+ - **Content-Type**: application/json
1443
+ - **Accept**: application/json
1444
+
1445
+
1446
+ ## update_cart
1447
+
1448
+ > <CartResponse> update_cart(cart, opts)
1449
+
1450
+ Update cart
1451
+
1452
+ Update the cart.
1453
+
1454
+
1455
+ ### Examples
1456
+
1457
+ ```ruby
1458
+ require 'ultracart_api'
1459
+ require_relative '../constants'
1460
+
1461
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
1462
+
1463
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
1464
+
1465
+ expansion = 'items' # For this example, we're just getting a cart to insert some items into it.
1466
+
1467
+ cart_id = nil
1468
+ cart_id = ENV['HTTP_COOKIE'].to_s[/#{Constants::CART_ID_COOKIE_NAME}=([^;]+)/, 1] if ENV['HTTP_COOKIE']
1469
+
1470
+ cart = if cart_id.nil?
1471
+ checkout_api.get_cart({_expand: expansion}).cart
1472
+ else
1473
+ checkout_api.get_cart_by_cart_id(cart_id, {_expand: expansion}).cart
1474
+ end
1475
+
1476
+ # Get the items array on the cart, creating it if it doesn't exist.
1477
+ items = cart.items || []
1478
+
1479
+ # Create a new item
1480
+ item = UltracartClient::CartItem.new
1481
+ item.item_id = 'BASEBALL' # TODO: Adjust the item id
1482
+ item.quantity = 1 # TODO: Adjust the quantity
1483
+
1484
+ # TODO: If your item has options, then you need to create a new UltracartClient::CartItemOption object and push it into the array.
1485
+ options = []
1486
+ item.options = options
1487
+
1488
+ # Add the item to the items array
1489
+ items << item
1490
+
1491
+ # Update the cart with the new items
1492
+ cart.items = items
1493
+
1494
+ # Push the cart up to save the item
1495
+ cart_response = checkout_api.update_cart(cart, {_expand: expansion})
1496
+
1497
+ # Extract the updated cart from the response
1498
+ cart = cart_response.cart
1499
+
1500
+ # TODO: Set or reset the cart cookie if this is part of a multi-page process. Two weeks is a generous cart ID time.
1501
+ puts "Set-Cookie: #{Constants::CART_ID_COOKIE_NAME}=#{cart.cart_id}; Path=/; Max-Age=1209600"
1502
+
1503
+ puts cart.inspect
1504
+ ```
1505
+
1506
+
1507
+ #### Using the update_cart_with_http_info variant
1508
+
1509
+ This returns an Array which contains the response data, status code and headers.
1510
+
1511
+ > <Array(<CartResponse>, Integer, Hash)> update_cart_with_http_info(cart, opts)
1512
+
1513
+ ```ruby
1514
+ begin
1515
+ # Update cart
1516
+ data, status_code, headers = api_instance.update_cart_with_http_info(cart, opts)
1517
+ p status_code # => 2xx
1518
+ p headers # => { ... }
1519
+ p data # => <CartResponse>
1520
+ rescue UltracartClient::ApiError => e
1521
+ puts "Error when calling CheckoutApi->update_cart_with_http_info: #{e}"
1522
+ end
1523
+ ```
1524
+
1525
+ ### Parameters
1526
+
1527
+ | Name | Type | Description | Notes |
1528
+ | ---- | ---- | ----------- | ----- |
1529
+ | **cart** | [**Cart**](Cart.md) | Cart | |
1530
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1531
+
1532
+ ### Return type
1533
+
1534
+ [**CartResponse**](CartResponse.md)
1535
+
1536
+ ### Authorization
1537
+
1538
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1539
+
1540
+ ### HTTP request headers
1541
+
1542
+ - **Content-Type**: application/json
1543
+ - **Accept**: application/json
1544
+
1545
+
1546
+ ## validate_cart
1547
+
1548
+ > <CartValidationResponse> validate_cart(validation_request, opts)
1549
+
1550
+ Validate
1551
+
1552
+ Validate the cart for errors. Specific checks can be passed and multiple validations can occur throughout your checkout flow.
1553
+
1554
+
1555
+ ### Examples
1556
+
1557
+ ```ruby
1558
+ require 'ultracart_api'
1559
+ require_relative '../constants'
1560
+
1561
+ # Reference Implementation: https://github.com/UltraCart/responsive_checkout
1562
+
1563
+ checkout_api = UltracartClient::CheckoutApi.new_using_api_key(Constants::API_KEY)
1564
+
1565
+ cart_id = '123456789123456789123456789123456789' # Usually this would be retrieved from a session variable or cookie.
1566
+
1567
+ expansion = 'items,billing,shipping,coupons,checkout,payment,summary,taxes'
1568
+
1569
+ cart = checkout_api.get_cart_by_cart_id(cart_id, {_expand: expansion}).cart
1570
+
1571
+ validation_request = UltracartClient::CartValidationRequest.new
1572
+ validation_request.cart = cart
1573
+
1574
+ # Possible Checks (you can set these as needed, or leave as default):
1575
+ # validation_request.set_checks(["All", "Item Quantity Valid", "Payment Information Validate"])
1576
+
1577
+ api_response = checkout_api.validate_cart(validation_request, {_expand: expansion})
1578
+ cart = api_response.cart
1579
+
1580
+ puts "Validation Errors:"
1581
+ puts api_response.errors.inspect
1582
+ ```
1583
+
1584
+
1585
+ #### Using the validate_cart_with_http_info variant
1586
+
1587
+ This returns an Array which contains the response data, status code and headers.
1588
+
1589
+ > <Array(<CartValidationResponse>, Integer, Hash)> validate_cart_with_http_info(validation_request, opts)
1590
+
1591
+ ```ruby
1592
+ begin
1593
+ # Validate
1594
+ data, status_code, headers = api_instance.validate_cart_with_http_info(validation_request, opts)
1595
+ p status_code # => 2xx
1596
+ p headers # => { ... }
1597
+ p data # => <CartValidationResponse>
1598
+ rescue UltracartClient::ApiError => e
1599
+ puts "Error when calling CheckoutApi->validate_cart_with_http_info: #{e}"
1600
+ end
1601
+ ```
1602
+
1603
+ ### Parameters
1604
+
1605
+ | Name | Type | Description | Notes |
1606
+ | ---- | ---- | ----------- | ----- |
1607
+ | **validation_request** | [**CartValidationRequest**](CartValidationRequest.md) | Validation request | |
1608
+ | **_expand** | **String** | The object expansion to perform on the result. See documentation for examples | [optional] |
1609
+
1610
+ ### Return type
1611
+
1612
+ [**CartValidationResponse**](CartValidationResponse.md)
1613
+
1614
+ ### Authorization
1615
+
1616
+ [ultraCartBrowserApiKey](../README.md#ultraCartBrowserApiKey), [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
1617
+
1618
+ ### HTTP request headers
1619
+
1620
+ - **Content-Type**: application/json
1621
+ - **Accept**: application/json
1622
+