How to add custom text data to Velo’s startPayment( ) API?
-I showed the ‘Name’ field in the pictures.
Backend Code;
import wixData from 'wix-data';
import wixPayBackend from 'wix-pay-backend';
export async function createMyPayment(productId, paraBirimi, fiyat, sayi) {
const izin = {
suppressAuth: true
}
return await wixData.query('Stores/Products').eq('_id', productId).find(izin).then(async (res) => {
const item = res.items[0];
const paymentItem = {
name: item.name,
price: fiyat,
quantity: sayi,
customTextFields: {
title: 'Name',
value: 'örnek name verisi'
}
};
console.log(paymentItem);
return wixPayBackend.createPayment({
items: [paymentItem],
amount: fiyat * sayi,
currency: paraBirimi
});
});
}
Page Code;
await createMyPayment(UrunID, DonusturulecekParaBirimi, Fiyat, Number($w('#Quantity').value)).then(async (res) => {
await wixPay.startPayment((res.id));
});