Add wc invoice id when creating PayPal order

This commit is contained in:
Emili Castells Guasch 2024-03-08 17:38:43 +01:00
parent d2f39be90b
commit 2527f45a1e
5 changed files with 40 additions and 108 deletions

View file

@ -127,19 +127,7 @@ class CardFieldsRenderer {
const paymentToken = document.querySelector('input[name="wc-ppcp-credit-card-gateway-payment-token"]:checked')?.value
if(paymentToken && paymentToken !== 'new') {
fetch(this.defaultConfig.ajax.capture_card_payment.endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: this.defaultConfig.ajax.capture_card_payment.nonce,
payment_token: paymentToken
})
}).then((res) => {
return res.json();
}).then((data) => {
document.querySelector('#place_order').click();
});
document.querySelector('#place_order').click();
return;
}