I have a simple payment scenario set up on my site using Wix Payments as shown in this example:
https://support.wix.com/en/article/velo-tutorial-using-the-velo-pay-api-to-collect-payments-for-a-single-product
On another page, I need to know whether the user has in fact paid or not for the service. I can get the payment ID when the payment is created and store that with my user info. I see that all the information I need about the payments is kept in my site dashboard under Finances > Payments. Can I access this programmatically?
If not, I can keep the data I need when I receive wixPay_onPaymentUpdate events, but it seems unnecessary since everything I need is being stored in this Payments Table on the dashboard.
Hi there,
Unfortunately, you can’t access this data with Velo 
Thanks @ahmadnasriya . Now I have a question about the events that I will receive in my wixPay_onPaymentUpdate event handler. The docs say:
- When the customer places an order and it is approved, the payment appears on the payments dashboard in Status as: Pending Credit . Once the customers’s card issuer pays the funds to Wix the status of the payment changes to Successful .
When I test it with a purchase on my credit card, I only receive one event that is Successful. If there is delay between the transaction pending and being successful (I assume this depends on the credit card provider), will I receive two events? I’m not sure how to test this. In the end, I want to be able to look up the transaction ID in my own Payments collection (which I populate in the event handler) and see if that transaction is in the Successful state.
I’m also not quite sure which ID field I should be using to represent a payment. I want the _id field of my database Payments table to be one of these ids and then it would be a bit easier programmatically. I don’t quite understand the difference between the two.
event.transactionId – This is the Provider Payment ID in downloaded Payments Table
event.payment.id – This is the Order ID in downloaded Payments Table.
The docs say the Order ID could be associated with multiple payables so I’m guessing the Provider Payment ID is better to use, but the example in the Wix documentation here:
https://www.wix.com/velo/reference/wix-pay-backend/events/onpaymentupdate
uses event.payment.id :
export function wixPay_onPaymentUpdate(event) {
5 let paymentId = event.payment.id;
6 let newTransactionStatus = event.status;
7}
Maybe it doesn’t matter which one I use.
The supported events don’t include the pending status, you only receive a few events that are all listed in the docs, one of which is the success event.
If you want to represent the payment to your clients/customers, you should use your own IDs, the payment ID is for your reference in case of refunds, chargebacks, etc, and the order ID is for your reference in the website, as you pass it to Wix Pay, other than that, your customers should see your own transaction ID.
I am disappointed that the payment and payout data are not available from velo code. I would like to create reports for the accountant/treasurer who deals with the bank statements. There is currently no way to show which payments are included in which payouts. The treasurer is not interested (and not technically saavy) to login to a Wix account to gather that information. But if I could present the data in a format that he likes on our website then it will be very useful. Is there any particular reason why the data visible in the dashboard is not allowed to be accessed using velo code?
1 Like