@justifi/webcomponents 6.7.0 → 6.7.2
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.
- package/dist/cjs/{check-pkg-version-nSgWWvdw.js → check-pkg-version-BG-Rfkh5.js} +1 -1
- package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
- package/dist/cjs/internal-tokenize-payment-method_7.cjs.entry.js +9 -7
- package/dist/cjs/justifi-apple-pay_8.cjs.entry.js +10 -8
- package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-form.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkout.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +2 -2
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +98 -6
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{package-B8gOzTFM.js → package-Df5lTFe6.js} +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/actions/void/void-actions.js +31 -0
- package/dist/collection/api/services/google-pay.service.js +2 -1
- package/dist/collection/api/services/void.service.js +9 -0
- package/dist/collection/components/modular-checkout/modular-checkout.js +3 -2
- package/dist/collection/components/modular-checkout/sub-components/bank-account.js +6 -3
- package/dist/collection/components/modular-checkout/sub-components/card-form.js +6 -3
- package/dist/collection/components/modular-checkout/sub-components/google-pay.js +3 -3
- package/dist/collection/components/refund-payment/refund-payment.js +66 -10
- package/dist/docs.json +15 -10
- package/dist/esm/{check-pkg-version-CmkUoEAo.js → check-pkg-version-c_8fDHCB.js} +1 -1
- package/dist/esm/hidden-input_2.entry.js +1 -1
- package/dist/esm/internal-tokenize-payment-method_7.entry.js +9 -7
- package/dist/esm/justifi-apple-pay_8.entry.js +10 -8
- package/dist/esm/justifi-business-details.entry.js +2 -2
- package/dist/esm/justifi-business-form.entry.js +2 -2
- package/dist/esm/justifi-checkout.entry.js +2 -2
- package/dist/esm/justifi-checkouts-list.entry.js +2 -2
- package/dist/esm/justifi-dispute-management.entry.js +2 -2
- package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
- package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
- package/dist/esm/justifi-order-terminals.entry.js +2 -2
- package/dist/esm/justifi-payment-details.entry.js +2 -2
- package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
- package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payments-list.entry.js +2 -2
- package/dist/esm/justifi-payout-details.entry.js +2 -2
- package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payouts-list.entry.js +2 -2
- package/dist/esm/justifi-refund-payment.entry.js +98 -6
- package/dist/esm/justifi-season-interruption-insurance.entry.js +2 -2
- package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
- package/dist/esm/justifi-terminals-list.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{package-CsRppqXL.js → package-BzT9OxlN.js} +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/module/bank-account-form.js +1 -1
- package/dist/module/bank-account.js +5 -2
- package/dist/module/card-form.js +1 -1
- package/dist/module/card-form2.js +5 -2
- package/dist/module/google-pay.js +5 -4
- package/dist/module/justifi-checkouts-list-filters.js +1 -1
- package/dist/module/justifi-payment-transactions-list.js +1 -1
- package/dist/module/justifi-payments-list-filters.js +1 -1
- package/dist/module/justifi-payout-transactions-list.js +1 -1
- package/dist/module/justifi-payouts-list-filters.js +1 -1
- package/dist/module/justifi-refund-payment.js +97 -4
- package/dist/module/justifi-terminal-orders-list-filters.js +1 -1
- package/dist/module/modular-checkout.js +3 -2
- package/dist/module/package.js +1 -1
- package/dist/module/payments-list-core2.js +1 -1
- package/dist/module/payout-details-core2.js +1 -1
- package/dist/module/payouts-list-core2.js +1 -1
- package/dist/module/terminal-orders-list-core2.js +1 -1
- package/dist/module/utils2.js +1 -1
- package/dist/types/actions/void/void-actions.d.ts +10 -0
- package/dist/types/api/services/google-pay.service.d.ts +1 -1
- package/dist/types/api/services/void.service.d.ts +7 -0
- package/dist/types/components/modular-checkout/sub-components/bank-account.d.ts +1 -0
- package/dist/types/components/modular-checkout/sub-components/card-form.d.ts +1 -0
- package/dist/types/components/refund-payment/refund-payment.d.ts +6 -2
- package/dist/types/components.d.ts +3 -3
- package/dist/webcomponents/{p-c0bd4e9a.entry.js → p-035a4adc.entry.js} +1 -1
- package/dist/webcomponents/{p-c4585b68.entry.js → p-0935600b.entry.js} +1 -1
- package/dist/webcomponents/{p-fc8f55d7.entry.js → p-0ab9a3ae.entry.js} +1 -1
- package/dist/webcomponents/{p-DISrhs4v.js → p-11wdbrqX.js} +1 -1
- package/dist/webcomponents/{p-fe73b09b.entry.js → p-138ada4a.entry.js} +1 -1
- package/dist/webcomponents/p-148d3327.entry.js +1 -0
- package/dist/webcomponents/p-2cb9edad.entry.js +1 -0
- package/dist/webcomponents/{p-04ec17bb.entry.js → p-2d4a2d26.entry.js} +1 -1
- package/dist/webcomponents/p-3f14d0c4.entry.js +1 -0
- package/dist/webcomponents/{p-d2981754.entry.js → p-5c6727ae.entry.js} +1 -1
- package/dist/webcomponents/{p-eada0422.entry.js → p-622af881.entry.js} +1 -1
- package/dist/webcomponents/{p-50400c5e.entry.js → p-64ebff16.entry.js} +1 -1
- package/dist/webcomponents/p-71577fa1.entry.js +1 -0
- package/dist/webcomponents/p-7ec4838f.entry.js +1 -0
- package/dist/webcomponents/p-BzT9OxlN.js +1 -0
- package/dist/webcomponents/p-af7c219d.entry.js +1 -0
- package/dist/webcomponents/{p-74fea39c.entry.js → p-b752c5bc.entry.js} +1 -1
- package/dist/webcomponents/{p-f23428da.entry.js → p-bbff6196.entry.js} +1 -1
- package/dist/webcomponents/p-c0c36187.entry.js +1 -0
- package/dist/webcomponents/{p-ff5981fb.entry.js → p-d077569e.entry.js} +1 -1
- package/dist/webcomponents/{p-87988b4d.entry.js → p-d7b1b7b5.entry.js} +1 -1
- package/dist/webcomponents/{p-095cedc5.entry.js → p-dc6c9c79.entry.js} +1 -1
- package/dist/webcomponents/p-ecbc83bf.entry.js +1 -0
- package/dist/webcomponents/{p-b2a0cbad.entry.js → p-f56d7b4c.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/docs/.eslintrc.cjs +17 -0
- package/docs/changelog/index.mdx +17 -0
- package/docs/entities/businessdetails/index.mdx +143 -0
- package/docs/entities/businessform/index.mdx +241 -0
- package/docs/entities/index.mdx +19 -0
- package/docs/entities/payment-provisioning/index.mdx +128 -0
- package/docs/frameworks/angular/index.mdx +112 -0
- package/docs/frameworks/index.mdx +18 -0
- package/docs/frameworks/react/index.mdx +125 -0
- package/docs/frameworks/vue/index.mdx +102 -0
- package/docs/helpers/PartsTable.js +50 -0
- package/docs/helpers/PropsTable.js +56 -0
- package/docs/helpers/index.ts +3 -0
- package/docs/helpers/version.js +32 -0
- package/docs/introduction/index.mdx +125 -0
- package/docs/merchant-tools/checkouts-list/index.mdx +97 -0
- package/docs/merchant-tools/gross-payments-chart/index.mdx +83 -0
- package/docs/merchant-tools/index.mdx +25 -0
- package/docs/merchant-tools/order-terminals/index.mdx +84 -0
- package/docs/merchant-tools/payment-details/index.mdx +132 -0
- package/docs/merchant-tools/payment-transactions-list/index.mdx +85 -0
- package/docs/merchant-tools/payments-list/index.mdx +109 -0
- package/docs/merchant-tools/payout-details/index.mdx +84 -0
- package/docs/merchant-tools/payout-transactions-list/index.mdx +84 -0
- package/docs/merchant-tools/payouts-list/index.mdx +92 -0
- package/docs/merchant-tools/terminal-orders-list/index.mdx +85 -0
- package/docs/merchant-tools/terminals-list/index.mdx +93 -0
- package/docs/modular-checkout/complete-examples/index.mdx +20 -0
- package/docs/modular-checkout/index.mdx +20 -0
- package/docs/modular-checkout/introduction/index.mdx +102 -0
- package/docs/modular-checkout/sub-components/apple-pay.mdx +106 -0
- package/docs/modular-checkout/sub-components/bank-account-form.mdx +167 -0
- package/docs/modular-checkout/sub-components/card-form.mdx +178 -0
- package/docs/modular-checkout/sub-components/index.mdx +23 -0
- package/docs/modular-checkout/sub-components/payment-method-options.mdx +87 -0
- package/docs/modular-checkout/sub-components/plaid-payment-method.mdx +158 -0
- package/docs/modular-checkout/sub-components/saved-payment-methods.mdx +183 -0
- package/docs/modular-checkout/sub-components/season-interruption-insurance.mdx +221 -0
- package/docs/modular-checkout/sub-components/sezzle-payment-method.mdx +183 -0
- package/docs/modular-checkout/sub-components/summary.mdx +111 -0
- package/docs/payment-facilitation/dispute-management/index.mdx +99 -0
- package/docs/payment-facilitation/index.mdx +21 -0
- package/docs/payment-facilitation/refund-payment/index.mdx +241 -0
- package/docs/payment-facilitation/tokenize-payment-method/index.mdx +350 -0
- package/docs/payment-facilitation/unified-fintech-checkout/342/204/242/index.mdx +150 -0
- package/package.json +21 -6
- package/dist/webcomponents/p-0e981c28.entry.js +0 -1
- package/dist/webcomponents/p-15ceeea7.entry.js +0 -1
- package/dist/webcomponents/p-9c1aa22d.entry.js +0 -1
- package/dist/webcomponents/p-CsRppqXL.js +0 -1
- package/dist/webcomponents/p-aa145996.entry.js +0 -1
- package/dist/webcomponents/p-b5b49e86.entry.js +0 -1
- package/dist/webcomponents/p-d9cdd873.entry.js +0 -1
- package/dist/webcomponents/p-ef04f334.entry.js +0 -1
- package/dist/webcomponents/p-f5dd3fa4.entry.js +0 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: payment-facilitation/refund-payment/index
|
|
3
|
+
title: Refund Payment
|
|
4
|
+
description: Guided UI for issuing full or partial refunds with reason codes and audit trails.
|
|
5
|
+
sidebar_position: 33
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
PropsTable,
|
|
10
|
+
PartsTable,
|
|
11
|
+
getWebcomponentsVersion,
|
|
12
|
+
} from '@justifi/webcomponents/docs/helpers';
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Component to render a form for partially or fully refunding a payment based on a provided payment ID.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
<pre><code className="language-html">{`<!DOCTYPE html>
|
|
21
|
+
<html dir="ltr" lang="en">
|
|
22
|
+
|
|
23
|
+
<head>
|
|
24
|
+
<meta charset="utf-8" />
|
|
25
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
|
|
26
|
+
<title>justifi-refund-payment</title>
|
|
27
|
+
|
|
28
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@justifi/webcomponents@${getWebcomponentsVersion()}/dist/webcomponents/webcomponents.esm.js"></script>
|
|
29
|
+
|
|
30
|
+
<script
|
|
31
|
+
nomodule
|
|
32
|
+
src="https://cdn.jsdelivr.net/npm/@justifi/webcomponents@${getWebcomponentsVersion()}/dist/webcomponents/webcomponents.js"
|
|
33
|
+
></script>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
::part(font-family) {
|
|
37
|
+
font-family: georgia;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
::part(color) {
|
|
41
|
+
color: darkslategray;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
::part(background-color) {
|
|
45
|
+
background-color: transparent;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
::part(button) {
|
|
49
|
+
padding: 0.375rem 0.75rem;
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
border-radius: 0px;
|
|
53
|
+
line-height: 1.5;
|
|
54
|
+
text-transform: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
::part(button-disabled) {
|
|
58
|
+
opacity: 0.5;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
::part(input) {
|
|
62
|
+
border-color: #555;
|
|
63
|
+
border-width: 1px;
|
|
64
|
+
border-bottom-width: 1px;
|
|
65
|
+
border-left-width: 1px;
|
|
66
|
+
border-right-width: 1px;
|
|
67
|
+
border-top-width: 1px;
|
|
68
|
+
border-radius: 0;
|
|
69
|
+
border-style: solid;
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
font-size: 1rem;
|
|
72
|
+
font-weight: normal;
|
|
73
|
+
line-height: 1.5;
|
|
74
|
+
padding: 0.375rem 0.75rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
::part(input-focused) {
|
|
78
|
+
border-color: #333;
|
|
79
|
+
box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
::part(input-invalid) {
|
|
83
|
+
border-color: #8a2a35;
|
|
84
|
+
box-shadow: 0 0 0 0.25rem rgba(244, 67, 54, 0.25);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
::part(input-invalid-and-focused) {
|
|
88
|
+
box-shadow: 0 0 0 0.25rem rgba(244, 67, 54, 0.25);
|
|
89
|
+
border-color: #8a2a35;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
::part(button-primary) {
|
|
93
|
+
color: #333;
|
|
94
|
+
background-color: transparent;
|
|
95
|
+
border-color: #333;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
::part(button-primary):hover {
|
|
99
|
+
background-color: rgba(0, 0, 0, .05);
|
|
100
|
+
border-color: #333;
|
|
101
|
+
color: #333;
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
104
|
+
|
|
105
|
+
</head>
|
|
106
|
+
|
|
107
|
+
<body>
|
|
108
|
+
<justifi-refund-payment
|
|
109
|
+
payment-id="payment_123"
|
|
110
|
+
account-id="acc_123"
|
|
111
|
+
auth-token="web-component-token"
|
|
112
|
+
hide-submit-button="true"
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
<!-- Optional external button - this is only needed if the built in button is hidden via the hide-submit-button prop
|
|
116
|
+
and the refund is submitted via provided refundPayment() method - see below. -->
|
|
117
|
+
|
|
118
|
+
<button id="submit-refund-button">Submit Refund</button>
|
|
119
|
+
</body>
|
|
120
|
+
|
|
121
|
+
<script>
|
|
122
|
+
(function () {
|
|
123
|
+
var refundForm = document.querySelector("justifi-refund-payment");
|
|
124
|
+
|
|
125
|
+
refundForm.addEventListener("submit-event", (event) => {
|
|
126
|
+
/* this event is raised when the server response is received */
|
|
127
|
+
console.log("server response received", event.detail.response);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
refundForm.addEventListener("error-event", (event) => {
|
|
131
|
+
/* here is where you would handle the error */
|
|
132
|
+
console.error('error-event', event.detail);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/* manually call Refund with provided method, if built-in submit button is hidden */
|
|
136
|
+
document.getElementById("submit-refund-button").addEventListener("click", async () => {
|
|
137
|
+
const refundData = await refundForm.refundPayment();
|
|
138
|
+
console.log('Refund data', refundData);
|
|
139
|
+
});
|
|
140
|
+
})();
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
</html>`}</code></pre>
|
|
144
|
+
|
|
145
|
+
## Props, Events & Methods
|
|
146
|
+
|
|
147
|
+
<div
|
|
148
|
+
dangerouslySetInnerHTML={{
|
|
149
|
+
__html: PropsTable([
|
|
150
|
+
{
|
|
151
|
+
name: 'account-id',
|
|
152
|
+
type: 'string',
|
|
153
|
+
required: true,
|
|
154
|
+
description:
|
|
155
|
+
'Ensures refunds are scoped to the correct platform account.',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: 'auth-token',
|
|
159
|
+
type: 'string',
|
|
160
|
+
required: true,
|
|
161
|
+
description: 'Token with `write:refunds` scope.',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'payment-id',
|
|
165
|
+
type: 'string',
|
|
166
|
+
required: true,
|
|
167
|
+
description: 'Payment being refunded.',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'max-amount',
|
|
171
|
+
type: 'string | number',
|
|
172
|
+
description:
|
|
173
|
+
'Upper limit for partial refunds (defaults to remaining amount).',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'default-reason',
|
|
177
|
+
type: 'string',
|
|
178
|
+
description: 'Preselects a refund reason code.',
|
|
179
|
+
},
|
|
180
|
+
]),
|
|
181
|
+
}}
|
|
182
|
+
/>
|
|
183
|
+
|
|
184
|
+
### Events
|
|
185
|
+
|
|
186
|
+
- `submitted`: Emits when the refund is created; payload includes `refund_id` and amount.
|
|
187
|
+
- `error-event`: Fires when validation or network calls fail.
|
|
188
|
+
|
|
189
|
+
### Public methods
|
|
190
|
+
|
|
191
|
+
1. `submit()` – Trigger the refund flow (useful if the component is inside a modal with custom buttons).
|
|
192
|
+
2. `focus()` – Move focus to the amount input.
|
|
193
|
+
|
|
194
|
+
## Theming & Layout
|
|
195
|
+
|
|
196
|
+
<div
|
|
197
|
+
dangerouslySetInnerHTML={{
|
|
198
|
+
__html: PartsTable([
|
|
199
|
+
{
|
|
200
|
+
name: 'font-family',
|
|
201
|
+
description: 'Controls the font family for the component.',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'color',
|
|
205
|
+
description: 'Controls the text color.',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: 'background-color',
|
|
209
|
+
description: 'Controls the background color.',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'button',
|
|
213
|
+
description: 'Button styles.',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'button-disabled',
|
|
217
|
+
description: 'Disabled button styles.',
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: 'input',
|
|
221
|
+
description: 'Input field styles.',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'input-focused',
|
|
225
|
+
description: 'Input styles when focused.',
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'input-invalid',
|
|
229
|
+
description: 'Input styles when invalid.',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: 'input-invalid-and-focused',
|
|
233
|
+
description: 'Input styles when invalid and focused.',
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'button-primary',
|
|
237
|
+
description: 'Primary button styles.',
|
|
238
|
+
},
|
|
239
|
+
]),
|
|
240
|
+
}}
|
|
241
|
+
/>
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: payment-facilitation/tokenize-payment-method/index
|
|
3
|
+
title: Tokenize Payment Method
|
|
4
|
+
description: Secure standalone card/bank tokenization form with built-in validation and iframe isolation.
|
|
5
|
+
sidebar_position: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
PropsTable,
|
|
10
|
+
PartsTable,
|
|
11
|
+
getWebcomponentsVersion,
|
|
12
|
+
} from '@justifi/webcomponents/docs/helpers';
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
Component to render an entire form including a switch to use a credit card or bank account, a submit button and all fields required for proper use. This component can be used standalone or as part of the modular checkout system.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
<pre><code className="language-html">{`<!DOCTYPE html>
|
|
21
|
+
<html dir="ltr" lang="en">
|
|
22
|
+
|
|
23
|
+
<head>
|
|
24
|
+
<meta charset="utf-8" />
|
|
25
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
|
|
26
|
+
<title>justifi-tokenize-payment-method</title>
|
|
27
|
+
|
|
28
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@justifi/webcomponents@${getWebcomponentsVersion()}/dist/webcomponents/webcomponents.esm.js"></script>
|
|
29
|
+
|
|
30
|
+
<script
|
|
31
|
+
nomodule
|
|
32
|
+
src="https://cdn.jsdelivr.net/npm/@justifi/webcomponents@${getWebcomponentsVersion()}/dist/webcomponents/webcomponents.js"
|
|
33
|
+
></script>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
::part(font-family) {
|
|
37
|
+
font-family: georgia;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
::part(color) {
|
|
41
|
+
color: darkslategray;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
::part(background-color) {
|
|
45
|
+
background-color: transparent;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
::part(button) {
|
|
49
|
+
padding: 0.375rem 0.75rem;
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
border-radius: 0px;
|
|
53
|
+
line-height: 1.5;
|
|
54
|
+
text-transform: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
::part(button-disabled) {
|
|
58
|
+
opacity: 0.5;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
::part(input) {
|
|
62
|
+
border-color: #555;
|
|
63
|
+
border-width: 1px;
|
|
64
|
+
border-bottom-width: 1px;
|
|
65
|
+
border-left-width: 1px;
|
|
66
|
+
border-right-width: 1px;
|
|
67
|
+
border-top-width: 1px;
|
|
68
|
+
border-radius: 0;
|
|
69
|
+
border-style: solid;
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
font-size: 1rem;
|
|
72
|
+
font-weight: normal;
|
|
73
|
+
line-height: 1.5;
|
|
74
|
+
padding: 0.375rem 0.75rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
::part(input-focused) {
|
|
78
|
+
border-color: #333;
|
|
79
|
+
box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
::part(input-invalid) {
|
|
83
|
+
border-color: #8a2a35;
|
|
84
|
+
box-shadow: 0 0 0 0.25rem rgba(244, 67, 54, 0.25);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
::part(input-invalid-and-focused) {
|
|
88
|
+
box-shadow: 0 0 0 0.25rem rgba(244, 67, 54, 0.25);
|
|
89
|
+
border-color: #8a2a35;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
::part(input-radio) {
|
|
93
|
+
background-color: #fff;
|
|
94
|
+
border-color: #333;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
::part(input-checkbox) {
|
|
98
|
+
border-color: #333;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
::part(input-checkbox-checked) {
|
|
102
|
+
background-color: #000;
|
|
103
|
+
border-color: #333;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
::part(input-checkbox-checked-focused) {
|
|
107
|
+
background-color: #000;
|
|
108
|
+
box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
::part(input-checkbox-focused) {
|
|
112
|
+
background-color: #fff;
|
|
113
|
+
box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.25);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
::part(button-primary) {
|
|
117
|
+
color: #333;
|
|
118
|
+
background-color: transparent;
|
|
119
|
+
border-color: #333;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
::part(button-primary):hover {
|
|
123
|
+
background-color: rgba(0, 0, 0, .05);
|
|
124
|
+
border-color: #333;
|
|
125
|
+
color: #333;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
::part(radio-list-item) {
|
|
129
|
+
border-bottom: 1px solid #ddd;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
::part(radio-list-item):hover {
|
|
133
|
+
background-color: #f9f9f9;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
137
|
+
|
|
138
|
+
</head>
|
|
139
|
+
|
|
140
|
+
<body>
|
|
141
|
+
<justifi-tokenize-payment-method
|
|
142
|
+
account-id="acc_123"
|
|
143
|
+
auth-token="authToken"
|
|
144
|
+
payment-method-group-id="pmg_123"
|
|
145
|
+
submit-button-text="Tokenize Payment Method"
|
|
146
|
+
/>
|
|
147
|
+
</body>
|
|
148
|
+
|
|
149
|
+
<script>
|
|
150
|
+
const justifiTokenizePaymentMethod = document.querySelector("justifi-tokenize-payment-method");
|
|
151
|
+
|
|
152
|
+
// Handle successful tokenization
|
|
153
|
+
justifiTokenizePaymentMethod.addEventListener("submit-event", (event) => {
|
|
154
|
+
const response = event.detail.response;
|
|
155
|
+
console.log("Tokenization successful:", response);
|
|
156
|
+
|
|
157
|
+
if (response.token) {
|
|
158
|
+
console.log("Payment method token:", response.token);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (response.data) {
|
|
162
|
+
console.log("Full payment method data:", response.data);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Handle errors
|
|
167
|
+
justifiTokenizePaymentMethod.addEventListener("error-event", (event) => {
|
|
168
|
+
console.error("Tokenization error:", event.detail);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// External tokenize button (when built-in submit button is hidden)
|
|
172
|
+
document.getElementById("tokenize-button").addEventListener("click", async () => {
|
|
173
|
+
try {
|
|
174
|
+
const result = await justifiTokenizePaymentMethod.tokenizePaymentMethod();
|
|
175
|
+
console.log("External tokenization result:", result);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
console.error("External tokenization failed:", error);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Fill billing form programmatically
|
|
182
|
+
document.getElementById("fill-billing-form").addEventListener("click", async () => {
|
|
183
|
+
await justifiTokenizePaymentMethod.fillBillingForm({
|
|
184
|
+
name: "John Doe",
|
|
185
|
+
address_line1: "123 Main St",
|
|
186
|
+
address_line2: "Apt 1",
|
|
187
|
+
address_city: "Anytown",
|
|
188
|
+
address_state: "NY", // Use 2-letter state code
|
|
189
|
+
address_postal_code: "12345",
|
|
190
|
+
});
|
|
191
|
+
console.log("Billing form filled");
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// Validate form
|
|
195
|
+
document.getElementById("validate-form").addEventListener("click", async () => {
|
|
196
|
+
const validation = await justifiTokenizePaymentMethod.validate();
|
|
197
|
+
console.log("Validation result:", validation);
|
|
198
|
+
|
|
199
|
+
if (validation.isValid) {
|
|
200
|
+
console.log("Form is valid!");
|
|
201
|
+
} else {
|
|
202
|
+
console.log("Form has errors:", validation.errors);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
</script>
|
|
207
|
+
|
|
208
|
+
</html>`}</code></pre>
|
|
209
|
+
|
|
210
|
+
## Props, Events & Methods
|
|
211
|
+
|
|
212
|
+
<div
|
|
213
|
+
dangerouslySetInnerHTML={{
|
|
214
|
+
__html: PropsTable([
|
|
215
|
+
{
|
|
216
|
+
name: 'account-id',
|
|
217
|
+
type: 'string',
|
|
218
|
+
required: true,
|
|
219
|
+
description:
|
|
220
|
+
'Platform account that will own the resulting payment method.',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'auth-token',
|
|
224
|
+
type: 'string',
|
|
225
|
+
required: true,
|
|
226
|
+
description:
|
|
227
|
+
'Short-lived Web Component Token with `write:tokenize:account_id` scope.',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: 'payment-method-group-id',
|
|
231
|
+
type: 'string',
|
|
232
|
+
description:
|
|
233
|
+
'Optional grouping identifier that lets you preselect payment rails in Modular Checkout.',
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'hide-submit-button',
|
|
237
|
+
type: 'boolean',
|
|
238
|
+
defaultValue: 'false',
|
|
239
|
+
description:
|
|
240
|
+
'Hides the internal CTA when hosting app handles submission.',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'save-payment-method-label',
|
|
244
|
+
type: 'string',
|
|
245
|
+
description:
|
|
246
|
+
'Overrides the checkbox label when allowing customers to store a card.',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: 'locale',
|
|
250
|
+
type: 'string',
|
|
251
|
+
defaultValue: 'en-US',
|
|
252
|
+
description:
|
|
253
|
+
'Controls localization of labels, placeholders, and currency formatting.',
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'theme',
|
|
257
|
+
type: 'string',
|
|
258
|
+
description:
|
|
259
|
+
'Name of a predefined theme exported by JustiFi (optional).',
|
|
260
|
+
},
|
|
261
|
+
]),
|
|
262
|
+
}}
|
|
263
|
+
/>
|
|
264
|
+
|
|
265
|
+
### Events
|
|
266
|
+
|
|
267
|
+
- `tokenized`: fires when a payment token is created; payload includes `payment_method_token` and metadata.
|
|
268
|
+
- `error`: fires if tokenization fails; payload includes `code`, `message`, and validation hints.
|
|
269
|
+
|
|
270
|
+
### Public methods
|
|
271
|
+
|
|
272
|
+
1. `tokenizePaymentMethod()` – programmatically trigger submission (returns a promise that resolves to a token payload).
|
|
273
|
+
2. `fillBillingForm(partialBillingDetails)` – prefill customers' billing information from saved data.
|
|
274
|
+
|
|
275
|
+
## Theming & Layout
|
|
276
|
+
|
|
277
|
+
- Hosted fields remain inside PCI-safe iframes, so styling focuses on the outer wrapper plus the `::part` hooks listed below.
|
|
278
|
+
|
|
279
|
+
<div
|
|
280
|
+
dangerouslySetInnerHTML={{
|
|
281
|
+
__html: PartsTable([
|
|
282
|
+
{
|
|
283
|
+
name: 'font-family',
|
|
284
|
+
description: 'Controls the font family for the component.',
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: 'color',
|
|
288
|
+
description: 'Controls the text color.',
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: 'background-color',
|
|
292
|
+
description: 'Controls the background color.',
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: 'button',
|
|
296
|
+
description: 'Button styles.',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'button-disabled',
|
|
300
|
+
description: 'Disabled button styles.',
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
name: 'input',
|
|
304
|
+
description: 'Input field styles.',
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: 'input-focused',
|
|
308
|
+
description: 'Input styles when focused.',
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: 'input-invalid',
|
|
312
|
+
description: 'Input styles when invalid.',
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: 'input-invalid-and-focused',
|
|
316
|
+
description: 'Input styles when invalid and focused.',
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: 'input-radio',
|
|
320
|
+
description: 'Radio input styles.',
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: 'input-checkbox',
|
|
324
|
+
description: 'Checkbox input styles.',
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: 'input-checkbox-checked',
|
|
328
|
+
description: 'Checkbox input styles when checked.',
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
name: 'input-checkbox-checked-focused',
|
|
332
|
+
description: 'Checkbox input styles when checked and focused.',
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: 'input-checkbox-focused',
|
|
336
|
+
description: 'Checkbox input styles when focused.',
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: 'button-primary',
|
|
340
|
+
description: 'Primary button styles.',
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: 'radio-list-item',
|
|
344
|
+
description: 'Radio list item styles.',
|
|
345
|
+
},
|
|
346
|
+
]),
|
|
347
|
+
}}
|
|
348
|
+
/>
|
|
349
|
+
|
|
350
|
+
- Slots are not exposed (all inputs are encapsulated in PCI iframes), so styling relies on CSS variables and `::part` hooks for wrapper elements.
|