Add basic card payment flow

This commit is contained in:
Emili Castells Guasch 2024-05-16 12:29:05 +02:00
parent e3ac190849
commit aec32512ce
2 changed files with 47 additions and 61 deletions

View file

@ -7,21 +7,11 @@ export const CheckoutHandler = ({onPaymentSetup, responseTypes}) => {
useEffect(() => {
const unsubscribe = onPaymentSetup(async () => {
cardFieldsForm.submit()
.then(() => {
return {
type: responseTypes.SUCCESS,
meta: {
paymentMethodData: {
foo: 'bar',
}
}
};
})
.catch((err) => {
await cardFieldsForm.submit()
.catch((error) => {
console.error(error)
return {
type: responseTypes.ERROR,
message: err
}
});
})