Wix payment complains about negative price used for discount

I am trying to put together a wix-payment system to collect membership dues. If a member had referred another member in the previous year they get a referral discount applied to their dues the next year. When they pay their dues I apply the discount at checkout. The problem I am facing is I am not able to set a negative value as the price for the discount.

items[0] { name: “2022 membership”, price:35}
items[1] { name:“Referral discount”, price:-10}
amount: 25

I get the following error in my log:

“jsonPayload”: { “message”:“[“WixPayBackend.createPayment: Could not decode [-10] at [.items[1].price] as [must be > 0].”]”

How do you guys do discount at checkout?

I have had to code a site which used discount codes. What I had to do was to change the price to reflect the discounted amount.

Eg: your items[0] would be $25.00.

The problem that I had is that I could not add an additional item line with a $0.00 amount. I wanted to put the discount amount in a comment as a second item
but the createPayment won’t allow $0.00 amounts.
I wish there was a way in createPayment to allow a comment block to be added that could address things like this that would show up on the invoice that the user could see that they got a discount.

What I did was change the description of the items[0] to indicate that a $10.00 was applied.

If you want to add a backordered item line and put it on the invoice, you can’t do it with the createPayment API.

Frustrating as hell.

I wonder what would happen if you put a newline ‘\n’ or a ‘
’ tag in your description if it would continue to the second line and continue the description?

I could modify the item[0] name to reflect the discount as well as its price. But that is not how invoices are made. Wix’s implementation seems lacking in a lot of ways. For example there is no logo or anything on that window that comes up. It is just bland. At least it should say it is Wix Payment or something to that effect so that the user does not think that the payment system is implemented by someone who is not experienced.

Giving discounts is a very common thing. And if it can’t support negative numbers, they need to hire someone who knows how to implement logic that takes negative price as long as the total “amount” is > 0.

Sounds like a good feature request. The Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.

Meanwhile, I’ve reached out to the Payments team to see if they have any suggestions.

Thank you Yisrael. I hope there is some feature that I do not know of. I started Wix-Pay functionality only yesterday. So am just getting my feet wet.