VivaPayments / API

Index of Viva Wallet open source projects on GitHub.
138 stars 163 forks source link

Inconsistency in statuses #2497

Closed viderspan closed 3 months ago

viderspan commented 4 months ago

Dear Support,

I would like to inquire about a case.

It happens that we receive several Webhook notifications in a row that the given transaction is unsuccessful.

This can be seen in the Webhook URL (URL parameter: method=failed) and in the response to the transaction status query (statusId=E). After a while, another Webhook arrives indicating the success of the transaction (URL parameter: method=success). The status of the queried transaction also changes (statusId=F).

This is a problem because we treated the transaction as unsuccessful in our system, but it later became successful.

My questions:

How can this happen? How can we be sure that a transaction has permanently failed? Which of the statusId values specified in the documentation can be considered final? (https://developer.vivawallet.com/integration-reference/response-codes/#statusid-parameter) How is it recommended to handle such cases? How can I cause this in a test environment?

Transaction logs:

2024-02-29 11:09:34 Webhook URL: /VivaWalletNotify?method=failed&merchantId=a724dbb1-c856-4c91-908c-977b65ce4e66

2024-02-29 11:09:34.531 Retrieve transaction response: Array ( [email] => billing@... [bankId] => NET_MASTER [amount] => 880 [switching] => [orderCode] => 4680529664810383 [statusId] => E [fullName] => COSTACHE IOANA BIANCA [insDate] => 2024-02-29T12:09:33.327+02:00 [cardNumber] => 527176XXXXXX1295 [currencyCode] => 946 [customerTrns] => Plata rezervării #13027302 [merchantTrns] => 7382559828184b8fc7977bca02ccf422 [transactionTypeId] => 5 [recurringSupport] => [totalInstallments] => 0 [cardCountryCode] => RO [cardIssuingBank] => Pluxee Romania Srl [currentInstallment] => 0 [cardUniqueReference] => 5CEC8521C320C4C9F6456E34FE20B861538243F3 [cardTypeId] => 1 [digitalWalletId] => )

2024-02-29 11:10:21 Webhook URL: /VivaWalletNotify?method=failed&merchantId=a724dbb1-c856-4c91-908c-977b65ce4e66

2024-02-29 11:10:21.593 Retrieve transaction response: Array ( [email] => billing@... [bankId] => NET_MASTER [amount] => 880 [switching] => [orderCode] => 4680529664810383 [statusId] => E [fullName] => COSTACHE IOANA BIANCA [insDate] => 2024-02-29T12:10:20.673+02:00 [cardNumber] => 527176XXXXXX1295 [currencyCode] => 946 [customerTrns] => Plata rezervării #13027302 [merchantTrns] => 7382559828184b8fc7977bca02ccf422 [transactionTypeId] => 5 [recurringSupport] => [totalInstallments] => 0 [cardCountryCode] => RO [cardIssuingBank] => Pluxee Romania Srl [currentInstallment] => 0 [cardUniqueReference] => 5CEC8521C320C4C9F6456E34FE20B861538243F3 [cardTypeId] => 1 [digitalWalletId] => )

2024-02-29 11:16:43 Webhook URL: /VivaWalletNotify?method=success&merchantId=a724dbb1-c856-4c91-908c-977b65ce4e66

2024-02-29 11:16:43.850 Retrieve transaction response: Array ( [email] => billing@... [bankId] => NET_MASTER [amount] => 880 [switching] => [orderCode] => 4680529664810383 [statusId] => F [fullName] => Costache Ioana Bianca [insDate] => 2024-02-29T12:16:42.433+02:00 [cardNumber] => 527176XXXXXX1295 [currencyCode] => 946 [customerTrns] => Plata rezervării #13027302 [merchantTrns] => 7382559828184b8fc7977bca02ccf422 [transactionTypeId] => 5 [recurringSupport] => [totalInstallments] => 0 [cardCountryCode] => RO [cardIssuingBank] => Pluxee Romania Srl [currentInstallment] => 0 [cardUniqueReference] => 5CEC8521C320C4C9F6456E34FE20B861538243F3 [cardTypeId] => 1 [digitalWalletId] => )

Thank you.

VivaWalletCustomerSupport commented 4 months ago

Hello @viderspan

Each order code remains active for half an hour, allowing your customers multiple attempts if the payment fails due to various reasons. In your case, your customer made two unsuccessful attempts followed by one successful transaction, all within the same order code. This resulted in two failed webhook notifications and one indicating the success of the transaction.

When you receive a webhook notification, before updating a transaction’s status on your system, you should always retrieve its details from Viva. Please use the transactionId in the payload and make a call to the [Retrieve Transaction] (https://developer.vivawallet.com/apis-for-payments/payment-api/#tag/Transactions-(Deprecated)/paths/~1api~1transactions~1{transaction_id}/get) API. Validate the orderCode, statusId and amount you received in the Retrieve Transaction API response and update your system accordingly

Thank you for your message.

Kind regards, Viva Wallet E-commerce Support Team

VivaWalletCustomerSupport commented 3 months ago

Hello @viderspan,

This ticket will close for now. Please don't hesitate to raise a new ticket if you need further assistance.

Kind regards, Viva Wallet E-commerce Support Team