taxjar-ruby 2.5.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -7
- data/CHANGELOG.md +25 -2
- data/README.md +524 -332
- data/lib/taxjar/api/request.rb +18 -12
- data/lib/taxjar/client.rb +8 -1
- data/lib/taxjar/error.rb +9 -0
- data/lib/taxjar/order.rb +1 -0
- data/lib/taxjar/refund.rb +1 -0
- data/lib/taxjar/tax.rb +1 -0
- data/lib/taxjar/version.rb +3 -3
- data/spec/fixtures/order.json +1 -0
- data/spec/fixtures/refund.json +1 -0
- data/spec/fixtures/taxes.json +1 -0
- data/spec/fixtures/taxes_canada.json +1 -0
- data/spec/fixtures/taxes_international.json +1 -0
- data/spec/taxjar/api/api_spec.rb +4 -0
- data/spec/taxjar/api/order_spec.rb +6 -0
- data/spec/taxjar/api/refund_spec.rb +6 -0
- data/spec/taxjar/api/request_spec.rb +70 -10
- data/spec/taxjar/client_spec.rb +4 -4
- data/taxjar-ruby.gemspec +3 -3
- metadata +14 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 59f7440e50a1552f055f03501341b8883c960d9e85d50de6817ec7b7ca3908a1
|
4
|
+
data.tar.gz: 74712431ab3d1ad24fdfd064aa61cbdf53f5b47061d6eb61e032405ca9e2a539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73aa9395d63a8b078699b23dcac7e97555831de2846db337e5ea32861fc6f3722589c6c0437eb7c8349d2f53614227f54cb11506d94370dbbac15f8c49fd7ea5
|
7
|
+
data.tar.gz: 95d3fb22ef2bcbf85fd5e256eb628765f8f1698ebedd5527b9f3fbc952357aa0fe6b3e04f87727dc4493c5feb7741ca309e73d3d93d1337c780083fc0cd6f8eb
|
data/.travis.yml
CHANGED
@@ -1,16 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- "2.0"
|
5
|
-
- "2.1"
|
6
|
-
- "2.2"
|
7
4
|
- "2.3"
|
8
5
|
- "2.4"
|
9
6
|
- "2.5"
|
10
7
|
- "2.6"
|
8
|
+
- "2.7"
|
9
|
+
- "3.0"
|
11
10
|
|
12
11
|
script: bundle exec rspec
|
13
|
-
|
14
|
-
before_install:
|
15
|
-
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
16
|
-
- gem install bundler -v '< 2'
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [3.0.2] - 2021-03-18
|
11
|
+
- Re-classify `HTTP::ConnectionError` and other `HTTP::Error` types as `Taxjar::Error`
|
12
|
+
|
13
|
+
## [3.0.1] - 2021-03-16
|
14
|
+
- Throw a `Taxjar::Error` exception for any non-successful HTTP response
|
15
|
+
|
16
|
+
## [3.0.0] - 2020-04-03
|
17
|
+
- Add information to custom user agent for debugging and informational purposes
|
18
|
+
- Update required Ruby version from 2.0 to 2.3 or higher
|
19
|
+
- Update HTTP (The Gem) to version 4.3
|
20
|
+
- Relax bundler (development dependency) version requirements
|
21
|
+
|
22
|
+
## [2.6.1] - 2019-10-23
|
23
|
+
- Parse all responses as JSON and improve error handling for non-JSON [#51](https://github.com/taxjar/taxjar-ruby/pull/51)
|
24
|
+
|
25
|
+
## [2.6.0] - 2019-07-09
|
26
|
+
- Support `exemption_type` param for order-level exempt transactions
|
27
|
+
|
10
28
|
## [2.5.0] - 2019-06-19
|
11
29
|
- Support `provider` param for marketplace exempt transactions
|
12
30
|
- Add proxy support when instantiating client
|
@@ -31,11 +49,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
31
49
|
- Update minimum required Ruby version to 2.0
|
32
50
|
- Update HTTP (The Gem) to 2.2
|
33
51
|
|
34
|
-
[Unreleased]: https://github.com/taxjar/taxjar-ruby/compare/
|
52
|
+
[Unreleased]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.2...HEAD
|
53
|
+
[3.0.2]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.1...v3.0.2
|
54
|
+
[3.0.1]: https://github.com/taxjar/taxjar-ruby/compare/v3.0.0...v3.0.1
|
55
|
+
[3.0.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.6.1...v3.0.0
|
56
|
+
[2.6.1]: https://github.com/taxjar/taxjar-ruby/compare/v2.6.0...v2.6.1
|
57
|
+
[2.6.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.5.0...v2.6.0
|
35
58
|
[2.5.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.4.1...v2.5.0
|
36
59
|
[2.4.1]: https://github.com/taxjar/taxjar-ruby/compare/v2.4.0...v2.4.1
|
37
60
|
[2.4.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.3.0...v2.4.0
|
38
61
|
[2.3.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.2.0...v2.3.0
|
39
62
|
[2.2.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.1.0...v2.2.0
|
40
63
|
[2.1.0]: https://github.com/taxjar/taxjar-ruby/compare/v2.0.0...v2.1.0
|
41
|
-
[2.0.0]: https://github.com/taxjar/taxjar-ruby/compare/v1.7.1...v2.0.0
|
64
|
+
[2.0.0]: https://github.com/taxjar/taxjar-ruby/compare/v1.7.1...v2.0.0
|
data/README.md
CHANGED
@@ -1,15 +1,33 @@
|
|
1
|
-
# TaxJar Sales Tax API for Ruby [![RubyGems](
|
1
|
+
# TaxJar Sales Tax API for Ruby [![RubyGems](https://img.shields.io/gem/v/taxjar-ruby.svg?style=flat-square)](https://rubygems.org/gems/taxjar-ruby) [![Build Status](https://img.shields.io/travis/taxjar/taxjar-ruby.svg?style=flat-square)](https://travis-ci.org/taxjar/taxjar-ruby)
|
2
2
|
|
3
|
-
<a href="
|
3
|
+
<a href="https://developers.taxjar.com"><img src="https://www.taxjar.com/img/TJ_logo_color_office_png.png" alt="TaxJar" width="220"></a>
|
4
4
|
|
5
|
-
A Ruby interface to the TaxJar [Sales Tax API](https://developers.taxjar.com/api/reference
|
5
|
+
A Ruby interface to the TaxJar [Sales Tax API](https://developers.taxjar.com/api/reference/?ruby). TaxJar makes sales tax filing easier for online sellers and merchants. See local jurisdictional tax reports, get payment reminders, and more. You can use our API to access TaxJar API endpoints, which can get information on sales tax rates, categories or upload transactions.
|
6
6
|
|
7
|
-
* This wrapper supports 100% of [
|
7
|
+
* This wrapper supports 100% of the [TaxJar API](https://developers.taxjar.com/api/#introduction)
|
8
8
|
* Data returned from API calls are mapped to Ruby objects
|
9
9
|
|
10
|
+
<hr>
|
11
|
+
|
12
|
+
[Supported Ruby Versions](#supported-ruby-versions)<br>
|
13
|
+
[Gem Dependencies](#gem-dependencies)<br>
|
14
|
+
[Installation](#installation)<br>
|
15
|
+
[Authentication](#authentication)<br>
|
16
|
+
[Usage](#usage)<br>
|
17
|
+
[Custom Options](#custom-options)<br>
|
18
|
+
[Sandbox Environment](#sandbox-environment)<br>
|
19
|
+
[Error Handling](#error-handling)<br>
|
20
|
+
[Tests](#tests)<br>
|
21
|
+
[More Information](#more-information)<br>
|
22
|
+
[License](#license)<br>
|
23
|
+
[Support](#support)<br>
|
24
|
+
[Contributing](#contributing)
|
25
|
+
|
26
|
+
<hr>
|
27
|
+
|
10
28
|
## Supported Ruby Versions
|
11
29
|
|
12
|
-
Ruby 2.
|
30
|
+
Ruby 2.3 or greater
|
13
31
|
|
14
32
|
## Gem Dependencies
|
15
33
|
|
@@ -53,7 +71,35 @@ You're now ready to use TaxJar! [Check out our quickstart guide](https://develop
|
|
53
71
|
|
54
72
|
## Usage
|
55
73
|
|
56
|
-
|
74
|
+
[`categories` - List all tax categories](#list-all-tax-categories-api-docs)<br>
|
75
|
+
[`tax_for_order` - Calculate sales tax for an order](#calculate-sales-tax-for-an-order-api-docs)<br>
|
76
|
+
[`list_orders` - List order transactions](#list-order-transactions-api-docs)<br>
|
77
|
+
[`show_order` - Show order transaction](#show-order-transaction-api-docs)<br>
|
78
|
+
[`create_order` - Create order transaction](#create-order-transaction-api-docs)<br>
|
79
|
+
[`update_order` - Update order transaction](#update-order-transaction-api-docs)<br>
|
80
|
+
[`delete_order` - Delete order transaction](#delete-order-transaction-api-docs)<br>
|
81
|
+
[`list_refunds` - List refund transactions](#list-refund-transactions-api-docs)<br>
|
82
|
+
[`show_refund` - Show refund transaction](#show-refund-transaction-api-docs)<br>
|
83
|
+
[`create_refund` - Create refund transaction](#create-refund-transaction-api-docs)<br>
|
84
|
+
[`update_refund` - Update refund transaction](#update-refund-transaction-api-docs)<br>
|
85
|
+
[`delete_refund` - Delete refund transaction](#delete-refund-transaction-api-docs)<br>
|
86
|
+
[`list_customers` - List customers](#list-customers-api-docs)<br>
|
87
|
+
[`show_customer` - Show customer](#show-customer-api-docs)<br>
|
88
|
+
[`create_customer` - Create customer](#create-customer-api-docs)<br>
|
89
|
+
[`update_customer` - Update customer](#update-customer-api-docs)<br>
|
90
|
+
[`delete_customer` - Delete customer](#delete-customer-api-docs)<br>
|
91
|
+
[`rates_for_location` - List tax rates for a location (by zip/postal code)](#list-tax-rates-for-a-location-by-zippostal-code-api-docs)<br>
|
92
|
+
[`nexus_regions` - List nexus regions](#list-nexus-regions-api-docs)<br>
|
93
|
+
[`validate_address` - Validate an address](#validate-an-address-api-docs)<br>
|
94
|
+
[`validate` - Validate a VAT number](#validate-a-vat-number-api-docs)<br>
|
95
|
+
[`summary_rates` - Summarize tax rates for all regions](#summarize-tax-rates-for-all-regions-api-docs)
|
96
|
+
|
97
|
+
<hr>
|
98
|
+
|
99
|
+
|
100
|
+
### List all tax categories <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-list-tax-categories))_</small>
|
101
|
+
|
102
|
+
> The TaxJar API provides product-level tax rules for a subset of product categories. These categories are to be used for products that are either exempt from sales tax in some jurisdictions or are taxed at reduced rates. You need not pass in a product tax code for sales tax calculations on product that is fully taxable. Simply leave that parameter out.
|
57
103
|
|
58
104
|
#### Definition
|
59
105
|
|
@@ -92,79 +138,9 @@ client.categories
|
|
92
138
|
]
|
93
139
|
```
|
94
140
|
|
95
|
-
###
|
96
|
-
|
97
|
-
#### Definition
|
98
|
-
|
99
|
-
```ruby
|
100
|
-
client.rates_for_location
|
101
|
-
```
|
102
|
-
|
103
|
-
#### Example Request
|
104
|
-
|
105
|
-
```ruby
|
106
|
-
require 'taxjar'
|
107
|
-
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
108
|
-
|
109
|
-
# United States (ZIP+4)
|
110
|
-
rates = client.rates_for_location('90404-3370')
|
111
|
-
|
112
|
-
# United States (ZIP w/ Optional Params)
|
113
|
-
rates = client.rates_for_location('90404', {
|
114
|
-
:city => 'SANTA MONICA',
|
115
|
-
:country => 'US'
|
116
|
-
})
|
117
|
-
|
118
|
-
# International Examples (Requires City and Country)
|
119
|
-
rates = client.rates_for_location('V5K0A1', {
|
120
|
-
:city => 'VANCOUVER',
|
121
|
-
:country => 'CA'
|
122
|
-
})
|
123
|
-
|
124
|
-
rates = client.rates_for_location('00150', {
|
125
|
-
:city => 'HELSINKI',
|
126
|
-
:country => 'FI'
|
127
|
-
})
|
128
|
-
```
|
129
|
-
|
130
|
-
#### Example Response
|
131
|
-
|
132
|
-
```ruby
|
133
|
-
#<Taxjar::Rate:0x00000a @attrs={
|
134
|
-
:zip => '90002',
|
135
|
-
:state => 'CA',
|
136
|
-
:state_rate => 0.065,
|
137
|
-
:county => 'LOS ANGELES',
|
138
|
-
:county_rate => 0.01,
|
139
|
-
:city => 'WATTS',
|
140
|
-
:city_rate => 0,
|
141
|
-
:combined_district_rate => 0.015,
|
142
|
-
:combined_rate => 0.09,
|
143
|
-
:freight_taxable => false
|
144
|
-
}>
|
145
|
-
|
146
|
-
#<Taxjar::Rate:0x00000a @attrs={
|
147
|
-
:zip => 'V5K0A1',
|
148
|
-
:city => 'Vancouver',
|
149
|
-
:state => 'BC',
|
150
|
-
:country => 'CA',
|
151
|
-
:combined_rate => 0.12,
|
152
|
-
:freight_taxable => true
|
153
|
-
}>
|
154
|
-
|
155
|
-
#<Taxjar::Rate:0x00000a @attrs={
|
156
|
-
:country => 'FI',
|
157
|
-
:name => 'Finland',
|
158
|
-
:standard_rate => 0.24,
|
159
|
-
:reduced_rate => nil,
|
160
|
-
:super_reduced_rate => nil,
|
161
|
-
:parking_rate => nil,
|
162
|
-
:distance_sale_threshold => nil,
|
163
|
-
:freight_taxable => true
|
164
|
-
}>
|
165
|
-
```
|
141
|
+
### Calculate sales tax for an order <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#post-calculate-sales-tax-for-an-order))_</small>
|
166
142
|
|
167
|
-
|
143
|
+
> Shows the sales tax that should be collected for a given order.
|
168
144
|
|
169
145
|
#### Definition
|
170
146
|
|
@@ -179,24 +155,25 @@ require 'taxjar'
|
|
179
155
|
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
180
156
|
|
181
157
|
client.tax_for_order({
|
158
|
+
:from_country => 'US',
|
159
|
+
:from_zip => '94025',
|
160
|
+
:from_state => 'CA',
|
161
|
+
:from_city => 'Menlo Park',
|
162
|
+
:from_street => '2825 Sand Hill Rd',
|
182
163
|
:to_country => 'US',
|
183
|
-
:to_zip => '
|
184
|
-
:to_city => 'Los Angeles',
|
164
|
+
:to_zip => '94303',
|
185
165
|
:to_state => 'CA',
|
186
|
-
:
|
187
|
-
:
|
188
|
-
:
|
189
|
-
:
|
190
|
-
:
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
:line_items => [{:quantity => 1,
|
198
|
-
:unit_price => 15,
|
199
|
-
:product_tax_code => 20010}]
|
166
|
+
:to_city => 'Palo Alto',
|
167
|
+
:to_street => '5230 Newell Road',
|
168
|
+
:amount => 267.9,
|
169
|
+
:shipping => 0,
|
170
|
+
:nexus_addresses => [{:country => 'US',
|
171
|
+
:state => 'CA'}],
|
172
|
+
:line_items => [{:id => '1',
|
173
|
+
:quantity => 1,
|
174
|
+
:product_tax_code => '19005',
|
175
|
+
:unit_price => 535.8,
|
176
|
+
:discount => 267.9}]
|
200
177
|
})
|
201
178
|
```
|
202
179
|
|
@@ -204,44 +181,63 @@ client.tax_for_order({
|
|
204
181
|
|
205
182
|
```ruby
|
206
183
|
#<Taxjar::Tax:0x00000a @attrs={
|
207
|
-
:
|
208
|
-
:amount_to_collect => 1.35,
|
209
|
-
:has_nexus => true,
|
210
|
-
:freight_taxable => false,
|
184
|
+
:taxable_amount => 0,
|
211
185
|
:tax_source => 'destination',
|
186
|
+
:shipping => 0,
|
187
|
+
:rate => 0,
|
188
|
+
:order_total_amount => 267.9
|
212
189
|
:jurisdictions => #<Taxjar::Jurisdictions:0x00000a @attrs={
|
213
|
-
:country => 'US',
|
214
190
|
:state => 'CA',
|
215
|
-
:county => '
|
216
|
-
:
|
191
|
+
:county => 'SAN MATEO',
|
192
|
+
:country => 'US',
|
193
|
+
:city => 'EAST PALO ALTO'
|
217
194
|
}>,
|
195
|
+
:has_nexus => true,
|
196
|
+
:freight_taxable => false,
|
218
197
|
:breakdown => #<Taxjar::Breakdown:0x00000a @attrs={
|
219
|
-
:
|
220
|
-
:
|
221
|
-
:
|
222
|
-
:
|
223
|
-
:
|
224
|
-
:
|
225
|
-
:special_district_taxable_amount =>
|
226
|
-
:special_district_tax_collectable => 0
|
198
|
+
:taxable_amount => 0,
|
199
|
+
:tax_collectable => 0,
|
200
|
+
:state_taxable_amount => 0,
|
201
|
+
:state_tax_rate => 0,
|
202
|
+
:state_tax_collectable => 0,
|
203
|
+
:special_tax_rate => 0,
|
204
|
+
:special_district_taxable_amount => 0,
|
205
|
+
:special_district_tax_collectable => 0,
|
227
206
|
:line_items => [
|
228
207
|
#<Taxjar::BreakdownLineItem:0x00000a @attrs={
|
208
|
+
:taxable_amount => 0,
|
209
|
+
:tax_collectable => 0,
|
210
|
+
:state_taxable_amount => 0,
|
211
|
+
:state_sales_tax_rate => 0,
|
212
|
+
:state_amount => 0,
|
213
|
+
:special_tax_rate => 0,
|
214
|
+
:special_district_taxable_amount => 0,
|
215
|
+
:special_district_amount => 0,
|
229
216
|
:id => '1',
|
230
|
-
:
|
231
|
-
:
|
232
|
-
:
|
233
|
-
:
|
217
|
+
:county_taxable_amount => 0,
|
218
|
+
:county_tax_rate => 0,
|
219
|
+
:county_amount => 0,
|
220
|
+
:combined_tax_rate => 0,
|
234
221
|
:city_taxable_amount => 0,
|
235
222
|
:city_tax_rate => 0,
|
236
|
-
:
|
237
|
-
:special_tax_rate => 0.015
|
223
|
+
:city_amount => 0,
|
238
224
|
}>
|
239
|
-
]
|
225
|
+
],
|
226
|
+
:county_taxable_amount => 0,
|
227
|
+
:county_tax_rate => 0,
|
228
|
+
:county_tax_collectable => 0,
|
229
|
+
:combined_tax_rate => 0,
|
230
|
+
:city_taxable_amount => 0,
|
231
|
+
:city_tax_rate => 0,
|
232
|
+
:city_tax_collectable => 0
|
240
233
|
}>
|
234
|
+
:amount_to_collect => 0
|
241
235
|
}>
|
242
236
|
```
|
243
237
|
|
244
|
-
### List order transactions
|
238
|
+
### List order transactions <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-list-order-transactions))_</small>
|
239
|
+
|
240
|
+
> Lists existing order transactions created through the API.
|
245
241
|
|
246
242
|
#### Definition
|
247
243
|
|
@@ -255,8 +251,8 @@ client.list_orders
|
|
255
251
|
require 'taxjar'
|
256
252
|
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
257
253
|
|
258
|
-
client.list_orders({:from_transaction_date => '
|
259
|
-
:to_transaction_date => '2015/05/
|
254
|
+
client.list_orders({:from_transaction_date => '2015/05/01',
|
255
|
+
:to_transaction_date => '2015/05/31'})
|
260
256
|
```
|
261
257
|
|
262
258
|
#### Example Response
|
@@ -265,7 +261,9 @@ client.list_orders({:from_transaction_date => '2014/01/01',
|
|
265
261
|
['20', '21', '22']
|
266
262
|
```
|
267
263
|
|
268
|
-
### Show order transaction
|
264
|
+
### Show order transaction <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-show-an-order-transaction))_</small>
|
265
|
+
|
266
|
+
> Shows an existing order transaction created through the API.
|
269
267
|
|
270
268
|
#### Definition
|
271
269
|
|
@@ -291,12 +289,12 @@ client.show_order('123')
|
|
291
289
|
:transaction_date => '2015-05-14T00:00:00Z',
|
292
290
|
:transaction_reference_id => nil,
|
293
291
|
:from_country => 'US',
|
294
|
-
:from_zip => 93107,
|
292
|
+
:from_zip => '93107',
|
295
293
|
:from_state => 'CA',
|
296
294
|
:from_city => 'SANTA BARBARA',
|
297
295
|
:from_street => '1281 State St',
|
298
296
|
:to_country => 'US',
|
299
|
-
:to_zip => 90002,
|
297
|
+
:to_zip => '90002',
|
300
298
|
:to_state => 'CA',
|
301
299
|
:to_city => 'LOS ANGELES',
|
302
300
|
:to_street => '123 Palm Grove Ln',
|
@@ -318,7 +316,9 @@ client.show_order('123')
|
|
318
316
|
}>
|
319
317
|
```
|
320
318
|
|
321
|
-
### Create order transaction
|
319
|
+
### Create order transaction <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#post-create-an-order-transaction))_</small>
|
320
|
+
|
321
|
+
> Creates a new order transaction.
|
322
322
|
|
323
323
|
#### Definition
|
324
324
|
|
@@ -334,25 +334,27 @@ client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
|
334
334
|
|
335
335
|
order = client.create_order({
|
336
336
|
:transaction_id => '123',
|
337
|
-
:transaction_date => '2015/05/
|
338
|
-
:from_state => 'CA',
|
339
|
-
:from_city => 'Santa Barbara',
|
340
|
-
:from_street => '1218 State St',
|
337
|
+
:transaction_date => '2015/05/15',
|
341
338
|
:from_country => 'US',
|
342
|
-
:from_zip => '
|
339
|
+
:from_zip => '94025',
|
340
|
+
:from_state => 'CA',
|
341
|
+
:from_city => 'Menlo Park',
|
342
|
+
:from_street => '2825 Sand Hill Rd',
|
343
343
|
:to_country => 'US',
|
344
|
+
:to_zip => '94303',
|
344
345
|
:to_state => 'CA',
|
345
|
-
:to_city => '
|
346
|
-
:to_street => '
|
347
|
-
:
|
348
|
-
:
|
349
|
-
:
|
350
|
-
:
|
351
|
-
|
352
|
-
:
|
353
|
-
:
|
354
|
-
:unit_price =>
|
355
|
-
:
|
346
|
+
:to_city => 'Palo Alto',
|
347
|
+
:to_street => '5230 Newell Road',
|
348
|
+
:amount => 267.9,
|
349
|
+
:shipping => 0,
|
350
|
+
:sales_tax => 0,
|
351
|
+
:line_items => [{:id => '1',
|
352
|
+
:quantity => 1,
|
353
|
+
:description => 'Legal Services',
|
354
|
+
:product_tax_code => '19005',
|
355
|
+
:unit_price => 535.8,
|
356
|
+
:discount => 267.9,
|
357
|
+
:sales_tax => 0}]
|
356
358
|
})
|
357
359
|
```
|
358
360
|
|
@@ -360,39 +362,44 @@ order = client.create_order({
|
|
360
362
|
|
361
363
|
```ruby
|
362
364
|
#<Taxjar::Order:0x00000a @attrs={
|
363
|
-
:transaction_id => '
|
365
|
+
:transaction_id => '123',
|
364
366
|
:user_id => 11836,
|
365
|
-
:
|
367
|
+
:provider => 'api',
|
368
|
+
:transaction_date => '2015-05-15T00:00:00Z',
|
366
369
|
:transaction_reference_id => nil,
|
370
|
+
:customer_id => nil,
|
371
|
+
:exemption_type => nil,
|
367
372
|
:from_country => 'US',
|
368
|
-
:from_zip =>
|
373
|
+
:from_zip => '94025',
|
369
374
|
:from_state => 'CA',
|
370
|
-
:from_city => '
|
371
|
-
:from_street => '
|
375
|
+
:from_city => 'MENLO PARK',
|
376
|
+
:from_street => '2825 Sand Hill Rd',
|
372
377
|
:to_country => 'US',
|
373
|
-
:to_zip =>
|
378
|
+
:to_zip => '94303',
|
374
379
|
:to_state => 'CA',
|
375
|
-
:to_city => '
|
376
|
-
:to_street => '
|
377
|
-
:amount =>
|
378
|
-
:shipping =>
|
379
|
-
:sales_tax => 0
|
380
|
+
:to_city => 'PALO ALTO',
|
381
|
+
:to_street => '5230 Newell Rd',
|
382
|
+
:amount => 267.9,
|
383
|
+
:shipping => 0,
|
384
|
+
:sales_tax => 0,
|
380
385
|
:line_items => [
|
381
386
|
{
|
382
387
|
:id => '1',
|
383
388
|
:quantity => 1,
|
384
|
-
:product_identifier =>
|
385
|
-
:product_tax_code =>
|
386
|
-
:description => '
|
387
|
-
:unit_price =>
|
388
|
-
:discount =>
|
389
|
-
:sales_tax => 0
|
389
|
+
:product_identifier => nil,
|
390
|
+
:product_tax_code => '19005',
|
391
|
+
:description => 'Legal Services',
|
392
|
+
:unit_price => 535.8,
|
393
|
+
:discount => 267.9,
|
394
|
+
:sales_tax => 0
|
390
395
|
}
|
391
396
|
]
|
392
397
|
}>
|
393
398
|
```
|
394
399
|
|
395
|
-
### Update order transaction
|
400
|
+
### Update order transaction <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#put-update-an-order-transaction))_</small>
|
401
|
+
|
402
|
+
> Updates an existing order transaction created through the API.
|
396
403
|
|
397
404
|
#### Definition
|
398
405
|
|
@@ -408,14 +415,28 @@ client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
|
408
415
|
|
409
416
|
order = client.update_order({
|
410
417
|
:transaction_id => '123',
|
411
|
-
:amount =>
|
412
|
-
:shipping =>
|
413
|
-
:
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
418
|
+
:amount => 283.6,
|
419
|
+
:shipping => 5,
|
420
|
+
:sales_tax => 1.04,
|
421
|
+
:line_items => [
|
422
|
+
{
|
423
|
+
:id => '1',
|
424
|
+
:quantity => 1,
|
425
|
+
:description => 'Legal Services',
|
426
|
+
:product_tax_code => '19005',
|
427
|
+
:unit_price => 535.8,
|
428
|
+
:discount => 267.9,
|
429
|
+
:sales_tax => 0
|
430
|
+
},
|
431
|
+
{
|
432
|
+
:id => '2',
|
433
|
+
:quantity => 2,
|
434
|
+
:description => 'Hoberman Switch Pitch',
|
435
|
+
:unit_price => 10.7,
|
436
|
+
:discount => 10.7,
|
437
|
+
:sales_tax => 1.04
|
438
|
+
}
|
439
|
+
]
|
419
440
|
})
|
420
441
|
```
|
421
442
|
|
@@ -425,37 +446,52 @@ order = client.update_order({
|
|
425
446
|
#<Taxjar::Order:0x00000a @attrs={
|
426
447
|
:transaction_id => '123',
|
427
448
|
:user_id => 11836,
|
428
|
-
:
|
449
|
+
:provider => 'api',
|
450
|
+
:transaction_date => '2015-05-15T00:00:00Z',
|
429
451
|
:transaction_reference_id => nil,
|
452
|
+
:customer_id => nil,
|
453
|
+
:exemption_type => nil,
|
430
454
|
:from_country => 'US',
|
431
|
-
:from_zip =>
|
455
|
+
:from_zip => '94025',
|
432
456
|
:from_state => 'CA',
|
433
|
-
:from_city => '
|
434
|
-
:from_street => '
|
457
|
+
:from_city => 'MENLO PARK',
|
458
|
+
:from_street => '2825 Sand Hill Rd',
|
435
459
|
:to_country => 'US',
|
436
|
-
:to_zip =>
|
460
|
+
:to_zip => '94303',
|
437
461
|
:to_state => 'CA',
|
438
|
-
:to_city => '
|
439
|
-
:to_street => '
|
440
|
-
:amount =>
|
441
|
-
:shipping =>
|
442
|
-
:sales_tax =>
|
462
|
+
:to_city => 'PALO ALTO',
|
463
|
+
:to_street => '5230 Newell Road',
|
464
|
+
:amount => 283.6,
|
465
|
+
:shipping => 5,
|
466
|
+
:sales_tax => 1.04,
|
443
467
|
:line_items => [
|
444
468
|
{
|
445
469
|
:id => '1',
|
446
470
|
:quantity => 1,
|
447
|
-
:product_identifier =>
|
471
|
+
:product_identifier => nil,
|
472
|
+
:product_tax_code => '19005',
|
473
|
+
:description => 'Legal Services',
|
474
|
+
:unit_price => 535.8,
|
475
|
+
:discount => 267.9,
|
476
|
+
:sales_tax => 0
|
477
|
+
},
|
478
|
+
{
|
479
|
+
:id => '2',
|
480
|
+
:quantity => 2,
|
481
|
+
:product_identifier => nil,
|
448
482
|
:product_tax_code => nil,
|
449
|
-
:description => '
|
450
|
-
:unit_price =>
|
451
|
-
:discount =>
|
452
|
-
:sales_tax =>
|
483
|
+
:description => 'Hoberman Switch Pitch',
|
484
|
+
:unit_price => 10.7,
|
485
|
+
:discount => 10.7,
|
486
|
+
:sales_tax => 1.04
|
453
487
|
}
|
454
488
|
]
|
455
489
|
}>
|
456
490
|
```
|
457
491
|
|
458
|
-
### Delete order transaction
|
492
|
+
### Delete order transaction <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#delete-delete-an-order-transaction))_</small>
|
493
|
+
|
494
|
+
> Deletes an existing order transaction created through the API.
|
459
495
|
|
460
496
|
#### Definition
|
461
497
|
|
@@ -478,37 +514,31 @@ client.delete_order('123')
|
|
478
514
|
#<Taxjar::Order:0x00000a @attrs={
|
479
515
|
:transaction_id => '123',
|
480
516
|
:user_id => 11836,
|
481
|
-
:
|
517
|
+
:provider => 'api',
|
518
|
+
:transaction_date => nil,
|
482
519
|
:transaction_reference_id => nil,
|
483
|
-
:
|
484
|
-
:
|
485
|
-
:
|
486
|
-
:
|
487
|
-
:
|
488
|
-
:
|
489
|
-
:
|
490
|
-
:
|
491
|
-
:
|
492
|
-
:
|
493
|
-
:
|
494
|
-
:
|
495
|
-
:
|
496
|
-
:
|
497
|
-
|
498
|
-
|
499
|
-
:quantity => 1,
|
500
|
-
:product_identifier => '12-34243-0',
|
501
|
-
:product_tax_code => nil,
|
502
|
-
:description => 'Heavy Widget',
|
503
|
-
:unit_price => 15,
|
504
|
-
:discount => 0,
|
505
|
-
:sales_tax => 0.95
|
506
|
-
}
|
507
|
-
]
|
520
|
+
:customer_id => nil,
|
521
|
+
:exemption_type => nil,
|
522
|
+
:from_country => nil,
|
523
|
+
:from_zip => nil,
|
524
|
+
:from_state => nil,
|
525
|
+
:from_city => nil,
|
526
|
+
:from_street => nil,
|
527
|
+
:to_country => nil,
|
528
|
+
:to_zip => nil,
|
529
|
+
:to_state => nil,
|
530
|
+
:to_city => nil,
|
531
|
+
:to_street => nil,
|
532
|
+
:amount => nil,
|
533
|
+
:shipping => nil,
|
534
|
+
:sales_tax => nil,
|
535
|
+
:line_items => []
|
508
536
|
}>
|
509
537
|
```
|
510
538
|
|
511
|
-
###
|
539
|
+
### List refund transactions <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-list-refund-transactions))_</small>
|
540
|
+
|
541
|
+
> Lists existing refund transactions created through the API.
|
512
542
|
|
513
543
|
#### Definition
|
514
544
|
|
@@ -522,17 +552,19 @@ client.list_refunds
|
|
522
552
|
require 'taxjar'
|
523
553
|
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
524
554
|
|
525
|
-
client.list_refunds({:from_transaction_date => '
|
526
|
-
:to_transaction_date => '2015/05/
|
555
|
+
client.list_refunds({:from_transaction_date => '2015/05/01',
|
556
|
+
:to_transaction_date => '2015/05/31'})
|
527
557
|
```
|
528
558
|
|
529
559
|
#### Example Response
|
530
560
|
|
531
561
|
```ruby
|
532
|
-
['
|
562
|
+
['20-refund', '21-refund', '22-refund']
|
533
563
|
```
|
534
564
|
|
535
|
-
### Show refund transaction
|
565
|
+
### Show refund transaction <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-show-a-refund-transaction))_</small>
|
566
|
+
|
567
|
+
> Shows an existing refund transaction created through the API.
|
536
568
|
|
537
569
|
#### Definition
|
538
570
|
|
@@ -546,30 +578,33 @@ client.show_refund
|
|
546
578
|
require 'taxjar'
|
547
579
|
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
548
580
|
|
549
|
-
client.show_refund('
|
581
|
+
client.show_refund('20-refund')
|
550
582
|
```
|
551
583
|
|
552
584
|
#### Example Response
|
553
585
|
|
554
586
|
```ruby
|
555
587
|
#<Taxjar::Refund:0x00000a @attrs={
|
556
|
-
:transaction_id => '
|
588
|
+
:transaction_id => '20-refund',
|
557
589
|
:user_id => 11836,
|
558
|
-
:
|
559
|
-
:
|
590
|
+
:provider => 'api',
|
591
|
+
:transaction_date => '2015-05-15T00:00:00Z',
|
592
|
+
:transaction_reference_id => '20',
|
593
|
+
:customer_id => nil,
|
594
|
+
:exemption_type => nil,
|
560
595
|
:from_country => 'US',
|
561
|
-
:from_zip => 93107,
|
596
|
+
:from_zip => '93107',
|
562
597
|
:from_state => 'CA',
|
563
598
|
:from_city => 'SANTA BARBARA',
|
564
599
|
:from_street => '1218 State St',
|
565
600
|
:to_country => 'US',
|
566
|
-
:to_zip => 90002,
|
601
|
+
:to_zip => '90002',
|
567
602
|
:to_state => 'CA',
|
568
603
|
:to_city => 'LOS ANGELES',
|
569
604
|
:to_street => '123 Palm Grove Ln',
|
570
|
-
:amount => 17,
|
571
|
-
:shipping => 2,
|
572
|
-
:sales_tax => 0.95,
|
605
|
+
:amount => -17,
|
606
|
+
:shipping => -2,
|
607
|
+
:sales_tax => -0.95,
|
573
608
|
:line_items => [
|
574
609
|
{
|
575
610
|
:id => '1',
|
@@ -577,15 +612,17 @@ client.show_refund('321')
|
|
577
612
|
:product_identifier => '12-34243-0',
|
578
613
|
:product_tax_code => nil,
|
579
614
|
:description => 'Heavy Widget',
|
580
|
-
:unit_price => 15,
|
615
|
+
:unit_price => -15,
|
581
616
|
:discount => 0,
|
582
|
-
:sales_tax => 0.95
|
617
|
+
:sales_tax => -0.95
|
583
618
|
}
|
584
619
|
]
|
585
620
|
}>
|
586
621
|
```
|
587
622
|
|
588
|
-
### Create refund transaction
|
623
|
+
### Create refund transaction <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#post-create-a-refund-transaction))_</small>
|
624
|
+
|
625
|
+
> Creates a new refund transaction.
|
589
626
|
|
590
627
|
#### Definition
|
591
628
|
|
@@ -600,27 +637,41 @@ require 'taxjar'
|
|
600
637
|
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
601
638
|
|
602
639
|
refund = client.create_refund({
|
603
|
-
:transaction_id => '
|
604
|
-
:transaction_date => '2015/05/14',
|
640
|
+
:transaction_id => '123-refund',
|
605
641
|
:transaction_reference_id => '123',
|
642
|
+
:transaction_date => '2015/05/15',
|
606
643
|
:from_country => 'US',
|
607
|
-
:from_zip => '
|
644
|
+
:from_zip => '94025',
|
608
645
|
:from_state => 'CA',
|
609
|
-
:from_city => '
|
610
|
-
:from_street => '
|
646
|
+
:from_city => 'Menlo Park',
|
647
|
+
:from_street => '2825 Sand Hill Rd',
|
611
648
|
:to_country => 'US',
|
612
|
-
:to_zip => '
|
649
|
+
:to_zip => '94303',
|
613
650
|
:to_state => 'CA',
|
614
|
-
:to_city => '
|
615
|
-
:to_street => '
|
616
|
-
:amount =>
|
617
|
-
:shipping =>
|
618
|
-
:sales_tax => 0.
|
619
|
-
:line_items => [
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
651
|
+
:to_city => 'Palo Alto',
|
652
|
+
:to_street => '5230 Newell Road',
|
653
|
+
:amount => -5.35,
|
654
|
+
:shipping => -0,
|
655
|
+
:sales_tax => -0.52,
|
656
|
+
:line_items => [
|
657
|
+
{
|
658
|
+
:id => '1',
|
659
|
+
:quantity => 1,
|
660
|
+
:description => 'Legal Services',
|
661
|
+
:product_tax_code => '19005',
|
662
|
+
:unit_price => -0,
|
663
|
+
:discount => -0,
|
664
|
+
:sales_tax => -0
|
665
|
+
},
|
666
|
+
{
|
667
|
+
:id => '2',
|
668
|
+
:quantity => 1,
|
669
|
+
:description => 'Hoberman Switch Pitch',
|
670
|
+
:unit_price => -0,
|
671
|
+
:discount => -5.35,
|
672
|
+
:sales_tax => -0.52
|
673
|
+
}
|
674
|
+
]
|
624
675
|
})
|
625
676
|
```
|
626
677
|
|
@@ -628,39 +679,54 @@ refund = client.create_refund({
|
|
628
679
|
|
629
680
|
```ruby
|
630
681
|
#<Taxjar::Refund:0x00000a @attrs={
|
631
|
-
:transaction_id => '
|
682
|
+
:transaction_id => '123-refund',
|
632
683
|
:user_id => 11836,
|
633
|
-
:
|
684
|
+
:provider => 'api',
|
685
|
+
:transaction_date => '2015-05-15T00:00:00Z',
|
634
686
|
:transaction_reference_id => '123',
|
687
|
+
:customer_id => nil,
|
688
|
+
:exemption_type => nil,
|
635
689
|
:from_country => 'US',
|
636
|
-
:from_zip =>
|
690
|
+
:from_zip => '94025',
|
637
691
|
:from_state => 'CA',
|
638
|
-
:from_city => '
|
639
|
-
:from_street => '
|
692
|
+
:from_city => 'MENLO PARK',
|
693
|
+
:from_street => '2825 Sand Hill Rd',
|
640
694
|
:to_country => 'US',
|
641
|
-
:to_zip =>
|
695
|
+
:to_zip => '94303',
|
642
696
|
:to_state => 'CA',
|
643
|
-
:to_city => '
|
644
|
-
:to_street => '
|
645
|
-
:amount =>
|
646
|
-
:shipping =>
|
647
|
-
:sales_tax => 0.
|
697
|
+
:to_city => 'PALO ALTO',
|
698
|
+
:to_street => '5230 Newell Road',
|
699
|
+
:amount => -5.35,
|
700
|
+
:shipping => -0,
|
701
|
+
:sales_tax => -0.52,
|
648
702
|
:line_items => [
|
649
703
|
{
|
650
704
|
:id => '1',
|
651
705
|
:quantity => 1,
|
652
|
-
:product_identifier =>
|
653
|
-
:product_tax_code =>
|
654
|
-
:description => '
|
655
|
-
:unit_price =>
|
706
|
+
:product_identifier => nil,
|
707
|
+
:product_tax_code => '19005',
|
708
|
+
:description => 'Legal Services',
|
709
|
+
:unit_price => 0,
|
656
710
|
:discount => 0,
|
657
|
-
:sales_tax => 0
|
711
|
+
:sales_tax => 0
|
712
|
+
},
|
713
|
+
{
|
714
|
+
:id => '2',
|
715
|
+
:quantity => 1,
|
716
|
+
:product_identifier => nil,
|
717
|
+
:product_tax_code => nil,
|
718
|
+
:description => 'Hoberman Switch Pitch',
|
719
|
+
:unit_price => 0,
|
720
|
+
:discount => -5.35,
|
721
|
+
:sales_tax => -0.52
|
658
722
|
}
|
659
723
|
]
|
660
724
|
}>
|
661
725
|
```
|
662
726
|
|
663
|
-
### Update refund transaction
|
727
|
+
### Update refund transaction <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#put-update-a-refund-transaction))_</small>
|
728
|
+
|
729
|
+
> Updates an existing refund transaction created through the API.
|
664
730
|
|
665
731
|
#### Definition
|
666
732
|
|
@@ -675,15 +741,10 @@ require 'taxjar'
|
|
675
741
|
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
676
742
|
|
677
743
|
refund = client.update_refund({
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
:line_items => [{:quantity => 1,
|
683
|
-
:product_identifier => '12-34243-9',
|
684
|
-
:description => 'Heavy Widget',
|
685
|
-
:unit_price => 15,
|
686
|
-
:sales_tax => 0.95}]
|
744
|
+
:transaction_id => '123-refund',
|
745
|
+
:transaction_reference_id => '123',
|
746
|
+
:amount => -10.35,
|
747
|
+
:shipping => -5
|
687
748
|
})
|
688
749
|
```
|
689
750
|
|
@@ -691,39 +752,54 @@ refund = client.update_refund({
|
|
691
752
|
|
692
753
|
```ruby
|
693
754
|
#<Taxjar::Refund:0x00000a @attrs={
|
694
|
-
:transaction_id => '
|
755
|
+
:transaction_id => '123-refund',
|
695
756
|
:user_id => 11836,
|
696
|
-
:
|
757
|
+
:provider => 'api',
|
758
|
+
:transaction_date => '2015-05-15T00:00:00Z',
|
697
759
|
:transaction_reference_id => '123',
|
760
|
+
:customer_id => nil,
|
761
|
+
:exemption_type => nil,
|
698
762
|
:from_country => 'US',
|
699
|
-
:from_zip =>
|
763
|
+
:from_zip => '94025',
|
700
764
|
:from_state => 'CA',
|
701
|
-
:from_city => '
|
702
|
-
:from_street => '
|
765
|
+
:from_city => 'MENLO PARK',
|
766
|
+
:from_street => '2825 Sand Hill Rd',
|
703
767
|
:to_country => 'US',
|
704
|
-
:to_zip =>
|
768
|
+
:to_zip => '94303',
|
705
769
|
:to_state => 'CA',
|
706
|
-
:to_city => '
|
707
|
-
:to_street => '
|
708
|
-
:amount =>
|
709
|
-
:shipping =>
|
710
|
-
:sales_tax => 0
|
770
|
+
:to_city => 'PALO ALTO',
|
771
|
+
:to_street => '5230 Newell Road',
|
772
|
+
:amount => -10.35,
|
773
|
+
:shipping => -5,
|
774
|
+
:sales_tax => 0,
|
711
775
|
:line_items => [
|
712
776
|
{
|
713
777
|
:id => '1',
|
714
778
|
:quantity => 1,
|
715
|
-
:product_identifier =>
|
716
|
-
:product_tax_code =>
|
717
|
-
:description => '
|
718
|
-
:unit_price =>
|
779
|
+
:product_identifier => nil,
|
780
|
+
:product_tax_code => '19005',
|
781
|
+
:description => 'Legal Services',
|
782
|
+
:unit_price => 0,
|
719
783
|
:discount => 0,
|
720
|
-
:sales_tax => 0
|
784
|
+
:sales_tax => 0
|
785
|
+
},
|
786
|
+
{
|
787
|
+
:id => '2',
|
788
|
+
:quantity => 1,
|
789
|
+
:product_identifier => nil,
|
790
|
+
:product_tax_code => nil,
|
791
|
+
:description => 'Hoberman Switch Pitch',
|
792
|
+
:unit_price => 0,
|
793
|
+
:discount => -5.35,
|
794
|
+
:sales_tax => -0.52
|
721
795
|
}
|
722
796
|
]
|
723
797
|
}>
|
724
798
|
```
|
725
799
|
|
726
|
-
### Delete refund transaction
|
800
|
+
### Delete refund transaction <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#delete-delete-a-refund-transaction))_</small>
|
801
|
+
|
802
|
+
> Deletes an existing refund transaction created through the API.
|
727
803
|
|
728
804
|
#### Definition
|
729
805
|
|
@@ -737,46 +813,40 @@ client.delete_refund
|
|
737
813
|
require 'taxjar'
|
738
814
|
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
739
815
|
|
740
|
-
client.delete_refund('
|
816
|
+
client.delete_refund('123-refund')
|
741
817
|
```
|
742
818
|
|
743
819
|
#### Example Response
|
744
820
|
|
745
821
|
```ruby
|
746
822
|
#<Taxjar::Refund:0x00000a @attrs={
|
747
|
-
:transaction_id => '
|
823
|
+
:transaction_id => '123-refund',
|
748
824
|
:user_id => 11836,
|
749
|
-
:
|
750
|
-
:
|
751
|
-
:
|
752
|
-
:
|
753
|
-
:
|
754
|
-
:
|
755
|
-
:
|
756
|
-
:
|
757
|
-
:
|
758
|
-
:
|
759
|
-
:
|
760
|
-
:
|
761
|
-
:
|
762
|
-
:
|
763
|
-
:
|
764
|
-
:
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
:product_identifier => '12-34243-9',
|
769
|
-
:product_tax_code => nil,
|
770
|
-
:description => 'Heavy Widget',
|
771
|
-
:unit_price => 15,
|
772
|
-
:discount => 0,
|
773
|
-
:sales_tax => 0.95
|
774
|
-
}
|
775
|
-
]
|
825
|
+
:provider => 'api',
|
826
|
+
:transaction_date => nil,
|
827
|
+
:transaction_reference_id => nil,
|
828
|
+
:customer_id => nil,
|
829
|
+
:exemption_type => nil,
|
830
|
+
:from_country => nil,
|
831
|
+
:from_zip => nil,
|
832
|
+
:from_state => nil,
|
833
|
+
:from_city => nil,
|
834
|
+
:from_street => nil,
|
835
|
+
:to_country => nil,
|
836
|
+
:to_zip => nil,
|
837
|
+
:to_state => nil,
|
838
|
+
:to_city => nil,
|
839
|
+
:to_street => nil,
|
840
|
+
:amount => nil,
|
841
|
+
:shipping => nil,
|
842
|
+
:sales_tax => nil,
|
843
|
+
:line_items => []
|
776
844
|
}>
|
777
845
|
```
|
778
846
|
|
779
|
-
### List customers
|
847
|
+
### List customers <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-list-customers))_</small>
|
848
|
+
|
849
|
+
> Lists existing customers created through the API.
|
780
850
|
|
781
851
|
#### Definition
|
782
852
|
|
@@ -799,7 +869,9 @@ client.list_customers
|
|
799
869
|
['123', '124', '125']
|
800
870
|
```
|
801
871
|
|
802
|
-
### Show customer
|
872
|
+
### Show customer <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-show-a-customer))_</small>
|
873
|
+
|
874
|
+
> Shows an existing customer created through the API.
|
803
875
|
|
804
876
|
#### Definition
|
805
877
|
|
@@ -841,7 +913,9 @@ client.show_customer('123')
|
|
841
913
|
}>
|
842
914
|
```
|
843
915
|
|
844
|
-
### Create customer
|
916
|
+
### Create customer <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#post-create-a-customer))_</small>
|
917
|
+
|
918
|
+
> Creates a new customer.
|
845
919
|
|
846
920
|
#### Definition
|
847
921
|
|
@@ -902,7 +976,9 @@ customer = client.create_customer({
|
|
902
976
|
}>
|
903
977
|
```
|
904
978
|
|
905
|
-
### Update customer
|
979
|
+
### Update customer <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#put-update-a-customer))_</small>
|
980
|
+
|
981
|
+
> Updates an existing customer created through the API.
|
906
982
|
|
907
983
|
#### Definition
|
908
984
|
|
@@ -955,7 +1031,9 @@ customer = client.update_customer({
|
|
955
1031
|
}>
|
956
1032
|
```
|
957
1033
|
|
958
|
-
### Delete customer
|
1034
|
+
### Delete customer <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#delete-delete-a-customer))_</small>
|
1035
|
+
|
1036
|
+
> Deletes an existing customer created through the API.
|
959
1037
|
|
960
1038
|
#### Definition
|
961
1039
|
|
@@ -978,16 +1056,7 @@ client.delete_customer('123')
|
|
978
1056
|
#<Taxjar::Customer @attrs={
|
979
1057
|
:customer_id => "123",
|
980
1058
|
:exemption_type => "wholesale",
|
981
|
-
:exempt_regions => [
|
982
|
-
[0] {
|
983
|
-
:country => "US",
|
984
|
-
:state => "FL"
|
985
|
-
},
|
986
|
-
[1] {
|
987
|
-
:country => "US",
|
988
|
-
:state => "PA"
|
989
|
-
}
|
990
|
-
],
|
1059
|
+
:exempt_regions => [],
|
991
1060
|
:name => "Dunder Mifflin Paper Company",
|
992
1061
|
:country => "US",
|
993
1062
|
:state => "PA",
|
@@ -997,7 +1066,85 @@ client.delete_customer('123')
|
|
997
1066
|
}>
|
998
1067
|
```
|
999
1068
|
|
1000
|
-
### List
|
1069
|
+
### List tax rates for a location (by zip/postal code) <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-show-tax-rates-for-a-location))_</small>
|
1070
|
+
|
1071
|
+
> Shows the sales tax rates for a given location.
|
1072
|
+
>
|
1073
|
+
> **Please note this method only returns the full combined rate for a given location.** It does not support nexus determination, sourcing based on a ship from and ship to address, shipping taxability, product exemptions, customer exemptions, or sales tax holidays. We recommend using [`tax_for_order` to accurately calculate sales tax for an order](#calculate-sales-tax-for-an-order-api-docs).
|
1074
|
+
|
1075
|
+
#### Definition
|
1076
|
+
|
1077
|
+
```ruby
|
1078
|
+
client.rates_for_location
|
1079
|
+
```
|
1080
|
+
|
1081
|
+
#### Example Request
|
1082
|
+
|
1083
|
+
```ruby
|
1084
|
+
require 'taxjar'
|
1085
|
+
client = Taxjar::Client.new(api_key: '48ceecccc8af930bd02597aec0f84a78')
|
1086
|
+
|
1087
|
+
# United States (ZIP+4)
|
1088
|
+
rates = client.rates_for_location('90404-3370')
|
1089
|
+
|
1090
|
+
# United States (ZIP w/ Optional Params)
|
1091
|
+
rates = client.rates_for_location('90404', {
|
1092
|
+
:city => 'SANTA MONICA',
|
1093
|
+
:country => 'US'
|
1094
|
+
})
|
1095
|
+
|
1096
|
+
# International Examples (Requires City and Country)
|
1097
|
+
rates = client.rates_for_location('V5K0A1', {
|
1098
|
+
:city => 'VANCOUVER',
|
1099
|
+
:country => 'CA'
|
1100
|
+
})
|
1101
|
+
|
1102
|
+
rates = client.rates_for_location('00150', {
|
1103
|
+
:city => 'HELSINKI',
|
1104
|
+
:country => 'FI'
|
1105
|
+
})
|
1106
|
+
```
|
1107
|
+
|
1108
|
+
#### Example Response
|
1109
|
+
|
1110
|
+
```ruby
|
1111
|
+
#<Taxjar::Rate:0x00000a @attrs={
|
1112
|
+
:zip => '90002',
|
1113
|
+
:state => 'CA',
|
1114
|
+
:state_rate => 0.065,
|
1115
|
+
:county => 'LOS ANGELES',
|
1116
|
+
:county_rate => 0.01,
|
1117
|
+
:city => 'WATTS',
|
1118
|
+
:city_rate => 0,
|
1119
|
+
:combined_district_rate => 0.015,
|
1120
|
+
:combined_rate => 0.09,
|
1121
|
+
:freight_taxable => false
|
1122
|
+
}>
|
1123
|
+
|
1124
|
+
#<Taxjar::Rate:0x00000a @attrs={
|
1125
|
+
:zip => 'V5K0A1',
|
1126
|
+
:city => 'Vancouver',
|
1127
|
+
:state => 'BC',
|
1128
|
+
:country => 'CA',
|
1129
|
+
:combined_rate => 0.12,
|
1130
|
+
:freight_taxable => true
|
1131
|
+
}>
|
1132
|
+
|
1133
|
+
#<Taxjar::Rate:0x00000a @attrs={
|
1134
|
+
:country => 'FI',
|
1135
|
+
:name => 'Finland',
|
1136
|
+
:standard_rate => 0.24,
|
1137
|
+
:reduced_rate => nil,
|
1138
|
+
:super_reduced_rate => nil,
|
1139
|
+
:parking_rate => nil,
|
1140
|
+
:distance_sale_threshold => nil,
|
1141
|
+
:freight_taxable => true
|
1142
|
+
}>
|
1143
|
+
```
|
1144
|
+
|
1145
|
+
### List nexus regions <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-list-nexus-regions))_</small>
|
1146
|
+
|
1147
|
+
> Lists existing nexus locations for a TaxJar account.
|
1001
1148
|
|
1002
1149
|
#### Definition
|
1003
1150
|
|
@@ -1039,7 +1186,48 @@ nexus_regions = client.nexus_regions
|
|
1039
1186
|
]
|
1040
1187
|
```
|
1041
1188
|
|
1042
|
-
### Validate
|
1189
|
+
### Validate an address <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#post-validate-an-address))_</small>
|
1190
|
+
|
1191
|
+
> Validates a customer address and returns back a collection of address matches. **Address validation requires a [TaxJar Plus](https://www.taxjar.com/plus/) subscription.**
|
1192
|
+
|
1193
|
+
#### Definition
|
1194
|
+
|
1195
|
+
```ruby
|
1196
|
+
client.validate_address
|
1197
|
+
```
|
1198
|
+
|
1199
|
+
#### Example Request
|
1200
|
+
|
1201
|
+
```ruby
|
1202
|
+
require 'taxjar'
|
1203
|
+
client = Taxjar::Client.new(api_key: '9e0cd62a22f451701f29c3bde214')
|
1204
|
+
|
1205
|
+
addresses = client.validate_address({
|
1206
|
+
:country => 'US',
|
1207
|
+
:state => 'AZ',
|
1208
|
+
:zip => '85297',
|
1209
|
+
:city => 'Gilbert',
|
1210
|
+
:street => '3301 Greenfield Rd'
|
1211
|
+
})
|
1212
|
+
```
|
1213
|
+
|
1214
|
+
#### Example Response
|
1215
|
+
|
1216
|
+
```ruby
|
1217
|
+
[
|
1218
|
+
#<Taxjar::Address:0x00000a @attrs={
|
1219
|
+
:zip => '85297-2176',
|
1220
|
+
:street => '3301 S Greenfield Rd',
|
1221
|
+
:state => 'AZ',
|
1222
|
+
:country => 'US',
|
1223
|
+
:city => 'Gilbert'
|
1224
|
+
}>
|
1225
|
+
]
|
1226
|
+
```
|
1227
|
+
|
1228
|
+
### Validate a VAT number <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-validate-a-vat-number))_</small>
|
1229
|
+
|
1230
|
+
> Validates an existing VAT identification number against [VIES](http://ec.europa.eu/taxation_customs/vies/).
|
1043
1231
|
|
1044
1232
|
#### Definition
|
1045
1233
|
|
@@ -1076,7 +1264,11 @@ validation = client.validate({
|
|
1076
1264
|
}>
|
1077
1265
|
```
|
1078
1266
|
|
1079
|
-
### Summarize tax rates for all regions
|
1267
|
+
### Summarize tax rates for all regions <small>_([API docs](https://developers.taxjar.com/api/reference/?ruby#get-summarize-tax-rates-for-all-regions))_</small>
|
1268
|
+
|
1269
|
+
> Retrieve minimum and average sales tax rates by region as a backup.
|
1270
|
+
>
|
1271
|
+
> This method is useful for periodically pulling down rates to use if the TaxJar API is unavailable. However, it does not support nexus determination, sourcing based on a ship from and ship to address, shipping taxability, product exemptions, customer exemptions, or sales tax holidays. We recommend using [`tax_for_order` to accurately calculate sales tax for an order](#calculate-sales-tax-for-an-order-api-docs).
|
1080
1272
|
|
1081
1273
|
#### Definition
|
1082
1274
|
|
@@ -1156,7 +1348,7 @@ client.tax_for_order({ timeout: 30 })
|
|
1156
1348
|
|
1157
1349
|
## Sandbox Environment
|
1158
1350
|
|
1159
|
-
You can easily configure the client to use the [TaxJar Sandbox](https://developers.taxjar.com/api/reference
|
1351
|
+
You can easily configure the client to use the [TaxJar Sandbox](https://developers.taxjar.com/api/reference/?ruby#sandbox-environment):
|
1160
1352
|
|
1161
1353
|
```ruby
|
1162
1354
|
require 'taxjar'
|
@@ -1208,7 +1400,7 @@ $ rspec
|
|
1208
1400
|
|
1209
1401
|
## More Information
|
1210
1402
|
|
1211
|
-
More information can be found on [TaxJar Developers](
|
1403
|
+
More information can be found on [TaxJar Developers](https://developers.taxjar.com).
|
1212
1404
|
|
1213
1405
|
## License
|
1214
1406
|
|