@blockchyp/blockchyp-ts 1.0.0

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