mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
✨ Submit axo_nonce
This commit is contained in:
parent
07d9ec5f88
commit
9234a833dd
1 changed files with 26 additions and 0 deletions
|
@ -76,6 +76,32 @@ const Axo = ( props ) => {
|
|||
card,
|
||||
] );
|
||||
|
||||
useEffect( () => {
|
||||
const unsubscribe = onPaymentSetup( async () => {
|
||||
// Validate payment options and emit response.
|
||||
|
||||
// Note: This response supports the Ryan flow (payment via saved card-token)
|
||||
return {
|
||||
type: emitResponse.responseTypes.SUCCESS,
|
||||
meta: {
|
||||
paymentMethodData: {
|
||||
axo_nonce: card?.id,
|
||||
},
|
||||
},
|
||||
};
|
||||
} );
|
||||
|
||||
// Unsubscribes when this component is unmounted.
|
||||
return () => {
|
||||
unsubscribe();
|
||||
};
|
||||
}, [
|
||||
emitResponse.responseTypes.ERROR,
|
||||
emitResponse.responseTypes.SUCCESS,
|
||||
onPaymentSetup,
|
||||
card,
|
||||
] );
|
||||
|
||||
const { setIsAxoActive, setIsGuest, setIsAxoScriptLoaded } =
|
||||
useDispatch( STORE_NAME );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue