Custom Shopping Cart - Payments

Hello!
I create custom Cart/Store for my site where customer can buy many products at once.
After adding several products to the shopping cart, the customer can go to it.

All data from the order summary is updated when you increase the amount of product or delete one. I’d like to connect the wix-payments to this.

I know I have to create my payment in backend code (pay.jsw)

import wixPay from 'wix-pay-backend';

export function createMyPayment() {
  return wixPay.createPayment({
    items: [{
      name: "Product Name",
      price: 9.99
    }],
    amount: 19.98
  } );
}

My questions: Can I somehow connect the data from my “Total Cost” basket as “amount” in this backend code?
I’d get this cart data from the database collection.
Is “Item->name/price” required here? Can I replace it with cart data in my case?
Is that allowed? Will the payment run smoothly?

Thank you for all your answers! :slight_smile:

Anyone?

Hi Valgard,

Did you ever find a solution to this?

I’m trying to connect Wixpay to the shopping cart but it’s proving difficult.

Many thanks

No, I resigned from WIX. I think it is better to build websites using a different technology.

But now when I look at this code. I guess all you have to do is add the parameters you’re going to pass on the code in the shopping cart page.

ex.

import wixPay from 'wix-pay-backend';

export function createMyPayment(totalPrice) {
  return wixPay.createPayment({
    amount: totalPrice
  } );
}

I don’t know if this will help you, but I tried :slight_smile:

Generally I recommend to write websites with the use of standards technologies. HTML/CSS, Javascript, PHP, MySQL.

Have a nice day!

Thanks for taking the time to respond Valgard.
I really appreciate the info and the recommendation.

You’re clearly a good person :grinning:
Have a great day and I wish you the best for the future!