WixPay with collection data

Hi to everyone!
I really need help with a piece of code that I just can’t solve. I really hope some of you have an advice because apart from the API I could not find examples here in the forum to solve it by myself.

I need to create a payment button using WixPay where the price value depends on a variable.
I thought about using this code: https://www.wix.com/corvid/reference/wix-pay/startpayment

and I tried to fit it like this:

**** backend code pay.jsw ****

import wixPayBackend from ‘wix-pay-backend’ ;
import wixData from ‘wix-data’ ;

export async function createPhotoPayment(codeOpera) { //codeOpera is my code of photo i
return wixData.get( “mediaGallery” , codeOpera) // mediaGallery is the dataset
.then( (photo) => {
return wixPayBackend.createPayment( {
items: [{
name: photo.titlePhoto, //titlePhoto is the field of the title in MediaGallery
price: photo.salePrice . // salePrice is the field of the price in MediaGallery
}],
amount: photo.salePrice
} );
} );
}

**** client-side ****

import { createPhotoPayment } from ‘backend/pay’ ;
import wixPay from ‘wix-pay’ ;

export function btnPay_click(event, $w) {
let item = $w( “#codeArtWork” ).value;
let codeOpera = $w( “#codeArtWork” ).value;
createPhotoPayment(event.context.codeOperaId)
.then((payment) => {
wixPay.startPayment(payment.id);
});
}

I have no mistakes, but nothing happens either! :frowning:
I wait your suggestions!
THANKS IN ADVANCE AS ALWAYS!