Hi
I have create a coupon input and I create a two pay API and I want from the input if the visitor type a specific code the pay API will change
However I wonder if this code is right or not
import wixPay from 'wix-pay';
import { createPaymentForProduct } from 'backend/EK_PayAPI backend/EKdisccount_PayAPI';
var couponCode = "FCES1ST";
export function button36_click(event) {
if ($w('#input5').value = couponCode) {
createPaymentForProduct2().then(payment => {
wixPay.startPayment(payment.id, { "termsAndConditionsLink": "https://ek4art.wixsite.com/ekart/terms-and-conditions" });
});
} else {
createPaymentForProduct1().then(payment => {
wixPay.startPayment(payment.id, { "termsAndConditionsLink": "https://ek4art.wixsite.com/ekart/terms-and-conditions" });
});
}
}
This is the EK_payAPI.jsw code
import wixPay from 'wix-pay-backend';
export function createPaymentForProduct1() {
return wixPay.createPayment1( {
amount: 120,
items: [{name: 'Portirat With Frame', price: 120}],
} );
}
This is the EKdisscount_payAPI.jsw code
import wixPay from 'wix-pay-backend';
export function createPaymentForProduct2() {
return wixPay.createPayment({
amount: 60,
items: [{ name: 'Portirat With Frame', price: 60 }],
});
}
Thank you for your helping the last few posts
- Eyad