mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 18:00:15 +08:00
init hosted fields functionality
This commit is contained in:
parent
1225ad83c8
commit
23dd407fc8
21 changed files with 212 additions and 45 deletions
|
@ -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;
|
Loading…
Add table
Add a link
Reference in a new issue