@superlogic/spree-pay 0.1.8 → 0.1.9
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 +3 -2
- package/build/index.cjs +4 -1
- package/build/index.d.cts +2 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ npm i @superlogic/spree-pay
|
|
|
14
14
|
import { useState } from 'react';
|
|
15
15
|
|
|
16
16
|
import { SpreePay, SpreePayProvider, useSpreePay } from '@superlogic/spree-pay';
|
|
17
|
+
import '@superlogic/spree-pay/styles.css';
|
|
17
18
|
|
|
18
19
|
const spreeEnv = {
|
|
19
20
|
tenantId: 'moca' // Keep moca for crypto payments on BASE network
|
|
@@ -31,7 +32,7 @@ function Checkout() {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
function CheckoutContent() {
|
|
34
|
-
const { process } = useSpreePay(); // Access payment process function (must be inside provider)
|
|
35
|
+
const { process, selectedPaymentMethod, isProcessing } = useSpreePay(); // Access payment process function and processing state (must be inside provider)
|
|
35
36
|
const [status, setStatus] = useState<'idle' | 'processing' | 'success' | 'error'>('idle');
|
|
36
37
|
|
|
37
38
|
async function handleProcess() {
|
|
@@ -48,7 +49,7 @@ function CheckoutContent() {
|
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
51
|
<div style={{ maxWidth: 540 }}>
|
|
51
|
-
<SpreePay amount={99} onProcess={handleProcess} />
|
|
52
|
+
<SpreePay isLoading={status === 'processing'} amount={99} onProcess={handleProcess} />
|
|
52
53
|
{status === 'success' && <p>Payment successful! Thank you for your order.</p>}
|
|
53
54
|
{status === 'error' && <p>Payment failed. Please try again.</p>}
|
|
54
55
|
</div>
|
package/build/index.cjs
CHANGED
|
@@ -577,12 +577,15 @@ var cardPayment = async ({ card, hash, redirect3dsURI }) => {
|
|
|
577
577
|
if (paymentIntent) {
|
|
578
578
|
const { data: validateData } = await SlapiPaymentService.validate3DS({ paymentId: paymentResData.id });
|
|
579
579
|
return {
|
|
580
|
-
status: validateData.status
|
|
580
|
+
status: validateData.status,
|
|
581
|
+
txHash: null,
|
|
582
|
+
paymentId: paymentResData.id
|
|
581
583
|
};
|
|
582
584
|
}
|
|
583
585
|
}
|
|
584
586
|
return {
|
|
585
587
|
status: paymentResData.status,
|
|
588
|
+
txHash: null,
|
|
586
589
|
paymentId: paymentResData.id
|
|
587
590
|
};
|
|
588
591
|
};
|
package/build/index.d.cts
CHANGED
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -538,12 +538,15 @@ var cardPayment = async ({ card, hash, redirect3dsURI }) => {
|
|
|
538
538
|
if (paymentIntent) {
|
|
539
539
|
const { data: validateData } = await SlapiPaymentService.validate3DS({ paymentId: paymentResData.id });
|
|
540
540
|
return {
|
|
541
|
-
status: validateData.status
|
|
541
|
+
status: validateData.status,
|
|
542
|
+
txHash: null,
|
|
543
|
+
paymentId: paymentResData.id
|
|
542
544
|
};
|
|
543
545
|
}
|
|
544
546
|
}
|
|
545
547
|
return {
|
|
546
548
|
status: paymentResData.status,
|
|
549
|
+
txHash: null,
|
|
547
550
|
paymentId: paymentResData.id
|
|
548
551
|
};
|
|
549
552
|
};
|