WDE0002: itemId must be a string error while retrieving data from dataset in dynamic page

Dear Wix Team,
I am facing this error when I try calling a currentItem id from the dataset on the dynamic page. Your support is much appreciated. Below is the code used to retrieve data from dataset1 on the dynamic page.
Objective: when customer clicks a button, it should initiate payment taking the custom price, quantity from customer on custom product page and add it into the cart page without altering the original price in the dataset.

//*Client Side Program//
import wixData from ‘wix-data’ ;
import { createMyPayment } from ‘backend/pay’ ;
import wixPay from ‘wix-pay’ ;
import wixUsers from ‘wix-users’ ;

export function pay_click_1(event, $w) {
$w( “#dataset1” ).onReady(() => {
console.log( “The dataset is ready with Items” );
// get the current item from the dataset
const currentItem = $w( “#dataset1” ).getCurrentItem()
console.log(currentItem);
//let userId = wixUsers.currentUser.id;
//let productId = event.context.itemId;
const productId = currentItem._id;
console.log(productId);
//let selectedProduct = $item(‘#dataset1’).getCurrentItem().toString();
let price = Number($w( ‘#bookingadvance’ ).text)
let quantity = Number($w( ‘#Quantity’ ).value);
createMyPayment(productId, price, quantity)
.then((payment) => {
wixPay.startPayment(payment.id);
$w( ‘#shoppingCartIcon1’ ).addToCart(productId)
.then(() => {
console.log( “add product ${productId} success” );
})
. catch ((error) => {
console.log(error);
});

        }); 
}); 

}
//Backend Program

import wixData from ‘wix-data’ ;
import wixPayBackend from ‘wix-pay-backend’ ;
export async function createMyPayment(productId, price, quantity) {
return wixData. get ( “ProductsforSale” , productId)
.then( (product) => {
return wixPayBackend.createPayment( {
items: [{
name: productId.productName,
price: price,
quantity: quantity,
}],
amount: price
} );
} );
}

Error I am getting is

WixPayBackend.createPayment: can’t create payment, details: The field [.items[0].name] is missing.

WixPayBackend.createPayment: The field [.items[0].name] is missing.

WixPayBackend.createPayment: can’t create payment, details: The field [.items[0].name] is missing.

Please Help.

Hi Wix Team, Any help here please?

Did you ever resolve this? I’m having a similar issue.

Got to love wix!

I think the problem lies here:

return wixData.get("ProductsforSale", productId)     
.then( (product) => {return wixPayBackend.createPayment( {
        items: [{          
        name: productId.productName,          
        price: price,          
        quantity: quantity,        }],

productId.productName is probably undefined. In JSON, undefined values trigger the elimination of the key.
Shouldn’t it be product.productName?