@paynext/sdk 0.0.48 → 0.0.50
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/README.md +7 -6
- package/dist/index.es.js +4 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# PayNext
|
|
1
|
+
# PayNext SDK
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for integrating PayNext payment processing with full type safety and multiple payment methods support.
|
|
4
4
|
|
|
@@ -18,11 +18,16 @@ import '@paynext/sdk/styles'
|
|
|
18
18
|
const checkout = new PayNextCheckout(document.getElementById('checkout-form'))
|
|
19
19
|
|
|
20
20
|
await checkout.mount({
|
|
21
|
-
clientToken: '
|
|
21
|
+
clientToken: '<you-client-token>',
|
|
22
|
+
environment: 'sandbox',
|
|
23
|
+
apiVersion: '1.0.0'
|
|
24
|
+
locale: 'en',
|
|
22
25
|
onCheckoutComplete: (result: PaymentResult) => {
|
|
26
|
+
// Handle successful payment
|
|
23
27
|
console.log('Payment successful!', result)
|
|
24
28
|
},
|
|
25
29
|
onCheckoutFail: (error: Error) => {
|
|
30
|
+
// Handle payment failure
|
|
26
31
|
console.error('Payment failed:', error)
|
|
27
32
|
}
|
|
28
33
|
})
|
|
@@ -48,10 +53,6 @@ export const CheckoutComponent: FC<Readonly<IProps> = (props) => {
|
|
|
48
53
|
const checkoutRef = useRef<HTMLDivElement>(null)
|
|
49
54
|
|
|
50
55
|
useEffect(() => {
|
|
51
|
-
if (!clientToken) {
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
56
|
const checkout = new PayNextCheckout(checkoutRef.current)
|
|
56
57
|
|
|
57
58
|
checkout.mount({
|
package/dist/index.es.js
CHANGED
|
@@ -3752,6 +3752,7 @@ class Uc {
|
|
|
3752
3752
|
const Bc = (n, e, t) => e.concat(n.filter((r) => e.every((i) => !t(r, i)))), _n = (n = "sandbox") => ({
|
|
3753
3753
|
develop: "https://api-dev.paynext.com",
|
|
3754
3754
|
sandbox: "https://api-sandbox.paynext.com",
|
|
3755
|
+
staging: "https://api-staging.paynext.com",
|
|
3755
3756
|
production: "https://api.paynext.com"
|
|
3756
3757
|
})[n], zc = [
|
|
3757
3758
|
{
|
|
@@ -3776,7 +3777,7 @@ const Bc = (n, e, t) => e.concat(n.filter((r) => e.every((i) => !t(r, i)))), _n
|
|
|
3776
3777
|
}
|
|
3777
3778
|
], jc = (n, e, t) => j(void 0, null, function* () {
|
|
3778
3779
|
var o, l, c, u, d, h, p, m, f, v, y, w, T, x, A, I, L, k, B, G, q, M, F, K, J, S, W, z, g, E, R, U, _, O, C, P, V, N, H, X, re, D, ee, me, ze, je, Ke, qe, He, We, Ge, Ye, Qe, An, wn, Tn, In, On, Nn, xn, Ln, Pn, Rn, Sn, kn, Mn, Dn, Vn, Fn, Un, Bn, zn, jn, Kn, qn, Hn, Wn, Gn, Yn, Qn, $n, Zn, Xn, Jn, er, tr, nr, rr, ir, ar, sr, or, lr, cr, ur, dr, pr, hr, mr, fr, vr, gr, yr, br, Er, _r, Cr, Ar, wr, Tr, Ir, Or;
|
|
3779
|
-
const r = `${_n(e)}/payments/create`, i = new Headers();
|
|
3780
|
+
const r = `${_n(e)}/internal/payments/create`, i = new Headers();
|
|
3780
3781
|
return i.append("Content-Type", "application/json"), i.append("X-API-Version", t), yield (yield fetch(r, {
|
|
3781
3782
|
method: "POST",
|
|
3782
3783
|
headers: i,
|
|
@@ -3833,14 +3834,14 @@ const Bc = (n, e, t) => e.concat(n.filter((r) => e.every((i) => !t(r, i)))), _n
|
|
|
3833
3834
|
})
|
|
3834
3835
|
})).json();
|
|
3835
3836
|
}), Kc = (n, e, t) => j(void 0, null, function* () {
|
|
3836
|
-
const r = `${_n(e)}/payments/create/billing/agreement`, i = new Headers();
|
|
3837
|
+
const r = `${_n(e)}/internal/payments/create/billing/agreement`, i = new Headers();
|
|
3837
3838
|
return i.append("Content-Type", "application/json"), i.append("X-API-Version", t), (yield (yield fetch(r, {
|
|
3838
3839
|
method: "POST",
|
|
3839
3840
|
headers: i,
|
|
3840
3841
|
body: JSON.stringify({ client_session: n })
|
|
3841
3842
|
})).json()).paypal_agreement_token_response.token_id || "";
|
|
3842
3843
|
}), qc = (n, e, t) => j(void 0, null, function* () {
|
|
3843
|
-
const r = `${_n(e)}/payments/config?client_session_id=${n}`, i = new Headers();
|
|
3844
|
+
const r = `${_n(e)}/internal/payments/config?client_session_id=${n}`, i = new Headers();
|
|
3844
3845
|
i.append("X-API-Version", t);
|
|
3845
3846
|
const s = yield (yield fetch(r, { headers: i })).json();
|
|
3846
3847
|
return s.checkout_config || (s.checkout_config = zc), s;
|