init hosted fields functionality

This commit is contained in:
David Remer 2020-04-30 15:28:48 +03:00
parent 1225ad83c8
commit 23dd407fc8
21 changed files with 212 additions and 45 deletions

View file

@ -0,0 +1,21 @@
const onApprove = (context) => {
return (data, actions) => {
return fetch(context.config.ajax.approve_order.endpoint, {
method: 'POST',
body: JSON.stringify({
nonce: context.config.ajax.approve_order.nonce,
order_id:data.orderID
})
}).then((res)=>{
return res.json();
}).then((data)=>{
if (!data.success) {
throw Error(data.data);
}
location.href = context.config.redirect;
});
}
}
export default onApprove;