blockchyp 1.24.14 → 2.0.0.pre.alpha7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +1 -41
- data/README.md +441 -3551
- data/lib/blockchyp/version.rb +1 -1
- data/lib/blockchyp.rb +41 -366
- data/lib/blockchyp_client.rb +125 -207
- data/test/boolean_prompt_test.rb +18 -32
- data/test/heartbeat_test.rb +10 -10
- data/test/new_transaction_display_test.rb +50 -44
- data/test/pan_charge_test.rb +27 -44
- data/test/pan_enroll_test.rb +25 -45
- data/test/pan_preauth_test.rb +26 -43
- data/test/simple_batch_close_test.rb +23 -37
- data/test/simple_capture_test.rb +21 -38
- data/test/simple_gift_activate_test.rb +15 -30
- data/test/simple_message_test.rb +15 -29
- data/test/simple_ping_test.rb +14 -28
- data/test/simple_refund_test.rb +22 -40
- data/test/simple_reversal_test.rb +22 -39
- data/test/simple_void_test.rb +22 -39
- data/test/terminal_charge_test.rb +25 -40
- data/test/terminal_clear_test.rb +14 -28
- data/test/terminal_ebt_balance_test.rb +16 -30
- data/test/terminal_ebt_charge_test.rb +27 -42
- data/test/terminal_enroll_test.rb +24 -39
- data/test/terminal_gift_card_balance_test.rb +15 -29
- data/test/terminal_keyed_charge_test.rb +26 -41
- data/test/terminal_manual_ebt_charge_test.rb +28 -43
- data/test/terminal_preauth_test.rb +25 -40
- data/test/terms_and_conditions_test.rb +19 -33
- data/test/test_helper.rb +10 -9
- data/test/text_prompt_test.rb +15 -29
- data/test/update_transaction_display_test.rb +50 -44
- metadata +5 -64
- data/test/activate_terminal_test.rb +0 -45
- data/test/add_test_merchant_test.rb +0 -56
- data/test/batch_history_test.rb +0 -54
- data/test/cancel_payment_link_test.rb +0 -72
- data/test/capture_signature_test.rb +0 -46
- data/test/deactivate_terminal_test.rb +0 -42
- data/test/delete_branding_asset_test.rb +0 -50
- data/test/delete_customer_test.rb +0 -55
- data/test/delete_media_asset_test.rb +0 -53
- data/test/delete_queued_transaction_test.rb +0 -56
- data/test/delete_slide_show_test.rb +0 -50
- data/test/delete_survey_question_test.rb +0 -51
- data/test/delete_test_merchant_test.rb +0 -59
- data/test/delete_token_test.rb +0 -55
- data/test/empty_branding_asset_test.rb +0 -44
- data/test/empty_slide_show_test.rb +0 -45
- data/test/gateway_timeout_test.rb +0 -49
- data/test/get_customer_test.rb +0 -55
- data/test/get_merchants_test.rb +0 -52
- data/test/invite_merchant_user_test.rb +0 -45
- data/test/link_token_test.rb +0 -56
- data/test/list_queued_transactions_test.rb +0 -55
- data/test/list_terminals_test.rb +0 -42
- data/test/media_asset_test.rb +0 -57
- data/test/media_test.rb +0 -42
- data/test/media_upload_test.rb +0 -52
- data/test/merchant_platforms_test.rb +0 -59
- data/test/merchant_profile_test.rb +0 -43
- data/test/merchant_users_test.rb +0 -42
- data/test/partial_refund_test.rb +0 -58
- data/test/search_customer_test.rb +0 -55
- data/test/send_payment_link_test.rb +0 -67
- data/test/simple_locate_test.rb +0 -44
- data/test/slide_show_test.rb +0 -51
- data/test/slide_shows_test.rb +0 -49
- data/test/survey_question_test.rb +0 -48
- data/test/survey_questions_test.rb +0 -50
- data/test/survey_results_test.rb +0 -48
- data/test/tc_delete_template_test.rb +0 -51
- data/test/tc_entry_test.rb +0 -56
- data/test/tc_log_test.rb +0 -42
- data/test/tc_template_test.rb +0 -53
- data/test/tc_template_update_test.rb +0 -48
- data/test/tc_templates_test.rb +0 -42
- data/test/terminal_branding_test.rb +0 -42
- data/test/terminal_queued_transaction_test.rb +0 -51
- data/test/terminal_status_test.rb +0 -45
- data/test/terminal_timeout_test.rb +0 -46
- data/test/testdata/aviato.png +0 -0
- data/test/token_metadata_test.rb +0 -55
- data/test/transaction_history_test.rb +0 -54
- data/test/unlink_token_test.rb +0 -56
- data/test/update_branding_asset_test.rb +0 -62
- data/test/update_customer_test.rb +0 -49
- data/test/update_merchant_platforms_test.rb +0 -61
- data/test/update_merchant_test.rb +0 -60
- data/test/update_slide_show_test.rb +0 -60
- data/test/update_survey_question_test.rb +0 -47
- data/test/upload_status_test.rb +0 -53
data/README.md
CHANGED
@@ -25,3820 +25,731 @@ to run a basic terminal transaction.
|
|
25
25
|
```ruby
|
26
26
|
require 'blockchyp'
|
27
27
|
|
28
|
-
blockchyp = BlockChyp.new(
|
29
|
-
"SPBXTSDAQVFFX5MGQMUMIRINVI",
|
30
|
-
"7BXBTBUPSL3BP7I6Z2CFU6H3WQ",
|
31
|
-
"bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e"
|
32
|
-
)
|
33
|
-
|
34
|
-
# Set request parameters
|
35
|
-
request = {
|
36
|
-
"test": true,
|
37
|
-
"terminalName": "Test Terminal",
|
38
|
-
"amount": "55.00"
|
39
|
-
}
|
40
|
-
|
41
|
-
response = blockchyp.charge(request)
|
42
|
-
|
43
|
-
if (response["approved"])
|
44
|
-
puts "Approved"
|
45
|
-
puts "authCode:" + response["authCode"]
|
46
|
-
puts "authorizedAmount:" + response["authorizedAmount"]
|
47
|
-
end
|
48
|
-
```
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
## Additional Documentation
|
53
|
-
|
54
|
-
Complete documentation can be found on our [Developer Documentation Portal].
|
55
|
-
|
56
|
-
[Developer Documentation Portal]: https://docs.blockchyp.com/
|
57
|
-
|
58
|
-
## Getting a Developer Kit
|
59
|
-
|
60
|
-
In order to test your integration with real terminals, you'll need a BlockChyp
|
61
|
-
Developer Kit. Our kits include a fully functioning payment terminal with
|
62
|
-
test pin encryption keys. Every kit includes a comprehensive set of test
|
63
|
-
cards with test cards for every major card brand and entry method, including
|
64
|
-
Contactless and Contact EMV and mag stripe cards. Each kit also includes
|
65
|
-
test gift cards for our blockchain gift card system.
|
66
|
-
|
67
|
-
Access to BlockChyp's developer program is currently invite only, but you
|
68
|
-
can request an invitation by contacting our engineering team at **nerds@blockchyp.com**.
|
69
|
-
|
70
|
-
You can also view a number of long form demos and learn more about us on our [YouTube Channel](https://www.youtube.com/channel/UCE-iIVlJic_XArs_U65ZcJg).
|
71
|
-
|
72
|
-
## Transaction Code Examples
|
73
|
-
|
74
|
-
You don't want to read words. You want examples. Here's a quick rundown of the
|
75
|
-
stuff you can do with the BlockChyp Ruby SDK and a few basic examples.
|
76
|
-
|
77
|
-
### Payment Endpoints
|
78
|
-
|
79
|
-
|
80
|
-
These are the core payment APIs used to execute and work with payment transactions in BlockChyp.
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
#### Charge
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
* **API Credential Types:** Merchant
|
89
|
-
* **Required Role:** Payment API Access
|
90
|
-
|
91
|
-
Our most popular transaction executes a standard authorization and capture.
|
92
|
-
This is the most basic of
|
93
|
-
basic payment transactions, typically used in conventional retail.
|
94
|
-
|
95
|
-
Charge transactions can use a payment terminal to capture a payment or
|
96
|
-
use a previously enrolled payment token.
|
97
|
-
|
98
|
-
**Terminal Transactions**
|
99
|
-
|
100
|
-
For terminal transactions, make sure you pass in the terminal name using the `terminalName` property.
|
101
|
-
|
102
|
-
**Token Transactions**
|
103
|
-
|
104
|
-
If you have a payment token, omit the `terminalName` property and pass in the token with the `token`
|
105
|
-
property instead.
|
106
|
-
|
107
|
-
**Card Numbers and Mag Stripes**
|
108
|
-
|
109
|
-
You can also pass in PANs and Mag Stripes, but you probably shouldn't, as this will
|
110
|
-
put you in PCI scope and the most common vector for POS breaches is keylogging.
|
111
|
-
If you use terminals for manual card entry, you'll bypass any keyloggers that
|
112
|
-
might be maliciously running on the point-of-sale system.
|
113
|
-
|
114
|
-
**Common Variations**
|
115
|
-
|
116
|
-
* **Gift Card Redemption**: There's no special API for gift card redemption in BlockChyp. Simply execute a plain charge transaction and if the customer swipes a gift card, our terminals will identify the gift card and run a gift card redemption. Also note that if for some reason the gift card's original purchase transaction is associated with fraud or a chargeback, the transaction will be rejected.
|
117
|
-
* **EBT**: Set the `CardType` field to `CardType::EBT` to process an EBT SNAP transaction. Note that test EBT transactions always assume a balance of $100.00, so test EBT transactions over that amount may be declined.
|
118
|
-
* **Cash Back**: To enable cash back for debit transactions, set the `CashBack` field. If the card presented isn't a debit card, the `CashBack` field will be ignored.
|
119
|
-
* **Manual Card Entry**: Set the `ManualEntry` field to enable manual card entry. Good as a backup when chips and MSR's don't work or for more secure phone orders. You can even combine the `ManualEntry` field with the `CardType` field set to `CardType::EBT` for manual EBT card entry.
|
120
|
-
* **Inline Tokenization**: You can enroll the payment method in the token vault inline with a charge transaction by setting the `Enroll` field. You'll get a token back in the response. You can even bind the token to a customer record if you also pass in customer data.
|
121
|
-
* **Prompting for Tips**: Set the `PromptForTip` field if you'd like to prompt the customer for a tip before authorization. Good for pay-at-the-table and other service related scenarios.
|
122
|
-
* **Cash Discounting and Surcharging**: The `Surcharge` and `CashDiscount` fields can be used together to support cash discounting or surcharge problems. Consult the Cash Discount documentation for more details.
|
123
|
-
* **Cryptocurrency** The `Cryptocurrency` field can be used to switch the standard present card screen to a cryptocurrency screen. The field value can be `ANY` to enable any supported cryptocurrency or a single currency code such as `BTC` for Bitcoin.
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
```ruby
|
128
|
-
# frozen_string_literal: true
|
129
|
-
|
130
|
-
require 'blockchyp'
|
131
|
-
|
132
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
133
|
-
ENV['BC_API_KEY'],
|
134
|
-
ENV['BC_BEARER_TOKEN'],
|
135
|
-
ENV['BC_SIGNING_KEY']
|
136
|
-
)
|
137
|
-
|
138
|
-
# Set request parameters
|
139
|
-
request = {
|
140
|
-
test: true,
|
141
|
-
terminalName: 'Test Terminal',
|
142
|
-
amount: '55.00'
|
143
|
-
}
|
144
|
-
|
145
|
-
response = blockchyp.charge(request)
|
146
|
-
|
147
|
-
puts "Response: #{response.inspect}"
|
148
|
-
|
149
|
-
|
150
|
-
```
|
151
|
-
|
152
|
-
#### Preauthorization
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
* **API Credential Types:** Merchant
|
157
|
-
* **Required Role:** Payment API Access
|
158
|
-
|
159
|
-
A preauthorization puts a hold on funds and must be captured later. This is used
|
160
|
-
in scenarios where the final transaction amount might change. A common example is
|
161
|
-
fine dining, where a tip adjustment is required before final settlement.
|
162
|
-
|
163
|
-
Another use case for preauthorization is e-commerce. Typically, an online order
|
164
|
-
is preauthorized at the time of the order and then captured when the order ships.
|
165
|
-
|
166
|
-
Preauthorizations can use a payment terminal to capture a payment or
|
167
|
-
use a previously enrolled payment token.
|
168
|
-
|
169
|
-
**Terminal Transactions**
|
170
|
-
|
171
|
-
For terminal transactions, make sure you pass in the terminal name using the `terminalName` property.
|
172
|
-
|
173
|
-
**Token Transactions**
|
174
|
-
|
175
|
-
If you have a payment token, omit the `terminalName` property and pass in the token with the `token`
|
176
|
-
property instead.
|
177
|
-
|
178
|
-
**Card Numbers and Mag Stripes**
|
179
|
-
|
180
|
-
You can also pass in PANs and Mag Stripes, but you probably shouldn't, as this will
|
181
|
-
put you in PCI scope and the most common vector for POS breaches is key logging.
|
182
|
-
If you use terminals for manual card entry, you'll bypass any key loggers that
|
183
|
-
might be maliciously running on the point-of-sale system.
|
184
|
-
|
185
|
-
**Cryptocurrency**
|
186
|
-
|
187
|
-
Note that preauths are not supported for cryptocurrency.
|
188
|
-
|
189
|
-
**Common Variations**
|
190
|
-
|
191
|
-
* **Manual Card Entry**: Set the `ManualEntry` field to enable manual card entry. Good as a backup when chips and MSR's don't work or for more secure phone orders. You can even combine the `ManualEntry` field with `CardType` set to `CardType::EBT` for manual EBT card entry.
|
192
|
-
* **Inline Tokenization**: You can enroll the payment method in the token vault in line with a charge transaction by setting the `Enroll` field. You'll get a token back in the response. You can even bind the token to a customer record if you also pass in customer data.
|
193
|
-
* **Prompting for Tips**: Set the `PromptForTip` field if you'd like to prompt the customer for a tip before authorization. You can prompt for tips as part of a preauthorization, although it's not a very common approach.
|
194
|
-
* **Cash Discounting and Surcharging**: The `Surcharge` and `CashDiscount` fields can be used together to support cash discounting or surcharge problems. Consult the Cash Discount documentation for more details.
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
```ruby
|
200
|
-
# frozen_string_literal: true
|
201
|
-
|
202
|
-
require 'blockchyp'
|
203
|
-
|
204
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
205
|
-
ENV['BC_API_KEY'],
|
206
|
-
ENV['BC_BEARER_TOKEN'],
|
207
|
-
ENV['BC_SIGNING_KEY']
|
208
|
-
)
|
209
|
-
|
210
|
-
# Set request parameters
|
211
|
-
request = {
|
212
|
-
test: true,
|
213
|
-
terminalName: 'Test Terminal',
|
214
|
-
amount: '27.00'
|
215
|
-
}
|
216
|
-
|
217
|
-
response = blockchyp.preauth(request)
|
218
|
-
|
219
|
-
puts "Response: #{response.inspect}"
|
220
|
-
|
221
|
-
|
222
|
-
```
|
223
|
-
|
224
|
-
#### Capture Preauthorization
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
* **API Credential Types:** Merchant
|
229
|
-
* **Required Role:** Payment API Access
|
230
|
-
|
231
|
-
This API allows you to capture a previously approved preauthorization.
|
232
|
-
|
233
|
-
You'll need to make sure you pass in the Transaction ID returned by the original preauth transaction
|
234
|
-
so we know which transaction we're capturing. If you want to capture the transaction for the
|
235
|
-
exact amount of the preauth, the Transaction ID is all you need to pass in.
|
236
|
-
|
237
|
-
You can adjust the total if you need to by passing in a new `amount`. We
|
238
|
-
also recommend you pass in updated amounts for `tax` and `tip` as it can
|
239
|
-
sometimes reduce your interchange fees. (Level II Processing, for example.)
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
```ruby
|
245
|
-
# frozen_string_literal: true
|
246
|
-
|
247
|
-
require 'blockchyp'
|
248
|
-
|
249
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
250
|
-
ENV['BC_API_KEY'],
|
251
|
-
ENV['BC_BEARER_TOKEN'],
|
252
|
-
ENV['BC_SIGNING_KEY']
|
253
|
-
)
|
254
|
-
|
255
|
-
# Set request parameters
|
256
|
-
request = {
|
257
|
-
test: true,
|
258
|
-
transactionId: '<ORIGINAL TRANSACTION ID>',
|
259
|
-
amount: '32.00'
|
260
|
-
}
|
261
|
-
|
262
|
-
response = blockchyp.capture(request)
|
263
|
-
|
264
|
-
puts "Response: #{response.inspect}"
|
265
|
-
|
266
|
-
|
267
|
-
```
|
268
|
-
|
269
|
-
#### Refund
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
* **API Credential Types:** Merchant
|
274
|
-
* **Required Role:** Payment API Access
|
275
|
-
|
276
|
-
It's not ideal, but sometimes customers want their money back.
|
277
|
-
|
278
|
-
Our refund API allows you to confront this unpleasant reality by executing refunds in a few different scenarios.
|
279
|
-
|
280
|
-
The most fraud resistent method is to execute refunds in the context of a previous transaction. You should always keep track of the Transaction ID
|
281
|
-
returned in a BlockChyp response. To refund the full amount of the previous transaction, just pass in the original Transaction ID with the refund requests.
|
282
|
-
|
283
|
-
**Partial Refunds**
|
284
|
-
|
285
|
-
For a partial refund, just pass in an amount along with the Transaction ID.
|
286
|
-
The only rule is that the amount must be equal to or less than the original
|
287
|
-
transaction. You can execute multiple partial refunds against the same
|
288
|
-
original transaction as long as the total refunded amount doesn't exceed the original amount.
|
289
|
-
|
290
|
-
**Tokenized Refunds**
|
291
|
-
|
292
|
-
You can also use a token to execute a refund. Pass in a token instead
|
293
|
-
of the Transaction ID and the desired refund amount.
|
294
|
-
|
295
|
-
**Free Range Refunds**
|
296
|
-
|
297
|
-
When you execute a refund without referencing a previous transaction, we
|
298
|
-
call this a *free range refund*.
|
299
|
-
|
300
|
-
We don't recommend this type of refund, but it is permitted. If you absolutely insist on
|
301
|
-
doing it, pass in a Terminal Name and an amount.
|
302
|
-
|
303
|
-
You can execute a manual or keyed refund by passing the `ManualEntry` field
|
304
|
-
to a free range refund request.
|
305
|
-
|
306
|
-
**Gift Card Refunds**
|
307
|
-
|
308
|
-
Gift card refunds are allowed in the context of a previous transaction, but
|
309
|
-
free range gift card refunds are not allowed. Use the gift card activation
|
310
|
-
API if you need to add more funds to a gift card.
|
311
|
-
|
312
|
-
**Store and Forward Support**
|
313
|
-
|
314
|
-
Refunds are not permitted when a terminal falls back to store and forward mode.
|
315
|
-
|
316
|
-
**Auto Voids**
|
317
|
-
|
318
|
-
If a refund referencing a previous transaction is executed for the full amount
|
319
|
-
before the original transaction's batch is closed, the refund is automatically
|
320
|
-
converted to a void. This saves the merchant a little bit of money.
|
321
|
-
|
322
|
-
**Cryptocurrency**
|
323
|
-
|
324
|
-
Note that refunds are not supported for cryptocurrency. You must refund crypto transactions
|
325
|
-
manually from your cryptocurrency wallet.
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
```ruby
|
331
|
-
# frozen_string_literal: true
|
332
|
-
|
333
|
-
require 'blockchyp'
|
334
|
-
|
335
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
336
|
-
ENV['BC_API_KEY'],
|
337
|
-
ENV['BC_BEARER_TOKEN'],
|
338
|
-
ENV['BC_SIGNING_KEY']
|
339
|
-
)
|
340
|
-
|
341
|
-
# Set request parameters
|
342
|
-
request = {
|
343
|
-
transactionId: '<PREVIOUS TRANSACTION ID>',
|
344
|
-
|
345
|
-
# Optional amount for partial refunds.
|
346
|
-
amount: '5.00'
|
347
|
-
}
|
348
|
-
|
349
|
-
response = blockchyp.refund(request)
|
350
|
-
|
351
|
-
puts "Response: #{response.inspect}"
|
352
|
-
|
353
|
-
|
354
|
-
```
|
355
|
-
|
356
|
-
#### Void
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
* **API Credential Types:** Merchant
|
361
|
-
* **Required Role:** Payment API Access
|
362
|
-
|
363
|
-
Mistakes happen. If a transaction is made by mistake, you can void it
|
364
|
-
with this API. All that's needed is to pass in a Transaction ID and execute
|
365
|
-
the void before the original transaction's batch closes.
|
366
|
-
|
367
|
-
Voids work with EBT and gift card transactions with no additional parameters.
|
368
|
-
|
369
|
-
**Cryptocurrency**
|
370
|
-
|
371
|
-
Note that voids are not supported for cryptocurrency. You must refund crypto transactions
|
372
|
-
manually from your cryptocurrency wallet.
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
```ruby
|
378
|
-
# frozen_string_literal: true
|
379
|
-
|
380
|
-
require 'blockchyp'
|
381
|
-
|
382
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
383
|
-
ENV['BC_API_KEY'],
|
384
|
-
ENV['BC_BEARER_TOKEN'],
|
385
|
-
ENV['BC_SIGNING_KEY']
|
386
|
-
)
|
387
|
-
|
388
|
-
# Set request parameters
|
389
|
-
request = {
|
390
|
-
test: true,
|
391
|
-
transactionId: '<PREVIOUS TRANSACTION ID>'
|
392
|
-
}
|
393
|
-
|
394
|
-
response = blockchyp.void(request)
|
395
|
-
|
396
|
-
puts "Response: #{response.inspect}"
|
397
|
-
|
398
|
-
|
399
|
-
```
|
400
|
-
|
401
|
-
#### Time Out Reversal
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
* **API Credential Types:** Merchant
|
406
|
-
* **Required Role:** Payment API Access
|
407
|
-
|
408
|
-
Payment transactions require a stable network to function correctly and
|
409
|
-
no network is stable all the time. Time out reversals are a great line
|
410
|
-
of defense against accidentally double charging consumers when payments
|
411
|
-
are retried during shaky network conditions.
|
412
|
-
|
413
|
-
We highly recommend developers use this API whenever a charge, preauth, or refund transaction times out. If you don't receive a definitive response
|
414
|
-
from BlockChyp, you can't be certain about whether or not the transaction went through.
|
415
|
-
|
416
|
-
The best practice in this situation is to send a time out reversal request. Time out reversals check for a transaction and void it if it exists.
|
417
|
-
|
418
|
-
The only caveat is that developers must use the `transactionRef` property (`txRef` for the CLI) when executing charge, preauth, and refund transactions.
|
419
|
-
|
420
|
-
The reason for this requirement is that if a system never receives a definitive
|
421
|
-
response for a transaction, the system would never have received the BlockChyp
|
422
|
-
generated Transaction ID. We have to fall back to Transaction Ref to identify
|
423
|
-
a transaction.
|
424
|
-
|
425
|
-
**Cryptocurrency**
|
426
|
-
|
427
|
-
Note that refunds are not supported for cryptocurrency. You must refund crypto transactions
|
428
|
-
manually from your cryptocurrency wallet.
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
```ruby
|
434
|
-
# frozen_string_literal: true
|
435
|
-
|
436
|
-
require 'blockchyp'
|
437
|
-
|
438
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
439
|
-
ENV['BC_API_KEY'],
|
440
|
-
ENV['BC_BEARER_TOKEN'],
|
441
|
-
ENV['BC_SIGNING_KEY']
|
442
|
-
)
|
443
|
-
|
444
|
-
# Set request parameters
|
445
|
-
request = {
|
446
|
-
transactionRef: '<LAST TRANSACTION REF>'
|
447
|
-
}
|
448
|
-
|
449
|
-
response = blockchyp.reverse(request)
|
450
|
-
|
451
|
-
puts "Response: #{response.inspect}"
|
452
|
-
|
453
|
-
|
454
|
-
```
|
455
|
-
|
456
|
-
#### Gift Card Activation
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
* **API Credential Types:** Merchant
|
461
|
-
* **Required Role:** Payment API Access
|
462
|
-
|
463
|
-
This API activates or adds value to BlockChyp gift cards.
|
464
|
-
Just pass in the terminal name and the amount to add to the card.
|
465
|
-
Once the customer swipes their card, the terminal will use keys
|
466
|
-
on the mag stripe to add value to the card.
|
467
|
-
|
468
|
-
You don't need to handle a new gift card activation or a gift card recharge any
|
469
|
-
differently. The terminal firmware will figure out what to do on its
|
470
|
-
own while also returning the new balance for the gift card.
|
471
|
-
|
472
|
-
This is the part of the system where BlockChyp's blockchain DNA comes
|
473
|
-
closest to the surface. The BlockChyp gift card system doesn't really
|
474
|
-
use gift card numbers. This means they can't be stolen.
|
475
|
-
|
476
|
-
BlockChyp identifies cards with an elliptic curve public key instead.
|
477
|
-
Gift card transactions are actually blocks signed with those keys.
|
478
|
-
This means there are no shared secrets sent over the network.
|
479
|
-
To keep track of a BlockChyp gift card, hang on to the **public key** returned
|
480
|
-
during gift card activation. That's the gift card's elliptic curve public key.
|
481
|
-
|
482
|
-
We sometimes print numbers on our gift cards, but these are actually
|
483
|
-
decimal encoded hashes of a portion of the public key to make our gift
|
484
|
-
cards seem *normal* to *normies*. They can be used
|
485
|
-
for balance checks and play a lookup role in online gift card
|
486
|
-
authorization, but are of little use beyond that.
|
487
|
-
|
488
|
-
**Voids and Reversals**
|
489
|
-
|
490
|
-
Gift card activations can be voided and reversed just like any other
|
491
|
-
BlockChyp transaction. Use the Transaction ID or Transaction Ref
|
492
|
-
to identify the gift activation transaction as you normally would for
|
493
|
-
voiding or reversing a conventional payment transaction.
|
494
|
-
|
495
|
-
**Importing Gift Cards**
|
496
|
-
|
497
|
-
BlockChyp does have the ability to import gift card liability from
|
498
|
-
conventional gift card platforms. Unfortunately, BlockChyp does not
|
499
|
-
support activating cards on third party systems. However, you can import
|
500
|
-
your outstanding gift cards and customers can swipe them on the
|
501
|
-
terminals like BlockChyp's standard gift cards.
|
502
|
-
|
503
|
-
No special coding is required to access this feature. The gateway and
|
504
|
-
terminal firmware handle everything for you.
|
505
|
-
|
506
|
-
**Third Party Gift Card Networks**
|
507
|
-
|
508
|
-
BlockChyp does not currently provide any native support for other gift card
|
509
|
-
platforms beyond importing gift card liability. We do have a white listing system
|
510
|
-
that can be used to support your own custom gift card implementations. We have a security review
|
511
|
-
process before we can allow a BIN range to be white listed, so contact
|
512
|
-
support@blockchyp.com if you need to white list a BIN range.
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
```ruby
|
518
|
-
# frozen_string_literal: true
|
519
|
-
|
520
|
-
require 'blockchyp'
|
521
|
-
|
522
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
523
|
-
ENV['BC_API_KEY'],
|
524
|
-
ENV['BC_BEARER_TOKEN'],
|
525
|
-
ENV['BC_SIGNING_KEY']
|
526
|
-
)
|
527
|
-
|
528
|
-
# Set request parameters
|
529
|
-
request = {
|
530
|
-
test: true,
|
531
|
-
terminalName: 'Test Terminal',
|
532
|
-
amount: '50.00'
|
533
|
-
}
|
534
|
-
|
535
|
-
response = blockchyp.giftActivate(request)
|
536
|
-
|
537
|
-
puts "Response: #{response.inspect}"
|
538
|
-
|
539
|
-
|
540
|
-
```
|
541
|
-
|
542
|
-
#### Balance
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
* **API Credential Types:** Merchant
|
547
|
-
* **Required Role:** Payment API Access
|
548
|
-
|
549
|
-
This API checks a gift or EBT card balance.
|
550
|
-
|
551
|
-
**Gift Card Balance Checks**
|
552
|
-
|
553
|
-
For gift cards, pass in a terminal name and the customer will be prompted
|
554
|
-
to swipe a card on that terminal. The remaining balance will be displayed
|
555
|
-
briefly on the terminal screen and the API response will include the gift card's public key and the remaining balance.
|
556
|
-
|
557
|
-
**EBT Balance Checks**
|
558
|
-
|
559
|
-
All EBT transactions require a PIN, so to check an EBT card balance,
|
560
|
-
you need to pass in the `ebt` flag just like you would for a normal EBT
|
561
|
-
charge transaction. The customer will be prompted to swipe their card and
|
562
|
-
enter a PIN code. If everything checks out, the remaining balance on the
|
563
|
-
card will be displayed on the terminal for the customer and returned with the API response.
|
564
|
-
|
565
|
-
**Testing Gift Card Balance Checks**
|
566
|
-
|
567
|
-
Test gift card balance checks work no differently than live gift cards. You
|
568
|
-
must activate a test gift card first to test balance checks. Test
|
569
|
-
gift cards are real blockchain cards that live on our parallel test blockchain.
|
570
|
-
|
571
|
-
**Testing EBT Gift Card Balance Checks**
|
572
|
-
|
573
|
-
All test EBT transactions assume a starting balance of $100.00. As a result,
|
574
|
-
test EBT balance checks always return a balance of $100.00.
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
```ruby
|
580
|
-
# frozen_string_literal: true
|
581
|
-
|
582
|
-
require 'blockchyp'
|
583
|
-
|
584
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
585
|
-
ENV['BC_API_KEY'],
|
586
|
-
ENV['BC_BEARER_TOKEN'],
|
587
|
-
ENV['BC_SIGNING_KEY']
|
588
|
-
)
|
589
|
-
|
590
|
-
# Set request parameters
|
591
|
-
request = {
|
592
|
-
test: true,
|
593
|
-
terminalName: 'Test Terminal',
|
594
|
-
cardType: CardType::EBT
|
595
|
-
}
|
596
|
-
|
597
|
-
response = blockchyp.balance(request)
|
598
|
-
|
599
|
-
puts "Response: #{response.inspect}"
|
600
|
-
|
601
|
-
|
602
|
-
```
|
603
|
-
|
604
|
-
#### Close Batch
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
* **API Credential Types:** Merchant
|
609
|
-
* **Required Role:** Payment API Access
|
610
|
-
|
611
|
-
This API will close the merchant's batch if it's currently open.
|
612
|
-
|
613
|
-
By default, merchant batches will close automatically at 3 AM in their
|
614
|
-
local time zone. The automatic batch closure time can be changed
|
615
|
-
in the Merchant Profile or disabled completely.
|
616
|
-
|
617
|
-
If automatic batch closure is disabled, you'll need to use this API to
|
618
|
-
close the batch manually.
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
```ruby
|
623
|
-
# frozen_string_literal: true
|
624
|
-
|
625
|
-
require 'blockchyp'
|
626
|
-
|
627
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
628
|
-
ENV['BC_API_KEY'],
|
629
|
-
ENV['BC_BEARER_TOKEN'],
|
630
|
-
ENV['BC_SIGNING_KEY']
|
631
|
-
)
|
632
|
-
|
633
|
-
# Set request parameters
|
634
|
-
request = {
|
635
|
-
test: true
|
636
|
-
}
|
637
|
-
|
638
|
-
response = blockchyp.closeBatch(request)
|
639
|
-
|
640
|
-
puts "Response: #{response.inspect}"
|
641
|
-
|
642
|
-
|
643
|
-
```
|
644
|
-
|
645
|
-
#### Send Payment Link
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
* **API Credential Types:** Merchant
|
650
|
-
* **Required Role:** Payment API Access
|
651
|
-
|
652
|
-
This API allows you to send an invoice to a customer and capture payment
|
653
|
-
via a BlockChyp hosted payment page.
|
654
|
-
|
655
|
-
If you set the `autoSend` flag, BlockChyp will send a basic invoice email
|
656
|
-
to the customer for you that includes the payment link. If you'd rather have
|
657
|
-
more control over the look of the email message, you can omit the `autoSend`
|
658
|
-
flag and send the customer email yourself.
|
659
|
-
|
660
|
-
There are a lot of optional parameters for this API, but at a minimum
|
661
|
-
you'll need to pass in a total, customer name, and email address. (Unless
|
662
|
-
you use the `cashier` flag.)
|
663
|
-
|
664
|
-
**Customer Info**
|
665
|
-
|
666
|
-
Unless you're using the `cashier` flag, you must specify a customer; either by
|
667
|
-
creating a new customer record inline or passing in an existing Customer ID or Customer Ref.
|
668
|
-
|
669
|
-
**Line Item Level Data**
|
670
|
-
|
671
|
-
It's not strictly required, but we strongly recommend sending line item level
|
672
|
-
detail with every request. It will make the invoice look more complete
|
673
|
-
and the data format for line item level data is the exact same format used
|
674
|
-
for terminal line item display, so the same code can be used to support both areas.
|
675
|
-
|
676
|
-
**Descriptions**
|
677
|
-
|
678
|
-
You can also provide a free form description or message to display near
|
679
|
-
the bottom of the invoice. Usually this is some kind of thank you note
|
680
|
-
or instruction.
|
681
|
-
|
682
|
-
**Terms and Conditions**
|
683
|
-
|
684
|
-
You can include long form contract language with a request and capture
|
685
|
-
terms and conditions accepted at the same time payment is captured.
|
686
|
-
|
687
|
-
The interface is identical to that used for the terminal based Terms and
|
688
|
-
Conditions API in that you can pass in content directly via `tcContent` or via
|
689
|
-
a preconfigured template via `tcAlias`. The Terms and Conditions log will also be updated when
|
690
|
-
agreement acceptance is incorporated into a send link request.
|
691
|
-
|
692
|
-
**Auto Send**
|
693
|
-
|
694
|
-
BlockChyp does not send the email notification automatically. This safeguard prevents real
|
695
|
-
emails from going out when you may not expect them If you want BlockChyp to send the email
|
696
|
-
for you, just add the `autoSend` flag with all requests.
|
697
|
-
|
698
|
-
**Cryptocurrency**
|
699
|
-
|
700
|
-
If the merchant is configured to support cryptocurrency transactions, the payment page will
|
701
|
-
display additional UI widgets that allowing customers to switch to a crypto payment method.
|
702
|
-
|
703
|
-
**Tokenization**
|
704
|
-
|
705
|
-
Add the `enroll` flag to a send link request to enroll the payment method
|
706
|
-
in the token vault.
|
707
|
-
|
708
|
-
**Cashier Facing Card Entry**
|
709
|
-
|
710
|
-
BlockChyp can be used to generate internal/cashier facing card entry pages as well. This is
|
711
|
-
designed for situations where you might need to take a phone order and don't
|
712
|
-
have an available terminal.
|
713
|
-
|
714
|
-
If you pass in the `cashier` flag, no email will be sent and you'll be able to
|
715
|
-
load the link in a browser or iframe for payment entry. When the `cashier` flag
|
716
|
-
is used, the `autoSend` flag will be ignored.
|
717
|
-
|
718
|
-
Note that cryptocurrency is not supported for cashier facing payment entry.
|
719
|
-
|
720
|
-
**Payment Notifications**
|
721
|
-
|
722
|
-
When a customer successfully submits payment, the merchant will receive an email
|
723
|
-
notifying them that the payment was received.
|
724
|
-
|
725
|
-
**Real Time Callback Notifications**
|
726
|
-
|
727
|
-
Email notifications are fine, but you may want your system to be informed
|
728
|
-
immediately whenever a payment event occurs. By using the optional `callbackUrl` request
|
729
|
-
property, you can specify a URL to which the Authorization Response will be posted
|
730
|
-
every time the user submits a payment, whether approved or otherwise.
|
731
|
-
|
732
|
-
The response will be sent as a JSON encoded POST request and will be the exact
|
733
|
-
same format as all BlockChyp charge and preauth transaction responses.
|
734
|
-
|
735
|
-
**Status Polling**
|
736
|
-
|
737
|
-
If real time callbacks aren't practical or necessary in your environment, you can
|
738
|
-
always use the Transaction Status API described below.
|
739
|
-
|
740
|
-
A common use case for the send link API with status polling is curbside pickup.
|
741
|
-
You could have your system check the Transaction Status when a customer arrives to
|
742
|
-
ensure it's been paid without necessarily needing to create background threads
|
743
|
-
to constantly poll for status updates.
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
```ruby
|
749
|
-
# frozen_string_literal: true
|
750
|
-
|
751
|
-
require 'blockchyp'
|
752
|
-
|
753
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
754
|
-
ENV['BC_API_KEY'],
|
755
|
-
ENV['BC_BEARER_TOKEN'],
|
756
|
-
ENV['BC_SIGNING_KEY']
|
757
|
-
)
|
758
|
-
|
759
|
-
# Set request parameters
|
760
|
-
request = {
|
761
|
-
transactionRef: '<TX REF>',
|
762
|
-
amount: '199.99',
|
763
|
-
description: 'Widget',
|
764
|
-
subject: 'Widget invoice',
|
765
|
-
transaction: {
|
766
|
-
subtotal: '195.00',
|
767
|
-
tax: '4.99',
|
768
|
-
total: '199.99',
|
769
|
-
items: [
|
770
|
-
{
|
771
|
-
description: 'Widget',
|
772
|
-
price: '195.00',
|
773
|
-
quantity: 1
|
774
|
-
}
|
775
|
-
]
|
776
|
-
},
|
777
|
-
autoSend: true,
|
778
|
-
customer: {
|
779
|
-
customerRef: 'Customer reference string',
|
780
|
-
firstName: 'FirstName',
|
781
|
-
lastName: 'LastName',
|
782
|
-
companyName: 'Company Name',
|
783
|
-
emailAddress: 'notifications@blockchypteam.m8r.co',
|
784
|
-
smsNumber: '(123) 123-1231'
|
785
|
-
}
|
786
|
-
}
|
787
|
-
|
788
|
-
response = blockchyp.sendPaymentLink(request)
|
789
|
-
|
790
|
-
puts "Response: #{response.inspect}"
|
791
|
-
|
792
|
-
|
793
|
-
```
|
794
|
-
|
795
|
-
#### Cancel Payment Link
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
* **API Credential Types:** Merchant
|
800
|
-
* **Required Role:** Payment API Access
|
801
|
-
|
802
|
-
This API cancels a payment link.
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
```ruby
|
808
|
-
# frozen_string_literal: true
|
809
|
-
|
810
|
-
require 'blockchyp'
|
811
|
-
|
812
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
813
|
-
ENV['BC_API_KEY'],
|
814
|
-
ENV['BC_BEARER_TOKEN'],
|
815
|
-
ENV['BC_SIGNING_KEY']
|
816
|
-
)
|
817
|
-
|
818
|
-
# Set request parameters
|
819
|
-
request = {
|
820
|
-
linkCode: '<PAYMENT LINK CODE>'
|
821
|
-
}
|
822
|
-
|
823
|
-
response = blockchyp.cancelPaymentLink(request)
|
824
|
-
|
825
|
-
puts "Response: #{response.inspect}"
|
826
|
-
|
827
|
-
|
828
|
-
```
|
829
|
-
|
830
|
-
#### Transaction Status
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
* **API Credential Types:** Merchant
|
835
|
-
* **Required Role:** Payment API Access
|
836
|
-
|
837
|
-
This API returns the current status for any transaction. You can lookup a transaction
|
838
|
-
by its BlockChyp assigned Transaction ID or your own Transaction Ref.
|
839
|
-
|
840
|
-
You should alway use globally unique Transaction Ref values, but in the event
|
841
|
-
that you duplicate Transaction Refs, the most recent transaction matching your
|
842
|
-
Transaction Ref is returned.
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
```ruby
|
848
|
-
# frozen_string_literal: true
|
849
|
-
|
850
|
-
require 'blockchyp'
|
851
|
-
|
852
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
853
|
-
ENV['BC_API_KEY'],
|
854
|
-
ENV['BC_BEARER_TOKEN'],
|
855
|
-
ENV['BC_SIGNING_KEY']
|
856
|
-
)
|
857
|
-
|
858
|
-
# Set request parameters
|
859
|
-
request = {
|
860
|
-
transactionId: '<TRANSACTION ID>'
|
861
|
-
}
|
862
|
-
|
863
|
-
response = blockchyp.transactionStatus(request)
|
864
|
-
|
865
|
-
puts "Response: #{response.inspect}"
|
866
|
-
|
867
|
-
|
868
|
-
```
|
869
|
-
|
870
|
-
#### Cash Discount
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
* **API Credential Types:** Merchant
|
875
|
-
* **Required Role:** Payment API Access
|
876
|
-
|
877
|
-
This API calculates the surcharge, cash discount, and total amounts for cash transactions.
|
878
|
-
|
879
|
-
If you're using BlockChyp's cash discounting features, you can use this endpoint
|
880
|
-
to ensure the numbers and receipts for true cash transactions are consistent
|
881
|
-
with transactions processed by BlockChyp.
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
```ruby
|
887
|
-
# frozen_string_literal: true
|
888
|
-
|
889
|
-
require 'blockchyp'
|
890
|
-
|
891
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
892
|
-
ENV['BC_API_KEY'],
|
893
|
-
ENV['BC_BEARER_TOKEN'],
|
894
|
-
ENV['BC_SIGNING_KEY']
|
895
|
-
)
|
896
|
-
|
897
|
-
# Set request parameters
|
898
|
-
request = {
|
899
|
-
amount: '100.00',
|
900
|
-
cashDiscount: true,
|
901
|
-
surcharge: true
|
902
|
-
}
|
903
|
-
|
904
|
-
response = blockchyp.cashDiscount(request)
|
905
|
-
|
906
|
-
puts "Response: #{response.inspect}"
|
907
|
-
|
908
|
-
|
909
|
-
```
|
910
|
-
|
911
|
-
#### Batch History
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
* **API Credential Types:** Merchant
|
916
|
-
* **Required Role:** Payment API Access
|
917
|
-
|
918
|
-
This endpoint allows developers to query the gateway for the merchant's batch history.
|
919
|
-
The data will be returned in descending order of open date with the most recent
|
920
|
-
batch returned first. The results will include basic information about the batch.
|
921
|
-
Consider using the Batch Details API for more detail about a specific batch.
|
922
|
-
|
923
|
-
**Limiting Results**
|
924
|
-
|
925
|
-
This API will return a maximum of 250 results. Use the `maxResults` property to
|
926
|
-
limit maximum results even further and use the `startIndex` property to
|
927
|
-
page through results that span multiple queries.
|
928
|
-
|
929
|
-
For example, if you want the ten most recent batches, pass in a value of
|
930
|
-
`10` for `maxResults`. Also note that `startIndex` is zero based. Use a value of `0` to
|
931
|
-
get the first batch in the dataset.
|
932
|
-
|
933
|
-
**Filtering by Date Range**
|
934
|
-
|
935
|
-
You can also filter results by date. Use the `startDate` and `endDate`
|
936
|
-
properties to return only those batches opened between those dates.
|
937
|
-
You can use either `startDate` and `endDate` and you can use date filters
|
938
|
-
in conjunction with `maxResults` and `startIndex`
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
```ruby
|
944
|
-
# frozen_string_literal: true
|
945
|
-
|
946
|
-
require 'blockchyp'
|
947
|
-
|
948
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
949
|
-
ENV['BC_API_KEY'],
|
950
|
-
ENV['BC_BEARER_TOKEN'],
|
951
|
-
ENV['BC_SIGNING_KEY']
|
952
|
-
)
|
953
|
-
|
954
|
-
# Set request parameters
|
955
|
-
request = {
|
956
|
-
maxResults: 250,
|
957
|
-
startIndex: 0
|
958
|
-
}
|
959
|
-
|
960
|
-
response = blockchyp.batchHistory(request)
|
961
|
-
|
962
|
-
puts "Response: #{response.inspect}"
|
963
|
-
|
964
|
-
|
965
|
-
```
|
966
|
-
|
967
|
-
#### Batch Details
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
* **API Credential Types:** Merchant
|
972
|
-
* **Required Role:** Payment API Access
|
973
|
-
|
974
|
-
This API allows developers to pull down details for a specific batch,
|
975
|
-
including captured volume, gift card activity, expected deposit, and
|
976
|
-
captured volume broken down by terminal.
|
977
|
-
|
978
|
-
The only required request parameter is `batchId`. Batch IDs are returned
|
979
|
-
with every transaction response and can be discovered using the Batch
|
980
|
-
History API.
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
```ruby
|
986
|
-
# frozen_string_literal: true
|
987
|
-
|
988
|
-
require 'blockchyp'
|
989
|
-
|
990
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
991
|
-
ENV['BC_API_KEY'],
|
992
|
-
ENV['BC_BEARER_TOKEN'],
|
993
|
-
ENV['BC_SIGNING_KEY']
|
994
|
-
)
|
995
|
-
|
996
|
-
# Set request parameters
|
997
|
-
request = {
|
998
|
-
batchId: '<BATCH ID>'
|
999
|
-
}
|
1000
|
-
|
1001
|
-
response = blockchyp.batchDetails(request)
|
1002
|
-
|
1003
|
-
puts "Response: #{response.inspect}"
|
1004
|
-
|
1005
|
-
|
1006
|
-
```
|
1007
|
-
|
1008
|
-
#### Transaction History
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
* **API Credential Types:** Merchant
|
1013
|
-
* **Required Role:** Payment API Access
|
1014
|
-
|
1015
|
-
This endpoint provides several different methods to sift through
|
1016
|
-
transaction history.
|
1017
|
-
|
1018
|
-
By default with no filtering properties, this endpoint will return the 250
|
1019
|
-
most recent transactions.
|
1020
|
-
|
1021
|
-
**Limiting Results**
|
1022
|
-
|
1023
|
-
This API will return a maximum of 50 results in a single query. Use the `maxResults` property
|
1024
|
-
to limit maximum results even further and use the `startIndex` property to
|
1025
|
-
page through results that span multiple queries.
|
1026
|
-
|
1027
|
-
For example, if you want the ten most recent batches, pass in a value of
|
1028
|
-
`10` for `maxResults`. Also note that `startIndex` is zero based. Use a value of `0` to
|
1029
|
-
get the first transaction in the dataset.
|
1030
|
-
|
1031
|
-
**Filtering By Date Range**
|
1032
|
-
|
1033
|
-
You can also filter results by date. Use the `startDate` and `endDate`
|
1034
|
-
properties to return only transactions run between those dates.
|
1035
|
-
You can use either `startDate` or `endDate` and you can use date filters
|
1036
|
-
in conjunction with `maxResults` and `startIndex`
|
1037
|
-
|
1038
|
-
**Filtering By Batch**
|
1039
|
-
|
1040
|
-
To restrict results to a single batch, pass in the `batchId` parameter.
|
1041
|
-
|
1042
|
-
**Filtering By Terminal**
|
1043
|
-
|
1044
|
-
To restrict results to those executed on a single terminal, pass in the terminal name.
|
1045
|
-
|
1046
|
-
**Combining Filters**
|
1047
|
-
|
1048
|
-
None of the above filters are mutually exclusive. You can combine any of the
|
1049
|
-
above properties in a single request to restrict transaction results to a
|
1050
|
-
narrower set of results.
|
1051
|
-
|
1052
|
-
**Searching Transaction History**
|
1053
|
-
|
1054
|
-
You can search transaction history by passing in search criteria with the
|
1055
|
-
`query` option. The search system will match the amount (requested and authorized),
|
1056
|
-
last four of the card number, cardholder name, and the auth code.
|
1057
|
-
|
1058
|
-
Note that when search queries are used, terminalName or
|
1059
|
-
batch id filters are not supported.
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
```ruby
|
1065
|
-
# frozen_string_literal: true
|
1066
|
-
|
1067
|
-
require 'blockchyp'
|
1068
|
-
|
1069
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1070
|
-
ENV['BC_API_KEY'],
|
1071
|
-
ENV['BC_BEARER_TOKEN'],
|
1072
|
-
ENV['BC_SIGNING_KEY']
|
1073
|
-
)
|
1074
|
-
|
1075
|
-
# Set request parameters
|
1076
|
-
request = {
|
1077
|
-
maxResults: 10,
|
1078
|
-
batchId: '<BATCH ID>'
|
1079
|
-
}
|
1080
|
-
|
1081
|
-
response = blockchyp.transactionHistory(request)
|
1082
|
-
|
1083
|
-
puts "Response: #{response.inspect}"
|
1084
|
-
|
1085
|
-
|
1086
|
-
```
|
1087
|
-
|
1088
|
-
#### List Queued Transactions
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
* **API Credential Types:** Merchant
|
1093
|
-
* **Required Role:** Payment API Access
|
1094
|
-
|
1095
|
-
Returns a list of transaction refs of transactions queued on a terminal.
|
1096
|
-
Details about the transactions can be retrieved using the Transaction Status
|
1097
|
-
API.
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
```ruby
|
1103
|
-
# frozen_string_literal: true
|
1104
|
-
|
1105
|
-
require 'blockchyp'
|
1106
|
-
|
1107
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1108
|
-
ENV['BC_API_KEY'],
|
1109
|
-
ENV['BC_BEARER_TOKEN'],
|
1110
|
-
ENV['BC_SIGNING_KEY']
|
1111
|
-
)
|
1112
|
-
|
1113
|
-
# Set request parameters
|
1114
|
-
request = {
|
1115
|
-
terminalName: 'Test Terminal'
|
1116
|
-
}
|
1117
|
-
|
1118
|
-
response = blockchyp.listQueuedTransactions(request)
|
1119
|
-
|
1120
|
-
puts "Response: #{response.inspect}"
|
1121
|
-
|
1122
|
-
|
1123
|
-
```
|
1124
|
-
|
1125
|
-
#### Delete Queued Transaction
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
* **API Credential Types:** Merchant
|
1130
|
-
* **Required Role:** Payment API Access
|
1131
|
-
|
1132
|
-
Deletes one or all queued transactions from a terminal. If `*` is passed as
|
1133
|
-
a transaction ref, then the entire terminal queue will be cleared. An error is
|
1134
|
-
returned if the passed transaction ref is not queued on the terminal.
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
```ruby
|
1140
|
-
# frozen_string_literal: true
|
1141
|
-
|
1142
|
-
require 'blockchyp'
|
1143
|
-
|
1144
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1145
|
-
ENV['BC_API_KEY'],
|
1146
|
-
ENV['BC_BEARER_TOKEN'],
|
1147
|
-
ENV['BC_SIGNING_KEY']
|
1148
|
-
)
|
1149
|
-
|
1150
|
-
# Set request parameters
|
1151
|
-
request = {
|
1152
|
-
terminalName: 'Test Terminal',
|
1153
|
-
transactionRef: '*'
|
1154
|
-
}
|
1155
|
-
|
1156
|
-
response = blockchyp.deleteQueuedTransaction(request)
|
1157
|
-
|
1158
|
-
puts "Response: #{response.inspect}"
|
1159
|
-
|
1160
|
-
|
1161
|
-
```
|
1162
|
-
|
1163
|
-
### Terminal Management Endpoints
|
1164
|
-
|
1165
|
-
|
1166
|
-
These APIs support terminal management functions and additional terminal
|
1167
|
-
features such as line item display, messages, and interactive prompts.
|
1168
|
-
These features can be used to extend a point of sale system's functionality.
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
#### Terminal Ping
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
* **API Credential Types:** Merchant
|
1177
|
-
* **Required Role:** Payment API Access
|
1178
|
-
|
1179
|
-
This simple test transaction helps ensure good communication with a payment terminal
|
1180
|
-
and is usually the first test you'll run in development.
|
1181
|
-
|
1182
|
-
It tests communication with the terminal and returns a positive response if everything
|
1183
|
-
is okay. It works the same way in local or cloud relay mode.
|
1184
|
-
|
1185
|
-
If you get a positive response, you've successfully verified all of the following:
|
1186
|
-
|
1187
|
-
* The terminal is online.
|
1188
|
-
* There is a valid route to the terminal.
|
1189
|
-
* The API Credentials are valid.
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
```ruby
|
1195
|
-
# frozen_string_literal: true
|
1196
|
-
|
1197
|
-
require 'blockchyp'
|
1198
|
-
|
1199
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1200
|
-
ENV['BC_API_KEY'],
|
1201
|
-
ENV['BC_BEARER_TOKEN'],
|
1202
|
-
ENV['BC_SIGNING_KEY']
|
1203
|
-
)
|
1204
|
-
|
1205
|
-
# Set request parameters
|
1206
|
-
request = {
|
1207
|
-
terminalName: 'Test Terminal'
|
1208
|
-
}
|
1209
|
-
|
1210
|
-
response = blockchyp.ping(request)
|
1211
|
-
|
1212
|
-
puts "Response: #{response.inspect}"
|
1213
|
-
|
1214
|
-
|
1215
|
-
```
|
1216
|
-
|
1217
|
-
#### Terminal Locate
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
* **API Credential Types:** Merchant
|
1222
|
-
* **Required Role:** Payment API Access
|
1223
|
-
|
1224
|
-
This endpoint returns a terminal's routing and location information.
|
1225
|
-
|
1226
|
-
The result will indicate whether or not the terminal is in cloud relay mode and will
|
1227
|
-
return the local IP address if the terminal is in local mode.
|
1228
|
-
|
1229
|
-
The terminal will also return the public key for the terminal.
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
```ruby
|
1235
|
-
# frozen_string_literal: true
|
1236
|
-
|
1237
|
-
require 'blockchyp'
|
1238
|
-
|
1239
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1240
|
-
ENV['BC_API_KEY'],
|
1241
|
-
ENV['BC_BEARER_TOKEN'],
|
1242
|
-
ENV['BC_SIGNING_KEY']
|
1243
|
-
)
|
1244
|
-
|
1245
|
-
# Set request parameters
|
1246
|
-
request = {
|
1247
|
-
terminalName: 'Test Terminal'
|
1248
|
-
}
|
1249
|
-
|
1250
|
-
response = blockchyp.locate(request)
|
1251
|
-
|
1252
|
-
puts "Response: #{response.inspect}"
|
1253
|
-
|
1254
|
-
|
1255
|
-
```
|
1256
|
-
|
1257
|
-
#### Terminal Clear
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
* **API Credential Types:** Merchant
|
1262
|
-
* **Required Role:** Payment API Access
|
1263
|
-
|
1264
|
-
This API interrupts whatever a terminal may be doing and returns it to the
|
1265
|
-
idle state.
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
```ruby
|
1272
|
-
# frozen_string_literal: true
|
1273
|
-
|
1274
|
-
require 'blockchyp'
|
1275
|
-
|
1276
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1277
|
-
ENV['BC_API_KEY'],
|
1278
|
-
ENV['BC_BEARER_TOKEN'],
|
1279
|
-
ENV['BC_SIGNING_KEY']
|
1280
|
-
)
|
1281
|
-
|
1282
|
-
# Set request parameters
|
1283
|
-
request = {
|
1284
|
-
test: true,
|
1285
|
-
terminalName: 'Test Terminal'
|
1286
|
-
}
|
1287
|
-
|
1288
|
-
response = blockchyp.clear(request)
|
1289
|
-
|
1290
|
-
puts "Response: #{response.inspect}"
|
1291
|
-
|
1292
|
-
|
1293
|
-
```
|
1294
|
-
|
1295
|
-
#### Terminal Status
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
* **API Credential Types:** Merchant
|
1300
|
-
* **Required Role:** Payment API Access
|
1301
|
-
|
1302
|
-
This API returns the current status of a payment terminal. This is typically used
|
1303
|
-
as a way to determine if the terminal is busy before sending a new transaction.
|
1304
|
-
|
1305
|
-
If the terminal is busy, `idle` will be false and the `status` field will return
|
1306
|
-
a short string that indicates the transaction type currently in progress. The system
|
1307
|
-
will also return the timestamp of the last status change in the `since` field.
|
1308
|
-
|
1309
|
-
If the system is running a payment transaction and you wisely passed in a
|
1310
|
-
Transaction Ref, this API will also return the Transaction Ref of the in progress
|
1311
|
-
transaction.
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
```ruby
|
1317
|
-
# frozen_string_literal: true
|
1318
|
-
|
1319
|
-
require 'blockchyp'
|
1320
|
-
|
1321
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1322
|
-
ENV['BC_API_KEY'],
|
1323
|
-
ENV['BC_BEARER_TOKEN'],
|
1324
|
-
ENV['BC_SIGNING_KEY']
|
1325
|
-
)
|
1326
|
-
|
1327
|
-
# Set request parameters
|
1328
|
-
request = {
|
1329
|
-
terminalName: 'Test Terminal'
|
1330
|
-
}
|
1331
|
-
|
1332
|
-
response = blockchyp.terminalStatus(request)
|
1333
|
-
|
1334
|
-
puts "Response: #{response.inspect}"
|
1335
|
-
|
1336
|
-
|
1337
|
-
```
|
1338
|
-
|
1339
|
-
#### Capture Signature
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
* **API Credential Types:** Merchant
|
1344
|
-
* **Required Role:** Payment API Access
|
1345
|
-
|
1346
|
-
This endpoint captures a written signature from the terminal and returns the
|
1347
|
-
image.
|
1348
|
-
|
1349
|
-
Unlike the Terms & Conditions API, this endpoint performs basic signature
|
1350
|
-
capture with no agreement display or signature archival.
|
1351
|
-
|
1352
|
-
Under the hood, signatures are captured in a proprietary vector format and
|
1353
|
-
must be converted to a common raster format in order to be useful to most
|
1354
|
-
applications. At a minimum, you must specify an image format using the
|
1355
|
-
`sigFormat` parameter. Currently, JPG and PNG are supported.
|
1356
|
-
|
1357
|
-
By default, images are returned in the JSON response as hex encoded binary.
|
1358
|
-
You can redirect the binary image output to a file using the `sigFile`
|
1359
|
-
parameter.
|
1360
|
-
|
1361
|
-
You can also scale the output image to your preferred width by
|
1362
|
-
passing in a `sigWidth` parameter. The image will be scaled to that
|
1363
|
-
width, preserving the aspect ratio of the original image.
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
```ruby
|
1369
|
-
# frozen_string_literal: true
|
1370
|
-
|
1371
|
-
require 'blockchyp'
|
1372
|
-
|
1373
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1374
|
-
ENV['BC_API_KEY'],
|
1375
|
-
ENV['BC_BEARER_TOKEN'],
|
1376
|
-
ENV['BC_SIGNING_KEY']
|
1377
|
-
)
|
1378
|
-
|
1379
|
-
# Set request parameters
|
1380
|
-
request = {
|
1381
|
-
terminalName: 'Test Terminal',
|
1382
|
-
|
1383
|
-
# File format for the signature image.
|
1384
|
-
sigFormat: SignatureFormat::PNG,
|
1385
|
-
|
1386
|
-
# Width of the signature image in pixels.
|
1387
|
-
sigWidth: 200
|
1388
|
-
}
|
1389
|
-
|
1390
|
-
response = blockchyp.captureSignature(request)
|
1391
|
-
|
1392
|
-
puts "Response: #{response.inspect}"
|
1393
|
-
|
1394
|
-
|
1395
|
-
```
|
1396
|
-
|
1397
|
-
#### New Transaction Display
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
* **API Credential Types:** Merchant
|
1402
|
-
* **Required Role:** Payment API Access
|
1403
|
-
|
1404
|
-
This API sends totals and line item level data to the terminal.
|
1405
|
-
|
1406
|
-
At a minimum, you should send total information as part of a display request,
|
1407
|
-
including `total`, `tax`, and `subtotal`.
|
1408
|
-
|
1409
|
-
You can also send line item level data and each line item can have a `description`,
|
1410
|
-
`qty`, `price`, and `extended` price.
|
1411
|
-
|
1412
|
-
If you fail to send an extended price, BlockChyp will multiply the `qty` by the
|
1413
|
-
`price`. However, we strongly recommend you precalculate all the fields yourself
|
1414
|
-
to ensure consistency. For example, your treatment of floating-point multiplication
|
1415
|
-
and rounding may differ slightly from BlockChyp's.
|
1416
|
-
|
1417
|
-
**Discounts**
|
1418
|
-
|
1419
|
-
You have the option to show discounts on the display as individual line items
|
1420
|
-
with negative values or you can associate discounts with a specific line item.
|
1421
|
-
You can apply any number of discounts to an individual line item with a description
|
1422
|
-
and amount.
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
```ruby
|
1428
|
-
# frozen_string_literal: true
|
1429
|
-
|
1430
|
-
require 'blockchyp'
|
1431
|
-
|
1432
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1433
|
-
ENV['BC_API_KEY'],
|
1434
|
-
ENV['BC_BEARER_TOKEN'],
|
1435
|
-
ENV['BC_SIGNING_KEY']
|
1436
|
-
)
|
1437
|
-
|
1438
|
-
# Set request parameters
|
1439
|
-
request = {
|
1440
|
-
test: true,
|
1441
|
-
terminalName: 'Test Terminal',
|
1442
|
-
transaction: {
|
1443
|
-
subtotal: '60.00',
|
1444
|
-
tax: '5.00',
|
1445
|
-
total: '65.00',
|
1446
|
-
items: [
|
1447
|
-
{
|
1448
|
-
description: 'Leki Trekking Poles',
|
1449
|
-
price: '35.00',
|
1450
|
-
quantity: 2,
|
1451
|
-
extended: '70.00',
|
1452
|
-
discounts: [
|
1453
|
-
{
|
1454
|
-
description: 'memberDiscount',
|
1455
|
-
amount: '10.00'
|
1456
|
-
}
|
1457
|
-
]
|
1458
|
-
}
|
1459
|
-
]
|
1460
|
-
}
|
1461
|
-
}
|
1462
|
-
|
1463
|
-
response = blockchyp.newTransactionDisplay(request)
|
1464
|
-
|
1465
|
-
puts "Response: #{response.inspect}"
|
1466
|
-
|
1467
|
-
|
1468
|
-
```
|
1469
|
-
|
1470
|
-
#### Update Transaction Display
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
* **API Credential Types:** Merchant
|
1475
|
-
* **Required Role:** Payment API Access
|
1476
|
-
|
1477
|
-
Similar to *New Transaction Display*, this variant allows developers to update
|
1478
|
-
line item level data currently being displayed on the terminal.
|
1479
|
-
|
1480
|
-
This feature is designed for situations where you want to update the terminal display as
|
1481
|
-
items are scanned. You'll only have to send information to the
|
1482
|
-
terminal that's changed, which usually means the new line item and updated totals.
|
1483
|
-
|
1484
|
-
If the terminal is not in line item display mode and you invoke this endpoint,
|
1485
|
-
the first invocation will behave like a *New Transaction Display* call.
|
1486
|
-
|
1487
|
-
At a minimum, you should send total information as part of a display request,
|
1488
|
-
including `total`, `tax`, and `subtotal`.
|
1489
|
-
|
1490
|
-
You can also send line item level data and each line item can have a `description`,
|
1491
|
-
`qty`, `price`, and `extended` price.
|
1492
|
-
|
1493
|
-
If you fail to send an extended price, BlockChyp will multiply the `qty` by the
|
1494
|
-
`price`. However, we strongly recommend you precalculate all the fields yourself
|
1495
|
-
to ensure consistency. For example, your treatment of floating-point multiplication and rounding
|
1496
|
-
may differ slightly from BlockChyp's.
|
1497
|
-
|
1498
|
-
**Discounts**
|
1499
|
-
|
1500
|
-
You have the option to show discounts on the display as individual line items
|
1501
|
-
with negative values or you can associate discounts with a specific line item.
|
1502
|
-
You can apply any number of discounts to an individual line item with a description
|
1503
|
-
and amount.
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
```ruby
|
1509
|
-
# frozen_string_literal: true
|
1510
|
-
|
1511
|
-
require 'blockchyp'
|
1512
|
-
|
1513
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1514
|
-
ENV['BC_API_KEY'],
|
1515
|
-
ENV['BC_BEARER_TOKEN'],
|
1516
|
-
ENV['BC_SIGNING_KEY']
|
1517
|
-
)
|
1518
|
-
|
1519
|
-
# Set request parameters
|
1520
|
-
request = {
|
1521
|
-
test: true,
|
1522
|
-
terminalName: 'Test Terminal',
|
1523
|
-
transaction: {
|
1524
|
-
subtotal: '60.00',
|
1525
|
-
tax: '5.00',
|
1526
|
-
total: '65.00',
|
1527
|
-
items: [
|
1528
|
-
{
|
1529
|
-
description: 'Leki Trekking Poles',
|
1530
|
-
price: '35.00',
|
1531
|
-
quantity: 2,
|
1532
|
-
extended: '70.00',
|
1533
|
-
discounts: [
|
1534
|
-
{
|
1535
|
-
description: 'memberDiscount',
|
1536
|
-
amount: '10.00'
|
1537
|
-
}
|
1538
|
-
]
|
1539
|
-
}
|
1540
|
-
]
|
1541
|
-
}
|
1542
|
-
}
|
1543
|
-
|
1544
|
-
response = blockchyp.updateTransactionDisplay(request)
|
1545
|
-
|
1546
|
-
puts "Response: #{response.inspect}"
|
1547
|
-
|
1548
|
-
|
1549
|
-
```
|
1550
|
-
|
1551
|
-
#### Display Message
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
* **API Credential Types:** Merchant
|
1556
|
-
* **Required Role:** Payment API Access
|
1557
|
-
|
1558
|
-
This API displays a message on the payment terminal.
|
1559
|
-
|
1560
|
-
Just specify the target terminal and the message using the `message` parameter.
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
```ruby
|
1566
|
-
# frozen_string_literal: true
|
1567
|
-
|
1568
|
-
require 'blockchyp'
|
1569
|
-
|
1570
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1571
|
-
ENV['BC_API_KEY'],
|
1572
|
-
ENV['BC_BEARER_TOKEN'],
|
1573
|
-
ENV['BC_SIGNING_KEY']
|
1574
|
-
)
|
1575
|
-
|
1576
|
-
# Set request parameters
|
1577
|
-
request = {
|
1578
|
-
test: true,
|
1579
|
-
terminalName: 'Test Terminal',
|
1580
|
-
message: 'Thank you for your business.'
|
1581
|
-
}
|
1582
|
-
|
1583
|
-
response = blockchyp.message(request)
|
1584
|
-
|
1585
|
-
puts "Response: #{response.inspect}"
|
1586
|
-
|
1587
|
-
|
1588
|
-
```
|
1589
|
-
|
1590
|
-
#### Boolean Prompt
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
* **API Credential Types:** Merchant
|
1595
|
-
* **Required Role:** Payment API Access
|
1596
|
-
|
1597
|
-
This API Pprompts the customer to answer a yes or no question.
|
1598
|
-
|
1599
|
-
You can specify the question or prompt with the `prompt` parameter and
|
1600
|
-
the response is returned in the `response` field.
|
1601
|
-
|
1602
|
-
This can be used for a number of use cases including starting a loyalty enrollment
|
1603
|
-
workflow or customer facing suggestive selling prompts.
|
1604
|
-
|
1605
|
-
**Custom Captions**
|
1606
|
-
|
1607
|
-
You can optionally override the "YES" and "NO" button captions by
|
1608
|
-
using the `yesCaption` and `noCaption` request parameters.
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
```ruby
|
1614
|
-
# frozen_string_literal: true
|
1615
|
-
|
1616
|
-
require 'blockchyp'
|
1617
|
-
|
1618
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1619
|
-
ENV['BC_API_KEY'],
|
1620
|
-
ENV['BC_BEARER_TOKEN'],
|
1621
|
-
ENV['BC_SIGNING_KEY']
|
1622
|
-
)
|
1623
|
-
|
1624
|
-
# Set request parameters
|
1625
|
-
request = {
|
1626
|
-
test: true,
|
1627
|
-
terminalName: 'Test Terminal',
|
1628
|
-
prompt: 'Would you like to become a member?',
|
1629
|
-
yesCaption: 'Yes',
|
1630
|
-
noCaption: 'No'
|
1631
|
-
}
|
1632
|
-
|
1633
|
-
response = blockchyp.booleanPrompt(request)
|
1634
|
-
|
1635
|
-
puts "Response: #{response.inspect}"
|
1636
|
-
|
1637
|
-
|
1638
|
-
```
|
1639
|
-
|
1640
|
-
#### Text Prompt
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
* **API Credential Types:** Merchant
|
1645
|
-
* **Required Role:** Payment API Access
|
1646
|
-
|
1647
|
-
This API prompts the customer to enter numeric or alphanumeric data.
|
1648
|
-
|
1649
|
-
Due to PCI rules, free-form prompts are not permitted when the response
|
1650
|
-
could be any valid string. The reason for this is that a malicious
|
1651
|
-
developer (not you, of course) could use text prompts to ask the customer to
|
1652
|
-
input a card number or PIN code.
|
1653
|
-
|
1654
|
-
This means that instead of providing a prompt, you provide a `promptType` instead.
|
1655
|
-
|
1656
|
-
The prompt types currently supported are listed below:
|
1657
|
-
|
1658
|
-
* **phone**: Captures a phone number.
|
1659
|
-
* **email**: Captures an email address.
|
1660
|
-
* **first-name**: Captures a first name.
|
1661
|
-
* **last-name**: Captures a last name.
|
1662
|
-
* **customer-number**: Captures a customer number.
|
1663
|
-
* **rewards-number**: Captures a rewards number.
|
1664
|
-
|
1665
|
-
You can specify the prompt with the `promptType` parameter and
|
1666
|
-
the response is returned in the `response` field.
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
```ruby
|
1673
|
-
# frozen_string_literal: true
|
1674
|
-
|
1675
|
-
require 'blockchyp'
|
1676
|
-
|
1677
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1678
|
-
ENV['BC_API_KEY'],
|
1679
|
-
ENV['BC_BEARER_TOKEN'],
|
1680
|
-
ENV['BC_SIGNING_KEY']
|
1681
|
-
)
|
1682
|
-
|
1683
|
-
# Set request parameters
|
1684
|
-
request = {
|
1685
|
-
test: true,
|
1686
|
-
terminalName: 'Test Terminal',
|
1687
|
-
|
1688
|
-
# Type of prompt. Can be 'email', 'phone', 'customer-number', or
|
1689
|
-
# 'rewards-number'.
|
1690
|
-
promptType: PromptType::EMAIL
|
1691
|
-
}
|
1692
|
-
|
1693
|
-
response = blockchyp.textPrompt(request)
|
1694
|
-
|
1695
|
-
puts "Response: #{response.inspect}"
|
1696
|
-
|
1697
|
-
|
1698
|
-
```
|
1699
|
-
|
1700
|
-
#### List Terminals
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
* **API Credential Types:** Merchant & Partner
|
1705
|
-
* **Required Role:** Terminal Management
|
1706
|
-
|
1707
|
-
This API returns details about terminals associated with a merchant account.
|
1708
|
-
|
1709
|
-
Status and resource information is returned for all terminals along with a preview of the
|
1710
|
-
current branding image displayed on the terminal
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
```ruby
|
1716
|
-
# frozen_string_literal: true
|
1717
|
-
|
1718
|
-
require 'blockchyp'
|
1719
|
-
|
1720
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1721
|
-
ENV['BC_API_KEY'],
|
1722
|
-
ENV['BC_BEARER_TOKEN'],
|
1723
|
-
ENV['BC_SIGNING_KEY']
|
1724
|
-
)
|
1725
|
-
|
1726
|
-
# Set request parameters
|
1727
|
-
request = {
|
1728
|
-
}
|
1729
|
-
|
1730
|
-
response = blockchyp.terminals(request)
|
1731
|
-
|
1732
|
-
puts "Response: #{response.inspect}"
|
1733
|
-
|
1734
|
-
|
1735
|
-
```
|
1736
|
-
|
1737
|
-
#### Deactivate Terminal
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
* **API Credential Types:** Merchant & Partner
|
1742
|
-
* **Required Role:** Terminal Management
|
1743
|
-
|
1744
|
-
This API deactivates a payment terminal.
|
1745
|
-
|
1746
|
-
If the terminal exists and is currently online, it will be removed from the merchant's
|
1747
|
-
terminal inventory. The terminal will be remotely cleared and factory reset.
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
```ruby
|
1753
|
-
# frozen_string_literal: true
|
1754
|
-
|
1755
|
-
require 'blockchyp'
|
1756
|
-
|
1757
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1758
|
-
ENV['BC_API_KEY'],
|
1759
|
-
ENV['BC_BEARER_TOKEN'],
|
1760
|
-
ENV['BC_SIGNING_KEY']
|
1761
|
-
)
|
1762
|
-
|
1763
|
-
# Set request parameters
|
1764
|
-
request = {
|
1765
|
-
terminalId: '<TERMINAL ID>'
|
1766
|
-
}
|
1767
|
-
|
1768
|
-
response = blockchyp.deactivateTerminal(request)
|
1769
|
-
|
1770
|
-
puts "Response: #{response.inspect}"
|
1771
|
-
|
1772
|
-
|
1773
|
-
```
|
1774
|
-
|
1775
|
-
#### Activate Terminal
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
* **API Credential Types:** Merchant & Partner
|
1780
|
-
* **Required Role:** Terminal Management
|
1781
|
-
|
1782
|
-
This API activates a payment terminal.
|
1783
|
-
|
1784
|
-
If successful, the payment terminal will restart, generate new encryption keys, and download any active
|
1785
|
-
branding assets for the merchant account it's been added to.
|
1786
|
-
|
1787
|
-
Activation requests require an activation code and a unique terminal name. All terminal names must be unique across
|
1788
|
-
a merchant account.
|
1789
|
-
|
1790
|
-
Optional Parameters
|
1791
|
-
|
1792
|
-
* **merchantId:** For partner scoped API credentials, a merchant ID is required. For merchant scoped API credentials, the merchant ID is implicit and cannot be overridden.
|
1793
|
-
* **cloudRelay:** Activates the terminal in cloud relay mode.
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
```ruby
|
1798
|
-
# frozen_string_literal: true
|
1799
|
-
|
1800
|
-
require 'blockchyp'
|
1801
|
-
|
1802
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1803
|
-
ENV['BC_API_KEY'],
|
1804
|
-
ENV['BC_BEARER_TOKEN'],
|
1805
|
-
ENV['BC_SIGNING_KEY']
|
1806
|
-
)
|
1807
|
-
|
1808
|
-
# Set request parameters
|
1809
|
-
request = {
|
1810
|
-
terminalName: 'Test Terminal',
|
1811
|
-
activationCode: '<ACTIVATION CODE>'
|
1812
|
-
}
|
1813
|
-
|
1814
|
-
response = blockchyp.activateTerminal(request)
|
1815
|
-
|
1816
|
-
puts "Response: #{response.inspect}"
|
1817
|
-
|
1818
|
-
|
1819
|
-
```
|
1820
|
-
|
1821
|
-
#### Reboot Terminal
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
* **API Credential Types:** Merchant
|
1826
|
-
* **Required Role:** Payment API Access
|
1827
|
-
|
1828
|
-
This API reboots the terminal.
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
```ruby
|
1834
|
-
# frozen_string_literal: true
|
1835
|
-
|
1836
|
-
require 'blockchyp'
|
1837
|
-
|
1838
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1839
|
-
ENV['BC_API_KEY'],
|
1840
|
-
ENV['BC_BEARER_TOKEN'],
|
1841
|
-
ENV['BC_SIGNING_KEY']
|
1842
|
-
)
|
1843
|
-
|
1844
|
-
# Set request parameters
|
1845
|
-
request = {
|
1846
|
-
terminalName: 'Test Terminal'
|
1847
|
-
}
|
1848
|
-
|
1849
|
-
response = blockchyp.reboot(request)
|
1850
|
-
|
1851
|
-
puts "Response: #{response.inspect}"
|
1852
|
-
|
1853
|
-
|
1854
|
-
```
|
1855
|
-
|
1856
|
-
### Terms & Conditions Endpoints
|
1857
|
-
|
1858
|
-
|
1859
|
-
Developers can use BlockChyp to display and capture acceptance of contracts or agreements related to transactions.
|
1860
|
-
These agreements can be any long-form contract ranging from rental agreements to HIPPA disclosures.
|
1861
|
-
|
1862
|
-
There are two basic approaches to terms and conditions capture. Merchants can store contract templates in
|
1863
|
-
BlockChyp or they can send the full agreement text as part of every API call. The right approach will largely
|
1864
|
-
depend on whether or not the system being integrated with BlockChyp already has a mechanism for organizing
|
1865
|
-
and managing agreements. For systems that already have this feature built in, it's probably not necessary
|
1866
|
-
to use Terms and Conditions.
|
1867
|
-
|
1868
|
-
When agreements are displayed on a terminal, the consumer can scroll through and read the entire agreement,
|
1869
|
-
and provide a signature. Results are returned as part of the API response, but BlockChyp also stores a
|
1870
|
-
record of the agreement including the signature image, timestamp, and the full text of the agreement that was
|
1871
|
-
agreed to.
|
1872
|
-
|
1873
|
-
The Terms and Conditions Log APIs can be used to search and retrieve acceptance records. Those records
|
1874
|
-
can also be linked to a transaction if a transaction id is provided with the original API request.
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
#### Terms & Conditions Capture
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
* **API Credential Types:** Merchant
|
1883
|
-
* **Required Role:** Terms & Conditions Management
|
1884
|
-
|
1885
|
-
This API allows you to prompt a customer to accept a legal agreement on the terminal
|
1886
|
-
and (usually) capture their signature.
|
1887
|
-
|
1888
|
-
Content for the agreement can be specified in two ways. You can reference a
|
1889
|
-
previously configured T&C template or pass in the full agreement text with every request.
|
1890
|
-
|
1891
|
-
**Using Templates**
|
1892
|
-
|
1893
|
-
If your application doesn't keep track of agreements you can leverage BlockChyp's
|
1894
|
-
template system. You can create any number of T&C Templates in the merchant dashboard
|
1895
|
-
and pass in the `tcAlias` flag to specify which one should display.
|
1896
|
-
|
1897
|
-
**Raw Content**
|
1898
|
-
|
1899
|
-
If your system keeps track of the agreement language or executes complicated merging
|
1900
|
-
and rendering logic, you can bypass our template system and pass in the full text with
|
1901
|
-
every transaction. Use `tcName` to pass in the agreement name and `tcContent` to
|
1902
|
-
pass in the contract text. Note that only plain text is supported.
|
1903
|
-
|
1904
|
-
**Bypassing Signatures**
|
1905
|
-
|
1906
|
-
Signature images are captured by default. If for some reason this doesn't fit your
|
1907
|
-
use case and you'd like to capture acceptance without actually capturing a signature image, set
|
1908
|
-
the `disableSignature` flag in the request.
|
1909
|
-
|
1910
|
-
**Terms & Conditions Log**
|
1911
|
-
|
1912
|
-
Every time a user accepts an agreement on the terminal, the signature image (if captured),
|
1913
|
-
will be uploaded to the gateway. The image will also be added to the log along with the full text of the
|
1914
|
-
agreement. This preserves the historical record in the event that standard agreements
|
1915
|
-
or templates change over time.
|
1916
|
-
|
1917
|
-
**Associating Agreements with Transactions**
|
1918
|
-
|
1919
|
-
To associate a Terms & Conditions log entry with a transaction, just pass in the
|
1920
|
-
Transaction ID or Transaction Ref for the associated transaction.
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
```ruby
|
1927
|
-
# frozen_string_literal: true
|
1928
|
-
|
1929
|
-
require 'blockchyp'
|
1930
|
-
|
1931
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1932
|
-
ENV['BC_API_KEY'],
|
1933
|
-
ENV['BC_BEARER_TOKEN'],
|
1934
|
-
ENV['BC_SIGNING_KEY']
|
1935
|
-
)
|
1936
|
-
|
1937
|
-
# Set request parameters
|
1938
|
-
request = {
|
1939
|
-
test: true,
|
1940
|
-
terminalName: 'Test Terminal',
|
1941
|
-
|
1942
|
-
# Alias for a Terms and Conditions template configured in the BlockChyp
|
1943
|
-
# dashboard.
|
1944
|
-
tcAlias: 'hippa',
|
1945
|
-
|
1946
|
-
# Name of the contract or document if not using an alias.
|
1947
|
-
tcName: 'HIPPA Disclosure',
|
1948
|
-
|
1949
|
-
# Full text of the contract or disclosure if not using an alias.
|
1950
|
-
tcContent: 'Full contract text',
|
1951
|
-
|
1952
|
-
# File format for the signature image.
|
1953
|
-
sigFormat: SignatureFormat::PNG,
|
1954
|
-
|
1955
|
-
# Width of the signature image in pixels.
|
1956
|
-
sigWidth: 200,
|
1957
|
-
|
1958
|
-
# Whether or not a signature is required. Defaults to true.
|
1959
|
-
sigRequired: true
|
1960
|
-
}
|
1961
|
-
|
1962
|
-
response = blockchyp.termsAndConditions(request)
|
1963
|
-
|
1964
|
-
puts "Response: #{response.inspect}"
|
1965
|
-
|
1966
|
-
|
1967
|
-
```
|
1968
|
-
|
1969
|
-
#### List Templates
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
* **API Credential Types:** Merchant
|
1974
|
-
* **Required Role:** Terms & Conditions Management
|
1975
|
-
|
1976
|
-
This API returns all terms and conditions templates associated with a merchant account.
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
```ruby
|
1982
|
-
# frozen_string_literal: true
|
1983
|
-
|
1984
|
-
require 'blockchyp'
|
1985
|
-
|
1986
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
1987
|
-
ENV['BC_API_KEY'],
|
1988
|
-
ENV['BC_BEARER_TOKEN'],
|
1989
|
-
ENV['BC_SIGNING_KEY']
|
1990
|
-
)
|
1991
|
-
|
1992
|
-
# Set request parameters
|
1993
|
-
request = {
|
1994
|
-
}
|
1995
|
-
|
1996
|
-
response = blockchyp.tcTemplates(request)
|
1997
|
-
|
1998
|
-
puts "Response: #{response.inspect}"
|
1999
|
-
|
2000
|
-
|
2001
|
-
```
|
2002
|
-
|
2003
|
-
#### Get Template
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
* **API Credential Types:** Merchant
|
2008
|
-
* **Required Role:** Terms & Conditions Management
|
2009
|
-
|
2010
|
-
This API returns as single terms and conditions template.
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
```ruby
|
2016
|
-
# frozen_string_literal: true
|
2017
|
-
|
2018
|
-
require 'blockchyp'
|
2019
|
-
|
2020
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2021
|
-
ENV['BC_API_KEY'],
|
2022
|
-
ENV['BC_BEARER_TOKEN'],
|
2023
|
-
ENV['BC_SIGNING_KEY']
|
2024
|
-
)
|
2025
|
-
|
2026
|
-
# Set request parameters
|
2027
|
-
request = {
|
2028
|
-
templateId: '<TEMPLATE ID>'
|
2029
|
-
}
|
2030
|
-
|
2031
|
-
response = blockchyp.tcTemplate(request)
|
2032
|
-
|
2033
|
-
puts "Response: #{response.inspect}"
|
2034
|
-
|
2035
|
-
|
2036
|
-
```
|
2037
|
-
|
2038
|
-
#### Update Template
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
* **API Credential Types:** Merchant
|
2043
|
-
* **Required Role:** Terms & Conditions Management
|
2044
|
-
|
2045
|
-
This API updates or creates a terms and conditions template.
|
2046
|
-
|
2047
|
-
Terms and conditions templates are fairly simple and essentially consist of a name, content, and alias.
|
2048
|
-
|
2049
|
-
The name is the caption that will be displayed at the top of the screen. The alias is a code or short
|
2050
|
-
description that will be used in subsequence API calls to refer to the template.
|
2051
|
-
|
2052
|
-
Content is the full text of the contract or agreement. Currently, no special formatting or
|
2053
|
-
merge behavior is supported. Only plain text is supported.
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
```ruby
|
2059
|
-
# frozen_string_literal: true
|
2060
|
-
|
2061
|
-
require 'blockchyp'
|
2062
|
-
|
2063
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2064
|
-
ENV['BC_API_KEY'],
|
2065
|
-
ENV['BC_BEARER_TOKEN'],
|
2066
|
-
ENV['BC_SIGNING_KEY']
|
2067
|
-
)
|
2068
|
-
|
2069
|
-
# Set request parameters
|
2070
|
-
request = {
|
2071
|
-
alias: 'HIPPA',
|
2072
|
-
name: 'HIPPA Disclosure',
|
2073
|
-
content: 'Lorem ipsum dolor sit amet.'
|
2074
|
-
}
|
2075
|
-
|
2076
|
-
response = blockchyp.tcUpdateTemplate(request)
|
2077
|
-
|
2078
|
-
puts "Response: #{response.inspect}"
|
2079
|
-
|
2080
|
-
|
2081
|
-
```
|
2082
|
-
|
2083
|
-
#### Delete Template
|
2084
|
-
|
2085
|
-
|
2086
|
-
|
2087
|
-
* **API Credential Types:** Merchant
|
2088
|
-
* **Required Role:** Terms & Conditions Management
|
2089
|
-
|
2090
|
-
This API deletes a terms and conditions template.
|
2091
|
-
|
2092
|
-
If a template is deleted, its alias can be reused and any previous Terms & Conditions log entry
|
2093
|
-
derived from the template being deleted is fully preserved since log entries always include
|
2094
|
-
a complete independent copy of the agreement text.
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2098
|
-
|
2099
|
-
```ruby
|
2100
|
-
# frozen_string_literal: true
|
2101
|
-
|
2102
|
-
require 'blockchyp'
|
2103
|
-
|
2104
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2105
|
-
ENV['BC_API_KEY'],
|
2106
|
-
ENV['BC_BEARER_TOKEN'],
|
2107
|
-
ENV['BC_SIGNING_KEY']
|
2108
|
-
)
|
2109
|
-
|
2110
|
-
# Set request parameters
|
2111
|
-
request = {
|
2112
|
-
templateId: '<TEMPLATE ID>'
|
2113
|
-
}
|
2114
|
-
|
2115
|
-
response = blockchyp.tcDeleteTemplate(request)
|
2116
|
-
|
2117
|
-
puts "Response: #{response.inspect}"
|
2118
|
-
|
2119
|
-
|
2120
|
-
```
|
2121
|
-
|
2122
|
-
#### Terms & Conditions Log
|
2123
|
-
|
2124
|
-
|
2125
|
-
|
2126
|
-
* **API Credential Types:** Merchant
|
2127
|
-
* **Required Role:** Terms & Conditions Management
|
2128
|
-
|
2129
|
-
This API allows developers to search and sort through terms and conditions log entries.
|
2130
|
-
|
2131
|
-
The default API call with no parameters will return the last 250 log entries in descending order.
|
2132
|
-
|
2133
|
-
Optional parameters can be used to filter and query the data set.
|
2134
|
-
|
2135
|
-
* **transactionId:** If provided, returns only those log entries associated with a specific transactions. Paging and date filters are ignored if this parameter is used.
|
2136
|
-
* **maxResults:** The max number of results to return in a single page. Defaults to 250 and 250 is the maximum value.
|
2137
|
-
* **startIndex** The zero based start index of results within the full result set to return. Used to advance pages. For example, if the page size is 10 and you wish to return the second page of results, send a startIndex of 10.
|
2138
|
-
* **startDate**: An optional start date for results provided as an ISO 8601 timestamp. (e.g. 2022-05-24T13:51:38+00:00)
|
2139
|
-
* **endDate**: An optional end date for results provided as an ISO 8601 timestamp. (e.g. 2022-05-24T13:51:38+00:00)
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
```ruby
|
2145
|
-
# frozen_string_literal: true
|
2146
|
-
|
2147
|
-
require 'blockchyp'
|
2148
|
-
|
2149
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2150
|
-
ENV['BC_API_KEY'],
|
2151
|
-
ENV['BC_BEARER_TOKEN'],
|
2152
|
-
ENV['BC_SIGNING_KEY']
|
2153
|
-
)
|
2154
|
-
|
2155
|
-
# Set request parameters
|
2156
|
-
request = {
|
2157
|
-
logEntryId: '<LOG ENTRY ID>'
|
2158
|
-
}
|
2159
|
-
|
2160
|
-
response = blockchyp.tcLog(request)
|
2161
|
-
|
2162
|
-
puts "Response: #{response.inspect}"
|
2163
|
-
|
2164
|
-
|
2165
|
-
```
|
2166
|
-
|
2167
|
-
#### Terms & Conditions Details
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
* **API Credential Types:** Merchant
|
2172
|
-
* **Required Role:** Terms & Conditions Management
|
2173
|
-
|
2174
|
-
This API returns details for a single terms and conditions log entry. The `logEntryId` of the record to be returned is the only required parameter.
|
2175
|
-
|
2176
|
-
The signature image is returned as Base 64 encoded binary in the image format specified by the `sigFormat` field.
|
2177
|
-
The default format is PNG.
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
```ruby
|
2183
|
-
# frozen_string_literal: true
|
2184
|
-
|
2185
|
-
require 'blockchyp'
|
2186
|
-
|
2187
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2188
|
-
ENV['BC_API_KEY'],
|
2189
|
-
ENV['BC_BEARER_TOKEN'],
|
2190
|
-
ENV['BC_SIGNING_KEY']
|
2191
|
-
)
|
2192
|
-
|
2193
|
-
# Set request parameters
|
2194
|
-
request = {
|
2195
|
-
logEntryId: '<ENTRY ID>'
|
2196
|
-
}
|
2197
|
-
|
2198
|
-
response = blockchyp.tcEntry(request)
|
2199
|
-
|
2200
|
-
puts "Response: #{response.inspect}"
|
2201
|
-
|
2202
|
-
|
2203
|
-
```
|
2204
|
-
|
2205
|
-
### Token Management
|
2206
|
-
|
2207
|
-
|
2208
|
-
BlockChyp supports saved payments and recurring payments through the use of tokens. Tokens can be created
|
2209
|
-
via the Enroll API or the web tokenizer. Once created, these tokens can be used for subsequent payments
|
2210
|
-
or associated with customer records as saved payment methods.
|
2211
|
-
|
2212
|
-
Tokens are limited to a single merchant by default, but can be shared across an organization for multi-location
|
2213
|
-
merchants by special arrangement with BlockChyp. Contact your BlockChyp rep to setup token sharing.
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
#### Enroll
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
* **API Credential Types:** Merchant
|
2222
|
-
* **Required Role:** Payment API Access
|
2223
|
-
|
2224
|
-
This API allows you to tokenize and enroll a payment method in the token
|
2225
|
-
vault. You can also pass in customer information and associate the
|
2226
|
-
payment method with a customer record.
|
2227
|
-
|
2228
|
-
A token is returned in the response that can be used in subsequent charge,
|
2229
|
-
preauth, and refund transactions.
|
2230
|
-
|
2231
|
-
**Gift Cards and EBT**
|
2232
|
-
|
2233
|
-
Gift Cards and EBT cards cannot be tokenized.
|
2234
|
-
|
2235
|
-
**E-Commerce Tokens**
|
2236
|
-
|
2237
|
-
The tokens returned by the enroll API and the e-commerce web tokenizer
|
2238
|
-
are the same tokens and can be used interchangeably.
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
```ruby
|
2244
|
-
# frozen_string_literal: true
|
2245
|
-
|
2246
|
-
require 'blockchyp'
|
2247
|
-
|
2248
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2249
|
-
ENV['BC_API_KEY'],
|
2250
|
-
ENV['BC_BEARER_TOKEN'],
|
2251
|
-
ENV['BC_SIGNING_KEY']
|
2252
|
-
)
|
2253
|
-
|
2254
|
-
# Set request parameters
|
2255
|
-
request = {
|
2256
|
-
test: true,
|
2257
|
-
terminalName: 'Test Terminal'
|
2258
|
-
}
|
2259
|
-
|
2260
|
-
response = blockchyp.enroll(request)
|
2261
|
-
|
2262
|
-
puts "Response: #{response.inspect}"
|
2263
|
-
|
2264
|
-
|
2265
|
-
```
|
2266
|
-
|
2267
|
-
#### Token Metadata
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
* **API Credential Types:** Merchant
|
2272
|
-
* **Required Role:** Payment API Access
|
2273
|
-
|
2274
|
-
This API retrieves status and metadata information about a token,
|
2275
|
-
including any links to customer records.
|
2276
|
-
|
2277
|
-
This will also return any customer records related to the card
|
2278
|
-
behind the token. If the underlying card has been tokenized
|
2279
|
-
multiple times, all customers related to the card will be returned,
|
2280
|
-
even if those customer associations are related to other tokens.
|
2281
|
-
|
2282
|
-
|
2283
|
-
|
2284
|
-
|
2285
|
-
```ruby
|
2286
|
-
# frozen_string_literal: true
|
2287
|
-
|
2288
|
-
require 'blockchyp'
|
2289
|
-
|
2290
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2291
|
-
ENV['BC_API_KEY'],
|
2292
|
-
ENV['BC_BEARER_TOKEN'],
|
2293
|
-
ENV['BC_SIGNING_KEY']
|
2294
|
-
)
|
2295
|
-
|
2296
|
-
# Set request parameters
|
2297
|
-
request = {
|
2298
|
-
token: '<TOKEN>'
|
2299
|
-
}
|
2300
|
-
|
2301
|
-
response = blockchyp.tokenMetadata(request)
|
2302
|
-
|
2303
|
-
puts "Response: #{response.inspect}"
|
2304
|
-
|
2305
|
-
|
2306
|
-
```
|
2307
|
-
|
2308
|
-
#### Link Token
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
* **API Credential Types:** Merchant
|
2313
|
-
* **Required Role:** Payment API Access
|
2314
|
-
|
2315
|
-
This API links a payment token with a customer record. Usually this would only be needed
|
2316
|
-
to reverse a previous unlink operation.
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
```ruby
|
2322
|
-
# frozen_string_literal: true
|
2323
|
-
|
2324
|
-
require 'blockchyp'
|
2325
|
-
|
2326
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2327
|
-
ENV['BC_API_KEY'],
|
2328
|
-
ENV['BC_BEARER_TOKEN'],
|
2329
|
-
ENV['BC_SIGNING_KEY']
|
2330
|
-
)
|
2331
|
-
|
2332
|
-
# Set request parameters
|
2333
|
-
request = {
|
2334
|
-
token: '<TOKEN>',
|
2335
|
-
customerId: '<CUSTOMER ID>'
|
2336
|
-
}
|
2337
|
-
|
2338
|
-
response = blockchyp.linkToken(request)
|
2339
|
-
|
2340
|
-
puts "Response: #{response.inspect}"
|
2341
|
-
|
2342
|
-
|
2343
|
-
```
|
2344
|
-
|
2345
|
-
#### Unlink Token
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
* **API Credential Types:** Merchant
|
2350
|
-
* **Required Role:** Payment API Access
|
2351
|
-
|
2352
|
-
This API removes a payment token link from a customer record.
|
2353
|
-
|
2354
|
-
This will remove links between the customer record and all tokens
|
2355
|
-
for the same underlying card.
|
2356
|
-
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2360
|
-
```ruby
|
2361
|
-
# frozen_string_literal: true
|
2362
|
-
|
2363
|
-
require 'blockchyp'
|
2364
|
-
|
2365
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2366
|
-
ENV['BC_API_KEY'],
|
2367
|
-
ENV['BC_BEARER_TOKEN'],
|
2368
|
-
ENV['BC_SIGNING_KEY']
|
2369
|
-
)
|
2370
|
-
|
2371
|
-
# Set request parameters
|
2372
|
-
request = {
|
2373
|
-
token: '<TOKEN>',
|
2374
|
-
customerId: '<CUSTOMER ID>'
|
2375
|
-
}
|
2376
|
-
|
2377
|
-
response = blockchyp.unlinkToken(request)
|
2378
|
-
|
2379
|
-
puts "Response: #{response.inspect}"
|
2380
|
-
|
2381
|
-
|
2382
|
-
```
|
2383
|
-
|
2384
|
-
#### Delete Token
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
* **API Credential Types:** Merchant
|
2389
|
-
* **Required Role:** Payment API Access
|
2390
|
-
|
2391
|
-
This API deletes a payment token from the gateway. Tokens are automatically deleted if they have not been used
|
2392
|
-
for a year.
|
2393
|
-
|
2394
|
-
|
2395
|
-
|
2396
|
-
|
2397
|
-
```ruby
|
2398
|
-
# frozen_string_literal: true
|
2399
|
-
|
2400
|
-
require 'blockchyp'
|
2401
|
-
|
2402
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2403
|
-
ENV['BC_API_KEY'],
|
2404
|
-
ENV['BC_BEARER_TOKEN'],
|
2405
|
-
ENV['BC_SIGNING_KEY']
|
2406
|
-
)
|
2407
|
-
|
2408
|
-
# Set request parameters
|
2409
|
-
request = {
|
2410
|
-
token: '<TOKEN>'
|
2411
|
-
}
|
2412
|
-
|
2413
|
-
response = blockchyp.deleteToken(request)
|
2414
|
-
|
2415
|
-
puts "Response: #{response.inspect}"
|
2416
|
-
|
2417
|
-
|
2418
|
-
```
|
2419
|
-
|
2420
|
-
### Customer Endpoints
|
2421
|
-
|
2422
|
-
|
2423
|
-
These APIs allow developers to create and manage customer records in BlockChyp. Developers who wish to use
|
2424
|
-
BlockChyp for tokenized recurring payments can use tokens directly if they have their own customer management
|
2425
|
-
system. However, BlockChyp provides additional tools for managing customers and keeping track of a customer's saved
|
2426
|
-
payment tokens.
|
2427
|
-
|
2428
|
-
In addition, if customer features are used, BlockChyp can detect a payment method associated with an existing
|
2429
|
-
customer, and return customer data with payment transactions. This can be used as a passive method to detect
|
2430
|
-
repeat customers.
|
2431
|
-
|
2432
|
-
|
2433
|
-
|
2434
|
-
#### Update Customer
|
2435
|
-
|
2436
|
-
|
2437
|
-
|
2438
|
-
* **API Credential Types:** Merchant
|
2439
|
-
* **Required Role:** Payment API Access
|
2440
|
-
|
2441
|
-
This API adds or updates a customer record.
|
2442
|
-
|
2443
|
-
If you pass in customer information including `firstName`, `lastName`, `email`,
|
2444
|
-
or `sms` without any Customer ID or Customer Ref, a new record will
|
2445
|
-
be created.
|
2446
|
-
|
2447
|
-
If you pass in `customerRef` and `customerId`, the customer record will be updated
|
2448
|
-
if it exists.
|
2449
|
-
|
2450
|
-
**Customer Ref**
|
2451
|
-
|
2452
|
-
The `customerRef` field is optional, but highly recommended as this allows you
|
2453
|
-
to use your own customer identifiers instead of storing BlockChyp's Customer IDs
|
2454
|
-
in your systems.
|
2455
|
-
|
2456
|
-
**Creating Customer Records With Payment Transactions**
|
2457
|
-
|
2458
|
-
If you have customer information available at the time a payment transaction is
|
2459
|
-
executed, you can pass all the same customer information directly into a payment transaction. BlockChyp
|
2460
|
-
will create a customer record at the same time payment is captured. The advantage of this approach is
|
2461
|
-
that the customer's payment card is automatically associated with the customer record in a single step.
|
2462
|
-
If the customer uses the payment card in the future, the customer data will automatically
|
2463
|
-
be returned. You won't need to ask the customer to provide any additional information.
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
```ruby
|
2469
|
-
# frozen_string_literal: true
|
2470
|
-
|
2471
|
-
require 'blockchyp'
|
2472
|
-
|
2473
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2474
|
-
ENV['BC_API_KEY'],
|
2475
|
-
ENV['BC_BEARER_TOKEN'],
|
2476
|
-
ENV['BC_SIGNING_KEY']
|
2477
|
-
)
|
2478
|
-
|
2479
|
-
# Set request parameters
|
2480
|
-
request = {
|
2481
|
-
customer: {
|
2482
|
-
id: '<CUSTOMER ID>',
|
2483
|
-
customerRef: 'Customer reference string',
|
2484
|
-
firstName: 'FirstName',
|
2485
|
-
lastName: 'LastName',
|
2486
|
-
companyName: 'Company Name',
|
2487
|
-
emailAddress: 'notifications@blockchypteam.m8r.co',
|
2488
|
-
smsNumber: '(123) 123-1231'
|
2489
|
-
}
|
2490
|
-
}
|
2491
|
-
|
2492
|
-
response = blockchyp.updateCustomer(request)
|
2493
|
-
|
2494
|
-
puts "Response: #{response.inspect}"
|
2495
|
-
|
2496
|
-
|
2497
|
-
```
|
2498
|
-
|
2499
|
-
#### Retrieve Customer
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
* **API Credential Types:** Merchant
|
2504
|
-
* **Required Role:** Payment API Access
|
2505
|
-
|
2506
|
-
With this API, you can retrieve detailed information about a customer record, including saved payment
|
2507
|
-
methods if available.
|
2508
|
-
|
2509
|
-
Customers can be looked up by `customerId` or `customerRef`.
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
|
2514
|
-
```ruby
|
2515
|
-
# frozen_string_literal: true
|
2516
|
-
|
2517
|
-
require 'blockchyp'
|
2518
|
-
|
2519
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2520
|
-
ENV['BC_API_KEY'],
|
2521
|
-
ENV['BC_BEARER_TOKEN'],
|
2522
|
-
ENV['BC_SIGNING_KEY']
|
2523
|
-
)
|
2524
|
-
|
2525
|
-
# Set request parameters
|
2526
|
-
request = {
|
2527
|
-
customerId: '<CUSTOMER ID>'
|
2528
|
-
}
|
2529
|
-
|
2530
|
-
response = blockchyp.customer(request)
|
2531
|
-
|
2532
|
-
puts "Response: #{response.inspect}"
|
2533
|
-
|
2534
|
-
|
2535
|
-
```
|
2536
|
-
|
2537
|
-
#### Search Customer
|
2538
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
* **API Credential Types:** Merchant
|
2542
|
-
* **Required Role:** Payment API Access
|
2543
|
-
|
2544
|
-
This API searches the customer database and returns matching results.
|
2545
|
-
|
2546
|
-
Use `query` to pass in a search string and the system will return all results whose
|
2547
|
-
first or last names contain the query string.
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
```ruby
|
2553
|
-
# frozen_string_literal: true
|
2554
|
-
|
2555
|
-
require 'blockchyp'
|
2556
|
-
|
2557
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2558
|
-
ENV['BC_API_KEY'],
|
2559
|
-
ENV['BC_BEARER_TOKEN'],
|
2560
|
-
ENV['BC_SIGNING_KEY']
|
2561
|
-
)
|
2562
|
-
|
2563
|
-
# Set request parameters
|
2564
|
-
request = {
|
2565
|
-
query: '(123) 123-1234'
|
2566
|
-
}
|
2567
|
-
|
2568
|
-
response = blockchyp.customerSearch(request)
|
2569
|
-
|
2570
|
-
puts "Response: #{response.inspect}"
|
2571
|
-
|
2572
|
-
|
2573
|
-
```
|
2574
|
-
|
2575
|
-
#### Delete Customer
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
* **API Credential Types:** Merchant
|
2580
|
-
* **Required Role:** Payment API Access
|
2581
|
-
|
2582
|
-
This API deletes a customer record.
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
```ruby
|
2588
|
-
# frozen_string_literal: true
|
2589
|
-
|
2590
|
-
require 'blockchyp'
|
2591
|
-
|
2592
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2593
|
-
ENV['BC_API_KEY'],
|
2594
|
-
ENV['BC_BEARER_TOKEN'],
|
2595
|
-
ENV['BC_SIGNING_KEY']
|
2596
|
-
)
|
2597
|
-
|
2598
|
-
# Set request parameters
|
2599
|
-
request = {
|
2600
|
-
customerId: '<CUSTOMER ID>'
|
2601
|
-
}
|
2602
|
-
|
2603
|
-
response = blockchyp.deleteCustomer(request)
|
2604
|
-
|
2605
|
-
puts "Response: #{response.inspect}"
|
2606
|
-
|
2607
|
-
|
2608
|
-
```
|
28
|
+
blockchyp = BlockChyp.new("SPBXTSDAQVFFX5MGQMUMIRINVI", "7BXBTBUPSL3BP7I6Z2CFU6H3WQ", "bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e")
|
2609
29
|
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
Merchants can optionally configure scaled (1-5) or yes/no questions that can be presented to consumers
|
2616
|
-
after every approved Charge and Preauth transaction. Surveys do not require any custom programming and
|
2617
|
-
merchants can simply configure them without the point-of-sale system needing any additional customization.
|
2618
|
-
|
2619
|
-
However, these APIs allow point-of-sale or third-party system developers to integrate survey question configuration
|
2620
|
-
or result visualization into their own systems.
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
#### List Questions
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
* **API Credential Types:** Merchant
|
2629
|
-
* **Required Role:** Survey Management
|
2630
|
-
|
2631
|
-
This API returns all survey questions in the order in which they would be presented on the terminal.
|
2632
|
-
|
2633
|
-
All questions are returned, whether enabled or disabled.
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
```ruby
|
2639
|
-
# frozen_string_literal: true
|
2640
|
-
|
2641
|
-
require 'blockchyp'
|
2642
|
-
|
2643
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2644
|
-
ENV['BC_API_KEY'],
|
2645
|
-
ENV['BC_BEARER_TOKEN'],
|
2646
|
-
ENV['BC_SIGNING_KEY']
|
2647
|
-
)
|
2648
|
-
|
2649
|
-
# Set request parameters
|
2650
|
-
request = {
|
2651
|
-
}
|
2652
|
-
|
2653
|
-
response = blockchyp.surveyQuestions(request)
|
2654
|
-
|
2655
|
-
puts "Response: #{response.inspect}"
|
2656
|
-
|
2657
|
-
|
2658
|
-
```
|
2659
|
-
|
2660
|
-
#### Question Details
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
* **API Credential Types:** Merchant
|
2665
|
-
* **Required Role:** Survey Management
|
2666
|
-
|
2667
|
-
This API returns a single survey question with response data. `questionId` is required.
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
```ruby
|
2673
|
-
# frozen_string_literal: true
|
2674
|
-
|
2675
|
-
require 'blockchyp'
|
2676
|
-
|
2677
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2678
|
-
ENV['BC_API_KEY'],
|
2679
|
-
ENV['BC_BEARER_TOKEN'],
|
2680
|
-
ENV['BC_SIGNING_KEY']
|
2681
|
-
)
|
2682
|
-
|
2683
|
-
# Set request parameters
|
2684
|
-
request = {
|
2685
|
-
questionId: '<QUESTION ID>'
|
2686
|
-
}
|
2687
|
-
|
2688
|
-
response = blockchyp.surveyQuestion(request)
|
2689
|
-
|
2690
|
-
puts "Response: #{response.inspect}"
|
2691
|
-
|
2692
|
-
|
2693
|
-
```
|
2694
|
-
|
2695
|
-
#### Update Question
|
2696
|
-
|
2697
|
-
|
2698
|
-
|
2699
|
-
* **API Credential Types:** Merchant
|
2700
|
-
* **Required Role:** Survey Management
|
2701
|
-
|
2702
|
-
This API updates or creates survey questions. `questionText` and `questionType` are required
|
2703
|
-
fields. The following values are valid for `questionType`.
|
2704
|
-
|
2705
|
-
* **yes_no:** Use for simple yes or no questions.
|
2706
|
-
* **scaled:** Displays the question with buttons that allow the customer to respond with values from 1 through 5.
|
2707
|
-
|
2708
|
-
Questions are disabled by default. Pass in `enabled` to enable a question.
|
2709
|
-
|
2710
|
-
The `ordinal` field is used to control the sequence of questions when multiple questions are enabled. We recommend keeping
|
2711
|
-
the number of questions minimal.
|
2712
|
-
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
```ruby
|
2717
|
-
# frozen_string_literal: true
|
2718
|
-
|
2719
|
-
require 'blockchyp'
|
2720
|
-
|
2721
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2722
|
-
ENV['BC_API_KEY'],
|
2723
|
-
ENV['BC_BEARER_TOKEN'],
|
2724
|
-
ENV['BC_SIGNING_KEY']
|
2725
|
-
)
|
2726
|
-
|
2727
|
-
# Set request parameters
|
2728
|
-
request = {
|
2729
|
-
id: '<QUESTION ID>',
|
2730
|
-
ordinal: 1,
|
2731
|
-
questionText: 'Would you shop here again?',
|
2732
|
-
questionType: 'yes_no',
|
2733
|
-
enabled: true
|
2734
|
-
}
|
2735
|
-
|
2736
|
-
response = blockchyp.updateSurveyQuestion(request)
|
2737
|
-
|
2738
|
-
puts "Response: #{response.inspect}"
|
2739
|
-
|
2740
|
-
|
2741
|
-
```
|
2742
|
-
|
2743
|
-
#### Delete Question
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
* **API Credential Types:** Merchant
|
2748
|
-
* **Required Role:** Survey Management
|
2749
|
-
|
2750
|
-
This API deletes a survey question. `questionId` is a required parameter.
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2755
|
-
```ruby
|
2756
|
-
# frozen_string_literal: true
|
2757
|
-
|
2758
|
-
require 'blockchyp'
|
2759
|
-
|
2760
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2761
|
-
ENV['BC_API_KEY'],
|
2762
|
-
ENV['BC_BEARER_TOKEN'],
|
2763
|
-
ENV['BC_SIGNING_KEY']
|
2764
|
-
)
|
2765
|
-
|
2766
|
-
# Set request parameters
|
2767
|
-
request = {
|
2768
|
-
questionId: '<QUESTION ID>'
|
2769
|
-
}
|
2770
|
-
|
2771
|
-
response = blockchyp.deleteSurveyQuestion(request)
|
2772
|
-
|
2773
|
-
puts "Response: #{response.inspect}"
|
2774
|
-
|
2775
|
-
|
2776
|
-
```
|
2777
|
-
|
2778
|
-
#### Survey Results
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
* **API Credential Types:** Merchant
|
2783
|
-
* **Required Role:** Survey Management
|
2784
|
-
|
2785
|
-
This API returns survey results for a single question.
|
2786
|
-
|
2787
|
-
The results returned include the response rate, which is the percentage of transactions after which
|
2788
|
-
the consumer provided an answer.
|
2789
|
-
|
2790
|
-
The `responses` array breaks down the results by answer, providing the total number of responses,
|
2791
|
-
the answer's percentage of the total, and the average transaction amount associated with a specific
|
2792
|
-
answer.
|
2793
|
-
|
2794
|
-
By default, all results based on all responses are returned. However, developers may optionally provide
|
2795
|
-
`startDate` and `endDate` parameters to return only responses provided between certain dates.
|
2796
|
-
|
2797
|
-
`startDate` and `endDate` can be provided in MM/DD/YYYY or YYYY-MM-DD format.
|
2798
|
-
|
2799
|
-
|
2800
|
-
|
2801
|
-
|
2802
|
-
```ruby
|
2803
|
-
# frozen_string_literal: true
|
2804
|
-
|
2805
|
-
require 'blockchyp'
|
2806
|
-
|
2807
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2808
|
-
ENV['BC_API_KEY'],
|
2809
|
-
ENV['BC_BEARER_TOKEN'],
|
2810
|
-
ENV['BC_SIGNING_KEY']
|
2811
|
-
)
|
2812
|
-
|
2813
|
-
# Set request parameters
|
2814
|
-
request = {
|
2815
|
-
questionId: '<QUESTION ID>'
|
2816
|
-
}
|
2817
|
-
|
2818
|
-
response = blockchyp.surveyResults(request)
|
2819
|
-
|
2820
|
-
puts "Response: #{response.inspect}"
|
2821
|
-
|
2822
|
-
|
2823
|
-
```
|
2824
|
-
|
2825
|
-
### Media and Branding Control
|
2826
|
-
|
2827
|
-
|
2828
|
-
BlockChyp has a sophisticated terminal media and branding control platform. Terminals can be configured to
|
2829
|
-
display logos, images, videos, and slide shows when a terminal is idle. Branding assets can be configured
|
2830
|
-
at the partner, organization, and merchant level with fine-grained hour-by-hour schedules, if desired.
|
2831
|
-
|
2832
|
-
Conceptually, all branding and media start with the media library. Merchants, Partners, and Organizations can
|
2833
|
-
upload images or video and build branding assets from uploaded media.
|
2834
|
-
|
2835
|
-
Slide shows can combine images from the media library into a timed loop of repeating images.
|
2836
|
-
|
2837
|
-
Branding Assets can then be used to combine media or slide shows with priority and timing rules to create what
|
2838
|
-
we call the Terminal Branding Stack.
|
2839
|
-
|
2840
|
-
We call a group of branding assets the *Terminal Branding Stack* because there are implicit rules about which
|
2841
|
-
branding assets take priority. For example, a merchant with no branding assets configured will inherit the
|
2842
|
-
branding rules from any organization to which the merchant may belong. If the merchant doesn't belong to an organization
|
2843
|
-
or the organization has no branding rules configured, then the system will defer to branding defaults established
|
2844
|
-
by the point-of-sale or software partner that owns the merchant.
|
2845
|
-
|
2846
|
-
This feature enables partners and organizations (multi-store operators and large national chains) to configure branding
|
2847
|
-
for potentially thousands of terminals from a single interface.
|
2848
|
-
|
2849
|
-
Terminal Branding can also be configured at the individual terminal level and a merchant's terminal fleet
|
2850
|
-
can be broken into groups and branding configured at the group level. Branding configured at the terminal
|
2851
|
-
level will always override branding from any higher level group.
|
2852
|
-
|
2853
|
-
The order of priority for the Terminal Branding Stack is given below.
|
2854
|
-
|
2855
|
-
* Terminal
|
2856
|
-
* Terminal Group
|
2857
|
-
* Merchant
|
2858
|
-
* Organization (Region, Chain, etc)
|
2859
|
-
* Partner
|
2860
|
-
* BlockChyp Default Logo
|
2861
|
-
|
2862
|
-
|
2863
|
-
|
2864
|
-
#### Media Library
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
2869
|
-
* **Required Role:** Media Management
|
2870
|
-
|
2871
|
-
This API returns the entire media library associated with the API Credentials (Merchant, Partner, or Organization). The media library results will include the ID used
|
2872
|
-
to reference a media asset in slide shows and branding assets along with the full file url and thumbnail.
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
```ruby
|
2878
|
-
# frozen_string_literal: true
|
2879
|
-
|
2880
|
-
require 'blockchyp'
|
2881
|
-
|
2882
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2883
|
-
ENV['BC_API_KEY'],
|
2884
|
-
ENV['BC_BEARER_TOKEN'],
|
2885
|
-
ENV['BC_SIGNING_KEY']
|
2886
|
-
)
|
2887
|
-
|
2888
|
-
# Set request parameters
|
2889
|
-
request = {
|
2890
|
-
}
|
2891
|
-
|
2892
|
-
response = blockchyp.media(request)
|
2893
|
-
|
2894
|
-
puts "Response: #{response.inspect}"
|
2895
|
-
|
2896
|
-
|
2897
|
-
```
|
2898
|
-
|
2899
|
-
#### Upload Media
|
2900
|
-
|
2901
|
-
|
2902
|
-
|
2903
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
2904
|
-
* **Required Role:** Media Management
|
2905
|
-
|
2906
|
-
This API supports media library uploads. The operation of this API works slightly differently depending
|
2907
|
-
on the SDK platform. In all cases, the intent is to allow the file's binary to be passed into the SDK using
|
2908
|
-
the lowest level I/O primitive possible in order to support situations where developers aren't working
|
2909
|
-
with literal files. It might be (and usually is) more convenient to work with buffers, raw bytes, or streams.
|
2910
|
-
|
2911
|
-
For example, the Go implementation accepts an `io.Reader` and the Java implementation accepts a
|
2912
|
-
`java.io.InputStream`. The CLI does accept a literal File URL via the `-file` command line parameter.
|
2913
|
-
|
2914
|
-
The following file formats are accepted as valid uploads:
|
2915
|
-
|
2916
|
-
* .png
|
2917
|
-
* .jpg
|
2918
|
-
* .jpeg
|
2919
|
-
* .gif
|
2920
|
-
* .mov
|
2921
|
-
* .mpg
|
2922
|
-
* .mp4
|
2923
|
-
* .mpeg
|
2924
|
-
|
2925
|
-
The UploadMetadata object allows developers to pass additional metadata about the upload including
|
2926
|
-
`fileName`, `fileSize`, and `uploadId`.
|
2927
|
-
|
2928
|
-
None of these values are required, but providing them can unlock some additional functionality relating to
|
2929
|
-
media uploads. `fileName` will be used to record the original file name in the media library. `fileSize`
|
2930
|
-
and `uploadId` are used to support upload status tracking, which is especially useful for large video file
|
2931
|
-
uploads.
|
2932
|
-
|
2933
|
-
The `fileSize` should be the file's full size in bytes.
|
2934
|
-
|
2935
|
-
The `uploadId` value can be any random string. This is the value you'll use to check the status of an upload
|
2936
|
-
via the Upload Status API. This API will return information needed to drive progress feedback on uploads and
|
2937
|
-
return video transcoding information.
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
```ruby
|
2943
|
-
# frozen_string_literal: true
|
2944
|
-
|
2945
|
-
require 'blockchyp'
|
2946
|
-
|
2947
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2948
|
-
ENV['BC_API_KEY'],
|
2949
|
-
ENV['BC_BEARER_TOKEN'],
|
2950
|
-
ENV['BC_SIGNING_KEY']
|
2951
|
-
)
|
2952
|
-
|
2953
|
-
# Set request parameters
|
2954
|
-
request = {
|
2955
|
-
fileName: 'aviato.png',
|
2956
|
-
fileSize: 18843,
|
2957
|
-
uploadId: '<RANDOM ID>'
|
2958
|
-
}
|
2959
|
-
|
2960
|
-
file = File.open("aviato.png")
|
2961
|
-
content = file.read
|
2962
|
-
response = blockchyp.uploadMedia(request, content)
|
2963
|
-
|
2964
|
-
puts "Response: #{response.inspect}"
|
2965
|
-
|
2966
|
-
|
2967
|
-
```
|
2968
|
-
|
2969
|
-
#### Upload Status
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
2974
|
-
* **Required Role:** Media Management
|
2975
|
-
|
2976
|
-
This API returns status and progress information about in progress or recently completed uploads.
|
2977
|
-
|
2978
|
-
Before calling this API, developers must first start a file upload with `fileSize` and `uploadId` parameters.
|
2979
|
-
|
2980
|
-
The data structure returned will include the file size, number of bytes uploaded, a narrative status
|
2981
|
-
and flags indicating whether or not the upload is complete or post upload processing is in progress.
|
2982
|
-
If the upload is completed, the ID assigned to the media asset and a link to the thumbnail image will
|
2983
|
-
also be returned.
|
2984
|
-
|
2985
|
-
|
2986
|
-
|
2987
|
-
|
2988
|
-
```ruby
|
2989
|
-
# frozen_string_literal: true
|
2990
|
-
|
2991
|
-
require 'blockchyp'
|
2992
|
-
|
2993
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
2994
|
-
ENV['BC_API_KEY'],
|
2995
|
-
ENV['BC_BEARER_TOKEN'],
|
2996
|
-
ENV['BC_SIGNING_KEY']
|
2997
|
-
)
|
2998
|
-
|
2999
|
-
# Set request parameters
|
3000
|
-
request = {
|
3001
|
-
uploadId: '<UPLOAD ID>'
|
3002
|
-
}
|
3003
|
-
|
3004
|
-
response = blockchyp.uploadStatus(request)
|
3005
|
-
|
3006
|
-
puts "Response: #{response.inspect}"
|
3007
|
-
|
3008
|
-
|
3009
|
-
```
|
3010
|
-
|
3011
|
-
#### Get Media Asset
|
3012
|
-
|
3013
|
-
|
3014
|
-
|
3015
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
3016
|
-
* **Required Role:** Media Management
|
3017
|
-
|
3018
|
-
This API returns a detailed media asset. The data returned includes the exact same media information returned
|
3019
|
-
by the full media library endpoint, including fully qualified URLs pointing to the original media file
|
3020
|
-
and the thumbnail.
|
3021
|
-
|
3022
|
-
|
3023
|
-
|
3024
|
-
|
3025
|
-
```ruby
|
3026
|
-
# frozen_string_literal: true
|
3027
|
-
|
3028
|
-
require 'blockchyp'
|
3029
|
-
|
3030
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
3031
|
-
ENV['BC_API_KEY'],
|
3032
|
-
ENV['BC_BEARER_TOKEN'],
|
3033
|
-
ENV['BC_SIGNING_KEY']
|
3034
|
-
)
|
3035
|
-
|
3036
|
-
# Set request parameters
|
3037
|
-
request = {
|
3038
|
-
mediaId: '<MEDIA ASSET ID>'
|
3039
|
-
}
|
3040
|
-
|
3041
|
-
response = blockchyp.mediaAsset(request)
|
3042
|
-
|
3043
|
-
puts "Response: #{response.inspect}"
|
3044
|
-
|
3045
|
-
|
3046
|
-
```
|
3047
|
-
|
3048
|
-
#### Delete Media Asset
|
3049
|
-
|
3050
|
-
|
3051
|
-
|
3052
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
3053
|
-
* **Required Role:** Media Management
|
3054
|
-
|
3055
|
-
This API deletes a media asset. Note that a media asset cannot be deleted if it is in use in a slide
|
3056
|
-
show or in the terminal branding stack.
|
3057
|
-
|
3058
|
-
|
3059
|
-
|
3060
|
-
|
3061
|
-
```ruby
|
3062
|
-
# frozen_string_literal: true
|
3063
|
-
|
3064
|
-
require 'blockchyp'
|
3065
|
-
|
3066
|
-
blockchyp = BlockChyp::BlockChyp.new(
|
3067
|
-
ENV['BC_API_KEY'],
|
3068
|
-
ENV['BC_BEARER_TOKEN'],
|
3069
|
-
ENV['BC_SIGNING_KEY']
|
3070
|
-
)
|
3071
|
-
|
3072
|
-
# Set request parameters
|
3073
|
-
request = {
|
3074
|
-
mediaId: '<MEDIA ASSET ID>'
|
3075
|
-
}
|
3076
|
-
|
3077
|
-
response = blockchyp.deleteMediaAsset(request)
|
3078
|
-
|
3079
|
-
puts "Response: #{response.inspect}"
|
3080
|
-
|
3081
|
-
|
3082
|
-
```
|
30
|
+
# setup request object
|
31
|
+
request = Hash.new
|
32
|
+
request["test"] = true
|
33
|
+
request["terminalName"] = "Test Terminal"
|
34
|
+
request["amount"] = "55.00"
|
3083
35
|
|
3084
|
-
|
36
|
+
response = blockchyp.charge(request)
|
3085
37
|
|
38
|
+
if (response["approved"])
|
39
|
+
puts "Approved"
|
40
|
+
puts "authCode:" + response["authCode"]
|
41
|
+
puts "authorizedAmount:" + response["authorizedAmount"]
|
42
|
+
end
|
43
|
+
```
|
3086
44
|
|
3087
45
|
|
3088
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
3089
|
-
* **Required Role:** Media Management
|
3090
46
|
|
3091
|
-
|
47
|
+
## The Rest APIs
|
3092
48
|
|
3093
|
-
|
49
|
+
All BlockChyp SDKs provide a convenient way of accessing the BlockChyp REST APIs.
|
50
|
+
You can checkout the REST API documentation via the links below.
|
3094
51
|
|
52
|
+
[Terminal REST API Docs](https://docs.blockchyp.com/rest-api/terminal/index.html)
|
3095
53
|
|
54
|
+
[Gateway REST API Docs](https://docs.blockchyp.com/rest-api/gateway/index.html)
|
3096
55
|
|
56
|
+
## Other SDKs
|
3097
57
|
|
3098
|
-
|
3099
|
-
|
58
|
+
BlockChyp has officially supported SDKs for eight different development platforms and counting.
|
59
|
+
Here's the full list with links to their GitHub repositories.
|
3100
60
|
|
3101
|
-
|
61
|
+
[Go SDK](https://github.com/blockchyp/blockchyp-go)
|
3102
62
|
|
3103
|
-
|
3104
|
-
ENV['BC_API_KEY'],
|
3105
|
-
ENV['BC_BEARER_TOKEN'],
|
3106
|
-
ENV['BC_SIGNING_KEY']
|
3107
|
-
)
|
63
|
+
[Node.js/JavaScript SDK](https://github.com/blockchyp/blockchyp-js)
|
3108
64
|
|
3109
|
-
|
3110
|
-
request = {
|
3111
|
-
}
|
65
|
+
[Java SDK](https://github.com/blockchyp/blockchyp-java)
|
3112
66
|
|
3113
|
-
|
67
|
+
[.net/C# SDK](https://github.com/blockchyp/blockchyp-csharp)
|
3114
68
|
|
3115
|
-
|
69
|
+
[Ruby SDK](https://github.com/blockchyp/blockchyp-ruby)
|
3116
70
|
|
71
|
+
[PHP SDK](https://github.com/blockchyp/blockchyp-php)
|
3117
72
|
|
3118
|
-
|
73
|
+
[Python SDK](https://github.com/blockchyp/blockchyp-python)
|
3119
74
|
|
3120
|
-
|
75
|
+
[iOS (Objective-C/Swift) SDK](https://github.com/blockchyp/blockchyp-ios)
|
3121
76
|
|
77
|
+
## Getting a Developer Kit
|
3122
78
|
|
79
|
+
In order to test your integration with real terminals, you'll need a BlockChyp
|
80
|
+
Developer Kit. Our kits include a fully functioning payment terminal with
|
81
|
+
test pin encryption keys. Every kit includes a comprehensive set of test
|
82
|
+
cards with test cards for every major card brand and entry method, including
|
83
|
+
Contactless and Contact EMV and mag stripe cards. Each kit also includes
|
84
|
+
test gift cards for our blockchain gift card system.
|
3123
85
|
|
3124
|
-
|
3125
|
-
|
86
|
+
Access to BlockChyp's developer program is currently invite only, but you
|
87
|
+
can request an invitation by contacting our engineering team at **nerds@blockchyp.com**.
|
3126
88
|
|
3127
|
-
|
3128
|
-
for each slide.
|
89
|
+
You can also view a number of long form demos and learn more about us on our [YouTube Channel](https://www.youtube.com/channel/UCE-iIVlJic_XArs_U65ZcJg).
|
3129
90
|
|
3130
|
-
|
91
|
+
## Transaction Code Examples
|
3131
92
|
|
93
|
+
You don't want to read words. You want examples. Here's a quick rundown of the
|
94
|
+
stuff you can do with the BlockChyp Ruby SDK and a few basic examples.
|
3132
95
|
|
96
|
+
#### Charge
|
3133
97
|
|
98
|
+
Executes a standard direct preauth and capture.
|
3134
99
|
|
3135
100
|
```ruby
|
3136
101
|
# frozen_string_literal: true
|
3137
102
|
|
3138
103
|
require 'blockchyp'
|
3139
104
|
|
3140
|
-
blockchyp = BlockChyp
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
105
|
+
blockchyp = BlockChyp.new(
|
106
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
107
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
108
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3144
109
|
)
|
3145
110
|
|
3146
|
-
#
|
3147
|
-
request = {
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
response = blockchyp.slideShow(request)
|
3152
|
-
|
3153
|
-
puts "Response: #{response.inspect}"
|
3154
|
-
|
3155
|
-
|
3156
|
-
```
|
3157
|
-
|
3158
|
-
#### Update Slide Show
|
3159
|
-
|
3160
|
-
|
111
|
+
# setup request object
|
112
|
+
request = {}
|
113
|
+
request['test'] = true
|
114
|
+
request['terminalName'] = 'Test Terminal'
|
115
|
+
request['amount'] = '55.00'
|
3161
116
|
|
3162
|
-
|
3163
|
-
* **Required Role:** Media Management
|
117
|
+
response = blockchyp.charge(request)
|
3164
118
|
|
3165
|
-
|
119
|
+
if response['approved']
|
120
|
+
puts 'Approved'
|
121
|
+
end
|
3166
122
|
|
3167
|
-
|
3168
|
-
|
3169
|
-
when updating or creating a slide show.
|
123
|
+
puts 'authCode:' + response['authCode']
|
124
|
+
puts 'authorizedAmount:' + response['authorizedAmount']
|
3170
125
|
|
3171
|
-
When using the CLI, slides can be specified by sending a comma-separated list of media ids via the `-mediaId`
|
3172
|
-
parameter.
|
3173
126
|
|
127
|
+
```
|
3174
128
|
|
129
|
+
#### Preauthorization
|
3175
130
|
|
131
|
+
Executes a preauthorization intended to be captured later.
|
3176
132
|
|
3177
133
|
```ruby
|
3178
134
|
# frozen_string_literal: true
|
3179
135
|
|
3180
136
|
require 'blockchyp'
|
3181
137
|
|
3182
|
-
blockchyp = BlockChyp
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
138
|
+
blockchyp = BlockChyp.new(
|
139
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
140
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
141
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3186
142
|
)
|
3187
143
|
|
3188
|
-
#
|
3189
|
-
request = {
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
{
|
3194
|
-
mediaId: '<MEDIA ID>'
|
3195
|
-
}
|
3196
|
-
]
|
3197
|
-
}
|
3198
|
-
|
3199
|
-
response = blockchyp.updateSlideShow(request)
|
3200
|
-
|
3201
|
-
puts "Response: #{response.inspect}"
|
3202
|
-
|
3203
|
-
|
3204
|
-
```
|
3205
|
-
|
3206
|
-
#### Delete Slide Show
|
144
|
+
# setup request object
|
145
|
+
request = {}
|
146
|
+
request['test'] = true
|
147
|
+
request['terminalName'] = 'Test Terminal'
|
148
|
+
request['amount'] = '27.00'
|
3207
149
|
|
150
|
+
response = blockchyp.preauth(request)
|
3208
151
|
|
152
|
+
if response['approved']
|
153
|
+
puts 'Approved'
|
154
|
+
end
|
3209
155
|
|
3210
|
-
|
3211
|
-
|
156
|
+
puts 'authCode:' + response['authCode']
|
157
|
+
puts 'authorizedAmount:' + response['authorizedAmount']
|
3212
158
|
|
3213
|
-
This API deletes a slide show `slideShowId` is the only required parameter.
|
3214
159
|
|
160
|
+
```
|
3215
161
|
|
162
|
+
#### Terminal Ping
|
3216
163
|
|
164
|
+
Tests connectivity with a payment terminal.
|
3217
165
|
|
3218
166
|
```ruby
|
3219
167
|
# frozen_string_literal: true
|
3220
168
|
|
3221
169
|
require 'blockchyp'
|
3222
170
|
|
3223
|
-
blockchyp = BlockChyp
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
171
|
+
blockchyp = BlockChyp.new(
|
172
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
173
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
174
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3227
175
|
)
|
3228
176
|
|
3229
|
-
#
|
3230
|
-
request = {
|
3231
|
-
|
3232
|
-
}
|
3233
|
-
|
3234
|
-
response = blockchyp.deleteSlideShow(request)
|
3235
|
-
|
3236
|
-
puts "Response: #{response.inspect}"
|
3237
|
-
|
3238
|
-
|
3239
|
-
```
|
3240
|
-
|
3241
|
-
#### Terminal Branding
|
177
|
+
# setup request object
|
178
|
+
request = {}
|
179
|
+
request['terminalName'] = 'Test Terminal'
|
3242
180
|
|
181
|
+
response = blockchyp.ping(request)
|
3243
182
|
|
183
|
+
if response['success']
|
184
|
+
puts 'Success'
|
185
|
+
end
|
3244
186
|
|
3245
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
3246
|
-
* **Required Role:** Media Management
|
3247
|
-
|
3248
|
-
This API returns the full branding stack for a given API scope in the order of priority.
|
3249
|
-
|
3250
|
-
Consumers of this API should pay special attention to the `editable` field. This field indicates whether or
|
3251
|
-
not a branding asset is read-only from the perspective of a particular API Credential scope.
|
3252
|
-
|
3253
|
-
The `thumbnail` and `previewImage` attributes can be used to support building user interfaces for
|
3254
|
-
managing the branding stack. `previewImage` differs from `thumbnail` in that the preview image is
|
3255
|
-
intended to show how an asset would actually look when displayed on the terminal.
|
3256
187
|
|
3257
|
-
`activeAsset` returns the asset that is currently visible on the terminal.
|
3258
188
|
|
189
|
+
```
|
3259
190
|
|
191
|
+
#### Balance
|
3260
192
|
|
193
|
+
Checks the remaining balance on a payment method.
|
3261
194
|
|
3262
195
|
```ruby
|
3263
196
|
# frozen_string_literal: true
|
3264
197
|
|
3265
198
|
require 'blockchyp'
|
3266
199
|
|
3267
|
-
blockchyp = BlockChyp
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
200
|
+
blockchyp = BlockChyp.new(
|
201
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
202
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
203
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3271
204
|
)
|
3272
205
|
|
3273
|
-
#
|
3274
|
-
request = {
|
3275
|
-
|
206
|
+
# setup request object
|
207
|
+
request = {}
|
208
|
+
request['test'] = true
|
209
|
+
request['terminalName'] = 'Test Terminal'
|
210
|
+
request['cardType'] = CardType::EBT
|
211
|
+
|
212
|
+
response = blockchyp.balance(request)
|
3276
213
|
|
3277
|
-
response
|
214
|
+
if response['success']
|
215
|
+
puts 'Success'
|
216
|
+
end
|
3278
217
|
|
3279
|
-
puts "Response: #{response.inspect}"
|
3280
218
|
|
3281
219
|
|
3282
220
|
```
|
3283
221
|
|
3284
|
-
####
|
222
|
+
#### Terminal Clear
|
3285
223
|
|
224
|
+
Clears the line item display and any in progress transaction.
|
3286
225
|
|
226
|
+
```ruby
|
227
|
+
# frozen_string_literal: true
|
3287
228
|
|
3288
|
-
|
3289
|
-
* **Required Role:** Media Management
|
229
|
+
require 'blockchyp'
|
3290
230
|
|
3291
|
-
|
231
|
+
blockchyp = BlockChyp.new(
|
232
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
233
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
234
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
235
|
+
)
|
3292
236
|
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
237
|
+
# setup request object
|
238
|
+
request = {}
|
239
|
+
request['test'] = true
|
240
|
+
request['terminalName'] = 'Test Terminal'
|
3297
241
|
|
3298
|
-
|
242
|
+
response = blockchyp.clear(request)
|
3299
243
|
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
the `preview` setting off.
|
244
|
+
if response['success']
|
245
|
+
puts 'Success'
|
246
|
+
end
|
3304
247
|
|
3305
|
-
**Order and Sequencing**
|
3306
248
|
|
3307
|
-
The `ordinal` field is used to specify priority for a Branding Asset. Assets with a higher value for `ordinal`
|
3308
|
-
will be prioritized first.
|
3309
249
|
|
3310
|
-
|
250
|
+
```
|
3311
251
|
|
3312
|
-
|
3313
|
-
or any image file rendered without any white space or margins between the image content and edge of the image file.
|
3314
|
-
Set the `padded` flag to true if you'd like BlockChyp to auto apply margins when displaying an image on
|
3315
|
-
the terminal.
|
252
|
+
#### Terms & Conditions Capture
|
3316
253
|
|
3317
|
-
|
254
|
+
Prompts the user to accept terms and conditions.
|
3318
255
|
|
3319
|
-
|
3320
|
-
|
256
|
+
```ruby
|
257
|
+
# frozen_string_literal: true
|
3321
258
|
|
3322
|
-
|
3323
|
-
also be scheduled for specific times of day and specific days of the week.
|
259
|
+
require 'blockchyp'
|
3324
260
|
|
3325
|
-
|
3326
|
-
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
261
|
+
blockchyp = BlockChyp.new(
|
262
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
263
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
264
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
265
|
+
)
|
266
|
+
|
267
|
+
# setup request object
|
268
|
+
request = {}
|
269
|
+
request['test'] = true
|
270
|
+
request['terminalName'] = 'Test Terminal'
|
271
|
+
request['tcAlias'] = 'hippa'
|
272
|
+
request['tcName'] = 'HIPPA Disclosure'
|
273
|
+
request['tcContent'] = 'Full contract text'
|
274
|
+
request['sigFormat'] = SignatureFormat::PNG
|
275
|
+
request['sigWidth'] = 200
|
276
|
+
request['sigRequired'] = true
|
3330
277
|
|
3331
|
-
|
278
|
+
response = blockchyp.termsAndConditions(request)
|
3332
279
|
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
cannot be changed via an API call.
|
280
|
+
if response['success']
|
281
|
+
puts 'Success'
|
282
|
+
end
|
3337
283
|
|
3338
|
-
|
284
|
+
puts 'sig:' + response['sig']
|
285
|
+
puts 'sigFile:' + response['sigFile']
|
3339
286
|
|
3340
|
-
* ownerId
|
3341
|
-
* merchantId
|
3342
|
-
* organizationId
|
3343
|
-
* partnerId
|
3344
|
-
* userId
|
3345
|
-
* userName
|
3346
|
-
* thumbnail
|
3347
|
-
* lastModified
|
3348
|
-
* editable
|
3349
|
-
* assetType
|
3350
|
-
* ownerType
|
3351
|
-
* ownerTypeCaption
|
3352
|
-
* previewImage
|
3353
|
-
* narrativeEffectiveDates
|
3354
|
-
* narrativeDisplayPeriod
|
3355
287
|
|
288
|
+
```
|
3356
289
|
|
290
|
+
#### Update Transaction Display
|
3357
291
|
|
292
|
+
Appends items to an existing transaction display Subtotal, Tax, and Total are
|
293
|
+
overwritten by the request. Items with the same description are combined into
|
294
|
+
groups.
|
3358
295
|
|
3359
296
|
```ruby
|
3360
297
|
# frozen_string_literal: true
|
3361
298
|
|
3362
299
|
require 'blockchyp'
|
3363
300
|
|
3364
|
-
blockchyp = BlockChyp
|
3365
|
-
|
3366
|
-
|
3367
|
-
|
301
|
+
blockchyp = BlockChyp.new(
|
302
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
303
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
304
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3368
305
|
)
|
3369
306
|
|
3370
|
-
#
|
3371
|
-
request = {
|
3372
|
-
|
3373
|
-
|
3374
|
-
|
3375
|
-
startDate: '01/06/2021',
|
3376
|
-
startTime: '14:00',
|
3377
|
-
endDate: '11/05/2024',
|
3378
|
-
endTime: '16:00',
|
3379
|
-
notes: 'Test Branding Asset',
|
3380
|
-
preview: false,
|
3381
|
-
enabled: true
|
3382
|
-
}
|
307
|
+
# setup request object
|
308
|
+
request = {}
|
309
|
+
request['test'] = true
|
310
|
+
request['terminalName'] = 'Test Terminal'
|
311
|
+
request['transaction'] = new_transaction_display_transaction
|
3383
312
|
|
3384
|
-
response = blockchyp.
|
313
|
+
response = blockchyp.updateTransactionDisplay(request)
|
3385
314
|
|
3386
|
-
|
315
|
+
if response['success']
|
316
|
+
puts 'Succeded'
|
317
|
+
end
|
3387
318
|
|
319
|
+
def new_transaction_display_transaction
|
320
|
+
val = {}
|
321
|
+
val['subtotal'] = '60.00'
|
322
|
+
val['tax'] = '5.00'
|
323
|
+
val['total'] = '65.00'
|
324
|
+
val['items'] = new_transaction_display_items
|
325
|
+
val
|
326
|
+
end
|
3388
327
|
|
3389
|
-
|
328
|
+
def new_transaction_display_items
|
329
|
+
val = []
|
330
|
+
val = val.push(new_transaction_display_item_2)
|
331
|
+
val
|
332
|
+
end
|
3390
333
|
|
3391
|
-
|
334
|
+
def new_transaction_display_item_2
|
335
|
+
val = {}
|
336
|
+
val['description'] = 'Leki Trekking Poles'
|
337
|
+
val['price'] = '35.00'
|
338
|
+
val['quantity'] = 2
|
339
|
+
val['extended'] = '70.00'
|
340
|
+
val['discounts'] = new_transaction_display_discounts
|
341
|
+
val
|
342
|
+
end
|
3392
343
|
|
344
|
+
def new_transaction_display_discounts
|
345
|
+
val = []
|
346
|
+
val = val.push(new_transaction_display_discount_2)
|
347
|
+
val
|
348
|
+
end
|
3393
349
|
|
350
|
+
def new_transaction_display_discount_2
|
351
|
+
val = {}
|
352
|
+
val['description'] = 'memberDiscount'
|
353
|
+
val['amount'] = '10.00'
|
354
|
+
val
|
355
|
+
end
|
3394
356
|
|
3395
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
3396
|
-
* **Required Role:** Media Management
|
3397
357
|
|
3398
|
-
This API deletes a Branding Asset from the branding stack.
|
3399
358
|
|
3400
|
-
Note that deleting a Branding Asset does not delete the underlying media from the media library or slide
|
3401
|
-
show from the slide show library.
|
3402
359
|
|
360
|
+
```
|
3403
361
|
|
362
|
+
#### New Transaction Display
|
3404
363
|
|
364
|
+
Displays a new transaction on the terminal.
|
3405
365
|
|
3406
366
|
```ruby
|
3407
367
|
# frozen_string_literal: true
|
3408
368
|
|
3409
369
|
require 'blockchyp'
|
3410
370
|
|
3411
|
-
blockchyp = BlockChyp
|
3412
|
-
|
3413
|
-
|
3414
|
-
|
371
|
+
blockchyp = BlockChyp.new(
|
372
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
373
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
374
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3415
375
|
)
|
3416
376
|
|
3417
|
-
#
|
3418
|
-
request = {
|
3419
|
-
|
3420
|
-
|
3421
|
-
|
3422
|
-
response = blockchyp.deleteBrandingAsset(request)
|
3423
|
-
|
3424
|
-
puts "Response: #{response.inspect}"
|
3425
|
-
|
3426
|
-
|
3427
|
-
```
|
377
|
+
# setup request object
|
378
|
+
request = {}
|
379
|
+
request['test'] = true
|
380
|
+
request['terminalName'] = 'Test Terminal'
|
381
|
+
request['transaction'] = new_transaction_display_transaction
|
3428
382
|
|
3429
|
-
|
383
|
+
response = blockchyp.newTransactionDisplay(request)
|
3430
384
|
|
385
|
+
if response['success']
|
386
|
+
puts 'Succeded'
|
387
|
+
end
|
3431
388
|
|
3432
|
-
|
389
|
+
def new_transaction_display_transaction
|
390
|
+
val = {}
|
391
|
+
val['subtotal'] = '60.00'
|
392
|
+
val['tax'] = '5.00'
|
393
|
+
val['total'] = '65.00'
|
394
|
+
val['items'] = new_transaction_display_items
|
395
|
+
val
|
396
|
+
end
|
3433
397
|
|
3434
|
-
|
3435
|
-
|
398
|
+
def new_transaction_display_items
|
399
|
+
val = []
|
400
|
+
val = val.push(new_transaction_display_item_2)
|
401
|
+
val
|
402
|
+
end
|
3436
403
|
|
3437
|
-
|
3438
|
-
|
404
|
+
def new_transaction_display_item_2
|
405
|
+
val = {}
|
406
|
+
val['description'] = 'Leki Trekking Poles'
|
407
|
+
val['price'] = '35.00'
|
408
|
+
val['quantity'] = 2
|
409
|
+
val['extended'] = '70.00'
|
410
|
+
val['discounts'] = new_transaction_display_discounts
|
411
|
+
val
|
412
|
+
end
|
3439
413
|
|
414
|
+
def new_transaction_display_discounts
|
415
|
+
val = []
|
416
|
+
val = val.push(new_transaction_display_discount_2)
|
417
|
+
val
|
418
|
+
end
|
3440
419
|
|
420
|
+
def new_transaction_display_discount_2
|
421
|
+
val = {}
|
422
|
+
val['description'] = 'memberDiscount'
|
423
|
+
val['amount'] = '10.00'
|
424
|
+
val
|
425
|
+
end
|
3441
426
|
|
3442
|
-
#### Merchant Profile
|
3443
427
|
|
3444
428
|
|
3445
429
|
|
3446
|
-
|
3447
|
-
* **Required Role:** Payment API Access
|
430
|
+
```
|
3448
431
|
|
3449
|
-
|
3450
|
-
basic identity information, terminal settings, store and forward settings,
|
3451
|
-
and bank account information for merchants that support split settlement.
|
432
|
+
#### Text Prompt
|
3452
433
|
|
3453
|
-
|
3454
|
-
fields are controlled by underwriting and cannot be altered outside of the
|
3455
|
-
underwriting and risk processes.
|
434
|
+
Asks the consumer text based question.
|
3456
435
|
|
3457
|
-
|
436
|
+
```ruby
|
437
|
+
# frozen_string_literal: true
|
3458
438
|
|
3459
|
-
|
439
|
+
require 'blockchyp'
|
3460
440
|
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3464
|
-
|
3465
|
-
|
3466
|
-
* **storeNumber:** Optional store number for multi-location operators.
|
3467
|
-
* **partnerRef:** Optional reference number partners can add to a merchant record. Usually the partner's own identifier for the merchant.
|
3468
|
-
* **timeZone:** Unix style local time zone for the merchant. Example: America/New_York.
|
3469
|
-
* **publicKey:** Read only field. The merchant's blockchain public key. Generated and assigned when a merchant account is first created.
|
3470
|
-
* **billingAddress:** Address for billing and written correspondence.
|
3471
|
-
* **shippingAddress:** Physical shipping address. Usually the actual street address of the business.
|
3472
|
-
* **status:** Current status of the merchant account.
|
3473
|
-
* **tcDisabled:** Disables all terms and conditions features in the merchant dashboard. Used to hide the feature if a partner has not chosen to support it.
|
3474
|
-
* **gatewayOnly:** Indicates that a merchant has been boarded in gateway only mode. Not common.
|
441
|
+
blockchyp = BlockChyp.new(
|
442
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
443
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
444
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
445
|
+
)
|
3475
446
|
|
3476
|
-
|
447
|
+
# setup request object
|
448
|
+
request = {}
|
449
|
+
request['test'] = true
|
450
|
+
request['terminalName'] = 'Test Terminal'
|
451
|
+
request['promptType'] = PromptType::EMAIL
|
3477
452
|
|
3478
|
-
|
453
|
+
response = blockchyp.textPrompt(request)
|
3479
454
|
|
3480
|
-
|
3481
|
-
|
3482
|
-
|
3483
|
-
* **cooldownTimeout:** The amount of time in seconds after a transactions for which the transaction response is displayed on the terminal. After the cooldown period elapses, the terminal will revert to the idle state and display the currently active terminal branding.
|
3484
|
-
* **surveyTimeout:** The amount of time in seconds a survey question should be displayed on a terminal before reverting to the idle screen.
|
3485
|
-
* **pinEnabled:** Enables pin code entry for debit cards, EBT cards, and EMV cards with pin CVMs. Will be ignored if terminals are not injected with the proper encryption keys.
|
3486
|
-
* **pinBypassEnabled:** Enable pin bypass for debit transactions.
|
3487
|
-
* **cashBackEnabled:** Enables cash back for debit transactions.
|
3488
|
-
* **cashbackPresets:** An array of four default values for cashback amounts when cashback is enabled.
|
3489
|
-
* **storeAndForwardEnabled:** Enables automatic store and forward during network outages. Store and Forward does not support cash back, refunds, EBT, or gift card transactions.
|
3490
|
-
* **storeAndForwardFloorLimit:** Maximum dollar value of a store and forward transaction.
|
3491
|
-
* **ebtEnabled:** Enables EBT (SNAP) on BlockChyp terminals.
|
3492
|
-
* **tipEnabled:** Enables tips entry on the terminal.
|
3493
|
-
* **promptForTip:** If true, the terminal will always prompt for a tip, even if the API call does not request a tip prompt.
|
3494
|
-
* **tipDefaults:** An array of exactly three percentages that will be used to calculate default tip amounts.
|
3495
|
-
* **giftCardsDisabled:** Disables BlockChyp gift cards. Normally only used if the merchant is using an alternate gift card system.
|
3496
|
-
* **digitalSignaturesEnabled:** Enables electronic signature capture for mag stripe cards and EMV cards with Signature CVMs.
|
3497
|
-
* **digitalSignatureReversal:** Will cause a transaction to auto-reverse if the consumer refuses to provide a signature.
|
3498
|
-
* **manualEntryEnabled:** Enables manual card entry.
|
3499
|
-
* **manualEntryPromptZip:** Requires zip code based address verification for manual card entry.
|
3500
|
-
* **manualEntryPromptStreetNumber:** Requires street/address based verification for manual card entry.
|
455
|
+
if response['success']
|
456
|
+
puts 'Success'
|
457
|
+
end
|
3501
458
|
|
3502
|
-
|
459
|
+
puts 'response:' + response['response']
|
3503
460
|
|
3504
|
-
* **freeRangeRefundsEnabled:** Enables direct refunds that do not reference a previous transaction.
|
3505
|
-
* **partialAuthEnabled:** Indicates that partial authorizations (usually for gift card support) are enabled.
|
3506
|
-
* **splitBankAccountsEnabled:** Used for law firm merchants only.
|
3507
|
-
* **contactlessEmv:** Enables contactless/tap transactions on a terminal. Defaults to true.
|
3508
|
-
* **visa:** Enables Visa transactions.
|
3509
|
-
* **masterCard:** Enables MasterCard transactions.
|
3510
|
-
* **amex:** Enables American Express transactions.
|
3511
|
-
* **discover:** Enables Discover transactions.
|
3512
|
-
* **jcb:** Enables JCB (Japan Card Bureau) transactions.
|
3513
|
-
* **unionPay:** Enables China UnionPay transactions.
|
3514
461
|
|
462
|
+
```
|
3515
463
|
|
464
|
+
#### Boolean Prompt
|
3516
465
|
|
466
|
+
Asks the consumer a yes/no question.
|
3517
467
|
|
3518
468
|
```ruby
|
3519
469
|
# frozen_string_literal: true
|
3520
470
|
|
3521
471
|
require 'blockchyp'
|
3522
472
|
|
3523
|
-
blockchyp = BlockChyp
|
3524
|
-
|
3525
|
-
|
3526
|
-
|
473
|
+
blockchyp = BlockChyp.new(
|
474
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
475
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
476
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3527
477
|
)
|
3528
478
|
|
3529
|
-
#
|
3530
|
-
request = {
|
3531
|
-
|
479
|
+
# setup request object
|
480
|
+
request = {}
|
481
|
+
request['test'] = true
|
482
|
+
request['terminalName'] = 'Test Terminal'
|
483
|
+
request['prompt'] = 'Would you like to become a member?'
|
484
|
+
request['yesCaption'] = 'Yes'
|
485
|
+
request['noCaption'] = 'No'
|
486
|
+
|
487
|
+
response = blockchyp.booleanPrompt(request)
|
3532
488
|
|
3533
|
-
response
|
489
|
+
if response['success']
|
490
|
+
puts 'Success'
|
491
|
+
end
|
3534
492
|
|
3535
|
-
puts
|
493
|
+
puts 'response:' + response['response']
|
3536
494
|
|
3537
495
|
|
3538
496
|
```
|
3539
497
|
|
3540
|
-
####
|
498
|
+
#### Display Message
|
499
|
+
|
500
|
+
Displays a short message on the terminal.
|
501
|
+
|
502
|
+
```ruby
|
503
|
+
# frozen_string_literal: true
|
504
|
+
|
505
|
+
require 'blockchyp'
|
3541
506
|
|
507
|
+
blockchyp = BlockChyp.new(
|
508
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
509
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
510
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
511
|
+
)
|
3542
512
|
|
513
|
+
# setup request object
|
514
|
+
request = {}
|
515
|
+
request['test'] = true
|
516
|
+
request['terminalName'] = 'Test Terminal'
|
517
|
+
request['message'] = 'Thank you for your business.'
|
3543
518
|
|
3544
|
-
|
3545
|
-
* **Required Role:** Merchant Management
|
519
|
+
response = blockchyp.message(request)
|
3546
520
|
|
3547
|
-
|
521
|
+
if response['success']
|
522
|
+
puts 'Success'
|
523
|
+
end
|
3548
524
|
|
3549
|
-
Live merchants are returned by default. Use the `test` flag to return only test merchants. The
|
3550
|
-
results returned include detailed settings including underwriting controlled flags.
|
3551
525
|
|
3552
|
-
A maximum of 250 merchants are returned by default. For large merchant portfolios, the `maxResults`
|
3553
|
-
and `startIndex` field can be used to reduce the page size and page through multiple pages of results.
|
3554
526
|
|
527
|
+
```
|
3555
528
|
|
529
|
+
#### Refund
|
3556
530
|
|
531
|
+
Executes a refund.
|
3557
532
|
|
3558
533
|
```ruby
|
3559
534
|
# frozen_string_literal: true
|
3560
535
|
|
3561
536
|
require 'blockchyp'
|
3562
537
|
|
3563
|
-
blockchyp = BlockChyp
|
3564
|
-
|
3565
|
-
|
3566
|
-
|
538
|
+
blockchyp = BlockChyp.new(
|
539
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
540
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
541
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3567
542
|
)
|
3568
543
|
|
3569
|
-
#
|
3570
|
-
request = {
|
3571
|
-
|
3572
|
-
|
3573
|
-
|
3574
|
-
response = blockchyp.getMerchants(request)
|
544
|
+
# setup request object
|
545
|
+
request = {}
|
546
|
+
request['terminalName'] = 'Test Terminal'
|
547
|
+
request['transactionId'] = '<PREVIOUS TRANSACTION ID>'
|
548
|
+
request['amount'] = '5.00'
|
3575
549
|
|
3576
|
-
|
3577
|
-
|
3578
|
-
|
3579
|
-
```
|
3580
|
-
|
3581
|
-
#### Update Merchant
|
550
|
+
response = blockchyp.refund(request)
|
3582
551
|
|
552
|
+
if response['approved']
|
553
|
+
puts 'Approved'
|
554
|
+
end
|
3583
555
|
|
3584
556
|
|
3585
|
-
* **API Credential Types:** Merchant, Partner, & Organization
|
3586
|
-
* **Required Role:** Merchant Management
|
3587
557
|
|
3588
|
-
|
558
|
+
```
|
3589
559
|
|
3590
|
-
|
560
|
+
#### Enroll
|
3591
561
|
|
3592
|
-
|
3593
|
-
merchants or board new gateway merchants.
|
562
|
+
Adds a new payment method to the token vault.
|
3594
563
|
|
3595
|
-
|
564
|
+
```ruby
|
565
|
+
# frozen_string_literal: true
|
3596
566
|
|
3597
|
-
|
567
|
+
require 'blockchyp'
|
3598
568
|
|
3599
|
-
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3603
|
-
|
3604
|
-
* **storeNumber:** Optional store number for multi location operators.
|
3605
|
-
* **partnerRef:** Optional reference number partners can add to a merchant record. Usually the partner's own identifier for the merchant.
|
3606
|
-
* **timeZone:** Unix style local time zone for the merchant. Example: America/New_York.
|
3607
|
-
* **publicKey:** Read only field. The merchant's blockchain public key. Generated and assigned when a merchant account is first created.
|
3608
|
-
* **billingAddress:** Address for billing and written correspondence.
|
3609
|
-
* **shippingAddress:** Physical shipping address. Usually the actual street address of the business.
|
3610
|
-
* **status:** Current status of the merchant account.
|
3611
|
-
* **tcDisabled:** Disables all terms and conditions features in the merchant dashboard. Used to hide the feature if a partner has not chosen to support it.
|
3612
|
-
* **gatewayOnly:** Indicates that a merchant has been boarded in gateway only mode. Not common.
|
569
|
+
blockchyp = BlockChyp.new(
|
570
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
571
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
572
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
573
|
+
)
|
3613
574
|
|
3614
|
-
|
575
|
+
# setup request object
|
576
|
+
request = {}
|
577
|
+
request['test'] = true
|
578
|
+
request['terminalName'] = 'Test Terminal'
|
3615
579
|
|
3616
|
-
|
580
|
+
response = blockchyp.enroll(request)
|
3617
581
|
|
3618
|
-
|
3619
|
-
|
3620
|
-
|
3621
|
-
* **cooldownTimeout:** The amount of time in seconds after a transactions for which the transaction response is displayed on the terminal. After the cooldown period elapses, the terminal will revert to the idle state and display the currently active terminal branding.
|
3622
|
-
* **surveyTimeout:** The amount of time in seconds a survey question should be displayed on a terminal before reverting to the idle screen.
|
3623
|
-
* **pinEnabled:** Enables pin code entry for debit cards, EBT cards, and EMV cards with pin CVMs. Will be ignored if terminals are not injected with the proper encryption keys.
|
3624
|
-
* **pinBypassEnabled:** Enable pin bypass for debit transactions.
|
3625
|
-
* **cashBackEnabled:** Enables cash back for debit transactions.
|
3626
|
-
* **cashbackPresets:** An array of four default values for cashback amounts when cashback is enabled.
|
3627
|
-
* **storeAndForwardEnabled:** Enables automatic store and forward during network outages. Store and Forward does not support cash back, refunds, EBT, or gift card transactions.
|
3628
|
-
* **storeAndForwardFloorLimit:** Maximum dollar value of a store and forward transaction.
|
3629
|
-
* **ebtEnabled:** Enables EBT (SNAP) on BlockChyp terminals.
|
3630
|
-
* **tipEnabled:** Enables tips entry on the terminal.
|
3631
|
-
* **promptForTip:** If true, the terminal will always prompt for a tip, even if the API call does not request a tip prompt.
|
3632
|
-
* **tipDefaults:** An array of exactly three percentages that will be used to calculate default tip amounts.
|
3633
|
-
* **giftCardsDisabled:** Disables BlockChyp gift cards. Normally only used if the merchant is using an alternate gift card system.
|
3634
|
-
* **digitalSignaturesEnabled:** Enables electronic signature capture for mag stripe cards and EMV cards with Signature CVMs.
|
3635
|
-
* **digitalSignatureReversal:** Will cause a transaction to auto-reverse if the consumer refuses to provide a signature.
|
3636
|
-
* **manualEntryEnabled:** Enables manual card entry.
|
3637
|
-
* **manualEntryPromptZip:** Requires zip code based address verification for manual card entry.
|
3638
|
-
* **manualEntryPromptStreetNumber:** Requires street/address based verification for manual card entry.
|
582
|
+
if response['approved']
|
583
|
+
puts 'Approved'
|
584
|
+
end
|
3639
585
|
|
3640
|
-
|
586
|
+
puts 'token:' + response['token']
|
3641
587
|
|
3642
|
-
* **freeRangeRefundsEnabled:** Enables direct refunds that do not reference a previous transaction.
|
3643
|
-
* **partialAuthEnabled:** Indicates that partial authorizations (usually for gift card support) are enabled.
|
3644
|
-
* **splitBankAccountsEnabled:** Used for law firm merchants only.
|
3645
|
-
* **contactlessEmv:** Enables contactless/tap transactions on a terminal. Defaults to true.
|
3646
|
-
* **visa:** Enables Visa transactions.
|
3647
|
-
* **masterCard:** Enables MasterCard transactions.
|
3648
|
-
* **amex:** Enables American Express transactions.
|
3649
|
-
* **discover:** Enables Discover transactions.
|
3650
|
-
* **jcb:** Enables JCB (Japan Card Bureau) transactions.
|
3651
|
-
* **unionPay:** Enables China UnionPay transactions.
|
3652
588
|
|
589
|
+
```
|
3653
590
|
|
591
|
+
#### Gift Card Activation
|
3654
592
|
|
593
|
+
Activates or recharges a gift card.
|
3655
594
|
|
3656
595
|
```ruby
|
3657
596
|
# frozen_string_literal: true
|
3658
597
|
|
3659
598
|
require 'blockchyp'
|
3660
599
|
|
3661
|
-
blockchyp = BlockChyp
|
3662
|
-
|
3663
|
-
|
3664
|
-
|
600
|
+
blockchyp = BlockChyp.new(
|
601
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
602
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
603
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3665
604
|
)
|
3666
605
|
|
3667
|
-
#
|
3668
|
-
request = {
|
3669
|
-
|
3670
|
-
|
3671
|
-
|
3672
|
-
companyName: 'Test Merchant',
|
3673
|
-
billingAddress: {
|
3674
|
-
address1: '1060 West Addison',
|
3675
|
-
city: 'Chicago',
|
3676
|
-
stateOrProvince: 'IL',
|
3677
|
-
postalCode: '60613'
|
3678
|
-
}
|
3679
|
-
}
|
3680
|
-
|
3681
|
-
response = blockchyp.updateMerchant(request)
|
3682
|
-
|
3683
|
-
puts "Response: #{response.inspect}"
|
3684
|
-
|
3685
|
-
|
3686
|
-
```
|
606
|
+
# setup request object
|
607
|
+
request = {}
|
608
|
+
request['test'] = true
|
609
|
+
request['terminalName'] = 'Test Terminal'
|
610
|
+
request['amount'] = '50.00'
|
3687
611
|
|
3688
|
-
|
612
|
+
response = blockchyp.giftActivate(request)
|
3689
613
|
|
614
|
+
if response['approved']
|
615
|
+
puts 'Approved'
|
616
|
+
end
|
3690
617
|
|
618
|
+
puts 'amount:' + response['amount']
|
619
|
+
puts 'currentBalance:' + response['currentBalance']
|
620
|
+
puts 'publicKey:' + response['publicKey']
|
3691
621
|
|
3692
|
-
* **API Credential Types:** Partner & Organization
|
3693
|
-
* **Required Role:** Merchant Management
|
3694
622
|
|
3695
|
-
|
623
|
+
```
|
3696
624
|
|
625
|
+
#### Time Out Reversal
|
3697
626
|
|
627
|
+
Executes a manual time out reversal.
|
3698
628
|
|
629
|
+
We love time out reversals. Don't be afraid to use them whenever a request to a
|
630
|
+
BlockChyp terminal times out. You have up to two minutes to reverse any
|
631
|
+
transaction. The only caveat is that you must assign transactionRef values when
|
632
|
+
you build the original request. Otherwise, we have no real way of knowing which
|
633
|
+
transaction you're trying to reverse because we may not have assigned it an id
|
634
|
+
yet. And if we did assign it an id, you wouldn't know what it is because your
|
635
|
+
request to the terminal timed out before you got a response.
|
3699
636
|
|
3700
637
|
```ruby
|
3701
638
|
# frozen_string_literal: true
|
3702
639
|
|
3703
640
|
require 'blockchyp'
|
3704
641
|
|
3705
|
-
blockchyp = BlockChyp
|
3706
|
-
|
3707
|
-
|
3708
|
-
|
642
|
+
blockchyp = BlockChyp.new(
|
643
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
644
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
645
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3709
646
|
)
|
3710
647
|
|
3711
|
-
#
|
3712
|
-
request = {
|
3713
|
-
|
3714
|
-
|
3715
|
-
|
3716
|
-
response = blockchyp.merchantUsers(request)
|
3717
|
-
|
3718
|
-
puts "Response: #{response.inspect}"
|
648
|
+
# setup request object
|
649
|
+
request = {}
|
650
|
+
request['terminalName'] = 'Test Terminal'
|
651
|
+
request['transactionRef'] = '<LAST TRANSACTION REF>'
|
3719
652
|
|
653
|
+
response = blockchyp.reverse(request)
|
3720
654
|
|
3721
|
-
|
3722
|
-
|
3723
|
-
|
3724
|
-
|
3725
|
-
|
3726
|
-
|
3727
|
-
* **API Credential Types:** Partner & Organization
|
3728
|
-
* **Required Role:** Merchant Management
|
3729
|
-
|
3730
|
-
Invites a new user to join a merchant account. `email`, `firstName`, and `lastName` are required.
|
655
|
+
if response['approved']
|
656
|
+
puts 'Approved'
|
657
|
+
end
|
3731
658
|
|
3732
|
-
The user will be sent an invite email with steps for creating a BlockChyp account and linking it to
|
3733
|
-
a merchant account. If the user already has a BlockChyp user account, the new user signup wil be skipped
|
3734
|
-
and the existing user account will be linked to the merchant account.
|
3735
659
|
|
3736
|
-
Developers can optionally restrict the user's access level by sending one or more role codes.
|
3737
|
-
Otherwise, the user will be given the default merchant user role. (STDMERCHANT)
|
3738
660
|
|
661
|
+
```
|
3739
662
|
|
663
|
+
#### Capture Preauthorization
|
3740
664
|
|
665
|
+
Captures a preauthorization.
|
3741
666
|
|
3742
667
|
```ruby
|
3743
668
|
# frozen_string_literal: true
|
3744
669
|
|
3745
670
|
require 'blockchyp'
|
3746
671
|
|
3747
|
-
blockchyp = BlockChyp
|
3748
|
-
|
3749
|
-
|
3750
|
-
|
672
|
+
blockchyp = BlockChyp.new(
|
673
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
674
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
675
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3751
676
|
)
|
3752
677
|
|
3753
|
-
#
|
3754
|
-
request = {
|
3755
|
-
|
3756
|
-
|
3757
|
-
|
3758
|
-
response = blockchyp.inviteMerchantUser(request)
|
3759
|
-
|
3760
|
-
puts "Response: #{response.inspect}"
|
3761
|
-
|
3762
|
-
|
3763
|
-
```
|
3764
|
-
|
3765
|
-
#### Add Test Merchant
|
3766
|
-
|
678
|
+
# setup request object
|
679
|
+
request = {}
|
680
|
+
request['test'] = true
|
681
|
+
request['transactionId'] = '<PREAUTH TRANSACTION ID>'
|
3767
682
|
|
683
|
+
response = blockchyp.capture(request)
|
3768
684
|
|
3769
|
-
|
3770
|
-
|
685
|
+
if response['approved']
|
686
|
+
puts 'Approved'
|
687
|
+
end
|
3771
688
|
|
3772
|
-
This is a partner level API that can be used to create test merchant accounts. This creates
|
3773
|
-
a basic test merchant with default settings.
|
3774
689
|
|
3775
|
-
Settings can be changed by using the Update Merchant API.
|
3776
690
|
|
691
|
+
```
|
3777
692
|
|
693
|
+
#### Close Batch
|
3778
694
|
|
695
|
+
Closes the current credit card batch.
|
3779
696
|
|
3780
697
|
```ruby
|
3781
698
|
# frozen_string_literal: true
|
3782
699
|
|
3783
700
|
require 'blockchyp'
|
3784
701
|
|
3785
|
-
blockchyp = BlockChyp
|
3786
|
-
|
3787
|
-
|
3788
|
-
|
702
|
+
blockchyp = BlockChyp.new(
|
703
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
704
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
705
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3789
706
|
)
|
3790
707
|
|
3791
|
-
#
|
3792
|
-
request = {
|
3793
|
-
|
3794
|
-
companyName: 'Corporate Entity Name'
|
3795
|
-
}
|
3796
|
-
|
3797
|
-
response = blockchyp.addTestMerchant(request)
|
3798
|
-
|
3799
|
-
puts "Response: #{response.inspect}"
|
3800
|
-
|
3801
|
-
|
3802
|
-
```
|
3803
|
-
|
3804
|
-
#### Delete Test Merchant
|
708
|
+
# setup request object
|
709
|
+
request = {}
|
710
|
+
request['test'] = true
|
3805
711
|
|
712
|
+
response = blockchyp.closeBatch(request)
|
3806
713
|
|
714
|
+
if response['success']
|
715
|
+
puts 'Success'
|
716
|
+
end
|
3807
717
|
|
3808
|
-
|
3809
|
-
|
718
|
+
puts 'capturedTotal:' + response['capturedTotal']
|
719
|
+
puts 'openPreauths:' + response['openPreauths']
|
3810
720
|
|
3811
|
-
This partner API can be used to delete unused test merchant accounts. `merchantId` is a required parameter.
|
3812
721
|
|
722
|
+
```
|
3813
723
|
|
724
|
+
#### Void Transaction
|
3814
725
|
|
726
|
+
Discards a previous preauth transaction.
|
3815
727
|
|
3816
728
|
```ruby
|
3817
729
|
# frozen_string_literal: true
|
3818
730
|
|
3819
731
|
require 'blockchyp'
|
3820
732
|
|
3821
|
-
blockchyp = BlockChyp
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
733
|
+
blockchyp = BlockChyp.new(
|
734
|
+
'SPBXTSDAQVFFX5MGQMUMIRINVI',
|
735
|
+
'7BXBTBUPSL3BP7I6Z2CFU6H3WQ',
|
736
|
+
'bcae3708938cb8004ab1278e6c0fcd68f9d815e1c3c86228d028242b147af58e'
|
3825
737
|
)
|
3826
738
|
|
3827
|
-
#
|
3828
|
-
request = {
|
3829
|
-
|
3830
|
-
|
3831
|
-
|
3832
|
-
response = blockchyp.deleteTestMerchant(request)
|
3833
|
-
|
3834
|
-
puts "Response: #{response.inspect}"
|
739
|
+
# setup request object
|
740
|
+
request = {}
|
741
|
+
request['test'] = true
|
742
|
+
request['transactionId'] = '<PREVIOUS TRANSACTION ID>'
|
3835
743
|
|
744
|
+
response = blockchyp.void(request)
|
3836
745
|
|
3837
|
-
|
3838
|
-
|
746
|
+
if response['approved']
|
747
|
+
puts 'Approved'
|
748
|
+
end
|
3839
749
|
|
3840
750
|
|
3841
751
|
|
752
|
+
```
|
3842
753
|
|
3843
754
|
## Running Integration Tests
|
3844
755
|
|
@@ -3894,24 +805,3 @@ Copyright BlockChyp, Inc., 2019
|
|
3894
805
|
Distributed under the terms of the [MIT] license, blockchyp-ruby is free and open source software.
|
3895
806
|
|
3896
807
|
[MIT]: https://github.com/blockchyp/blockchyp-ruby/blob/master/LICENSE
|
3897
|
-
|
3898
|
-
## Other SDKs
|
3899
|
-
|
3900
|
-
BlockChyp has officially supported SDKs for eight different development platforms and counting.
|
3901
|
-
Here's the full list with links to their GitHub repositories.
|
3902
|
-
|
3903
|
-
[Go SDK](https://github.com/blockchyp/blockchyp-go)
|
3904
|
-
|
3905
|
-
[Node.js/JavaScript SDK](https://github.com/blockchyp/blockchyp-js)
|
3906
|
-
|
3907
|
-
[Java SDK](https://github.com/blockchyp/blockchyp-java)
|
3908
|
-
|
3909
|
-
[.net/C# SDK](https://github.com/blockchyp/blockchyp-csharp)
|
3910
|
-
|
3911
|
-
[Ruby SDK](https://github.com/blockchyp/blockchyp-ruby)
|
3912
|
-
|
3913
|
-
[PHP SDK](https://github.com/blockchyp/blockchyp-php)
|
3914
|
-
|
3915
|
-
[Python SDK](https://github.com/blockchyp/blockchyp-python)
|
3916
|
-
|
3917
|
-
[iOS (Objective-C/Swift) SDK](https://github.com/blockchyp/blockchyp-ios)
|