@bloque/payments-react 0.0.12 → 0.1.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.
- package/README.md +32 -2
- package/dist/bloque-checkout.d.ts +11 -3
- package/dist/bloque-checkout.js +9 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,15 +8,26 @@ React components for integrating Bloque hosted checkout into your React applicat
|
|
|
8
8
|
pnpm install @bloque/payments-react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Authentication
|
|
12
|
+
|
|
13
|
+
| Prop | Required | Description |
|
|
14
|
+
|------|----------|-------------|
|
|
15
|
+
| `publishableKey` | Yes | `pk_test_*` / `pk_live_*` — identifies the merchant (browser-safe) |
|
|
16
|
+
| `clientSecret` | Recommended | Scoped JWT from `bloque.checkout.create()` — authorizes payment execution |
|
|
17
|
+
|
|
18
|
+
> `publicApiKey` is still accepted for backward compatibility but is deprecated.
|
|
19
|
+
|
|
11
20
|
## Quick Start
|
|
12
21
|
|
|
13
22
|
```tsx
|
|
14
23
|
import { BloqueCheckout } from '@bloque/payments-react';
|
|
15
24
|
|
|
16
|
-
function CheckoutPage() {
|
|
25
|
+
function CheckoutPage({ checkoutId, clientSecret }) {
|
|
17
26
|
return (
|
|
18
27
|
<BloqueCheckout
|
|
19
|
-
checkoutId=
|
|
28
|
+
checkoutId={checkoutId}
|
|
29
|
+
publishableKey="pk_test_..."
|
|
30
|
+
clientSecret={clientSecret}
|
|
20
31
|
onSuccess={(data) => {
|
|
21
32
|
console.log('Payment successful!', data);
|
|
22
33
|
}}
|
|
@@ -28,6 +39,25 @@ function CheckoutPage() {
|
|
|
28
39
|
}
|
|
29
40
|
```
|
|
30
41
|
|
|
42
|
+
## 3D Secure (embedded checkout)
|
|
43
|
+
|
|
44
|
+
The hosted checkout can return a 3DS challenge. `@bloque/payments-core` / React show the challenge in a **parent-page overlay** (not inside the checkout iframe) via `postMessage`.
|
|
45
|
+
|
|
46
|
+
- Pass **`threeDsAuthType`** (sandbox only, e.g. `challenge_v2`) to drive Wompi sandbox scenarios.
|
|
47
|
+
- Optional **`onThreeDSChallenge`** runs when the overlay opens.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<BloqueCheckout
|
|
51
|
+
checkoutId="checkout_123abc"
|
|
52
|
+
publishableKey="pk_test_..."
|
|
53
|
+
clientSecret={clientSecret}
|
|
54
|
+
threeDsAuthType="challenge_v2"
|
|
55
|
+
onThreeDSChallenge={() => console.log('3DS started')}
|
|
56
|
+
onSuccess={(data) => console.log('ok', data)}
|
|
57
|
+
onError={(err) => console.error(err)}
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
31
61
|
## Documentation
|
|
32
62
|
|
|
33
63
|
For complete documentation, examples, and API reference, visit:
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { type BloqueCheckoutOptions } from '@bloque/payments-core';
|
|
2
|
-
export interface BloqueCheckoutProps extends Omit<BloqueCheckoutOptions, 'checkoutId'> {
|
|
2
|
+
export interface BloqueCheckoutProps extends Omit<BloqueCheckoutOptions, 'checkoutId' | 'three_ds_auth_type'> {
|
|
3
3
|
/**
|
|
4
4
|
* The checkout ID returned from your backend after creating a checkout session
|
|
5
5
|
*/
|
|
6
6
|
checkoutId: string;
|
|
7
|
+
/**
|
|
8
|
+
* Checkout-scoped JWT returned from the create checkout API
|
|
9
|
+
*/
|
|
10
|
+
clientSecret?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Sandbox-only Wompi 3DS scenario (e.g. challenge_v2).
|
|
13
|
+
*/
|
|
14
|
+
threeDsAuthType?: string;
|
|
7
15
|
/**
|
|
8
16
|
* Additional CSS class name for the container div
|
|
9
17
|
*/
|
|
@@ -37,6 +45,6 @@ export interface BloqueCheckoutProps extends Omit<BloqueCheckoutOptions, 'checko
|
|
|
37
45
|
* }
|
|
38
46
|
* ```
|
|
39
47
|
*/
|
|
40
|
-
export declare function BloqueCheckout({ checkoutId, publicApiKey, mode, checkoutUrl, appearance, showInstallments, paymentMethods, onReady, onSuccess, onError, onPending, iframeStyles, className, style, }: BloqueCheckoutProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
export type { AppearanceConfig, BloqueCheckoutOptions, BloqueInitOptions, PaymentMethod, PaymentResult, } from '@bloque/payments-core';
|
|
48
|
+
export declare function BloqueCheckout({ checkoutId, clientSecret, publishableKey, publicApiKey, mode, checkoutUrl, appearance, showInstallments, paymentMethods, onReady, onSuccess, onError, onPending, onThreeDSChallenge, threeDsAuthType, iframeStyles, className, style, }: BloqueCheckoutProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export type { AppearanceConfig, BloqueCheckoutOptions, BloqueInitOptions, PaymentMethod, PaymentResult, ThreeDSChallengeData, } from '@bloque/payments-core';
|
|
42
50
|
export { BloqueCheckout as BloqueCheckoutCore, init, } from '@bloque/payments-core';
|
package/dist/bloque-checkout.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { BloqueCheckout, init } from "@bloque/payments-core";
|
|
3
3
|
import { useEffect, useRef } from "react";
|
|
4
|
-
function bloque_checkout_BloqueCheckout({ checkoutId, publicApiKey, mode, checkoutUrl, appearance, showInstallments, paymentMethods, onReady, onSuccess, onError, onPending, iframeStyles, className, style }) {
|
|
4
|
+
function bloque_checkout_BloqueCheckout({ checkoutId, clientSecret, publishableKey, publicApiKey, mode, checkoutUrl, appearance, showInstallments, paymentMethods, onReady, onSuccess, onError, onPending, onThreeDSChallenge, threeDsAuthType, iframeStyles, className, style }) {
|
|
5
5
|
const containerRef = useRef(null);
|
|
6
6
|
const checkoutRef = useRef(null);
|
|
7
7
|
useEffect(()=>{
|
|
8
8
|
if (!containerRef.current) return;
|
|
9
9
|
const checkout = new BloqueCheckout({
|
|
10
10
|
checkoutId,
|
|
11
|
+
clientSecret,
|
|
12
|
+
publishableKey,
|
|
11
13
|
publicApiKey,
|
|
12
14
|
mode,
|
|
13
15
|
checkoutUrl,
|
|
@@ -18,6 +20,8 @@ function bloque_checkout_BloqueCheckout({ checkoutId, publicApiKey, mode, checko
|
|
|
18
20
|
onSuccess,
|
|
19
21
|
onError,
|
|
20
22
|
onPending,
|
|
23
|
+
onThreeDSChallenge,
|
|
24
|
+
three_ds_auth_type: threeDsAuthType,
|
|
21
25
|
iframeStyles
|
|
22
26
|
});
|
|
23
27
|
const iframe = checkout.createIframe();
|
|
@@ -28,6 +32,8 @@ function bloque_checkout_BloqueCheckout({ checkoutId, publicApiKey, mode, checko
|
|
|
28
32
|
};
|
|
29
33
|
}, [
|
|
30
34
|
checkoutId,
|
|
35
|
+
clientSecret,
|
|
36
|
+
publishableKey,
|
|
31
37
|
publicApiKey,
|
|
32
38
|
mode,
|
|
33
39
|
checkoutUrl,
|
|
@@ -38,6 +44,8 @@ function bloque_checkout_BloqueCheckout({ checkoutId, publicApiKey, mode, checko
|
|
|
38
44
|
onSuccess,
|
|
39
45
|
onError,
|
|
40
46
|
onPending,
|
|
47
|
+
onThreeDSChallenge,
|
|
48
|
+
threeDsAuthType,
|
|
41
49
|
iframeStyles
|
|
42
50
|
]);
|
|
43
51
|
return /*#__PURE__*/ jsx("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloque/payments-react",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "React wrapper for Bloque payments web components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@bloque/payments-core": "0.0
|
|
37
|
+
"@bloque/payments-core": "0.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=16.9.0",
|