VivaPayments / API

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

First webhook claims successful payment then second webhook immediately says it is refunded #2486

Closed fmarchalemisys closed 5 months ago

fmarchalemisys commented 5 months ago

Hi,

We noticed that some payments, completed on the VW pos app, are refunded within a very short delay (typically between 500ms and 1s).

We first see a webhook announcing the payment is successful.

{
  "Url": "https://…",
  "EventData": {
    "Moto": false,
    "BinId": 3077,
    "Ucaf": null,
    "Email": null,
    "Phone": null,
    "BankId": "NET_BNCT",
    "Systemic": false,
    "Switching": false,
    "ParentId": null,
    "Amount": 3.2,
    "ChannelId": "09913a34-c7d2-4e99-a3a7-550f2063d3b1",
    "TerminalId": 16274634,
    "MerchantId": "51ad6…c37",
    "OrderCode": 4034108572274634,
    "ProductId": null,
    "StatusId": "F",
    "FullName": null,
    "ResellerId": null,
    "DualMessage": false,
    "InsDate": "2024-02-03T11:50:41.85",
    "TotalFee": 0,
    "CardToken": "9553…CD57",
    "CardNumber": "5…9",
    "TipAmount": 0,
    "SourceCode": "5991",
    "SourceName": "…",
    "Latitude": 50.0,
    "Longitude": 5.0,
    "CompanyName": "…",
    "TransactionId": "980254ae-5893-460d-8602-290e64258577",
    "CompanyTitle": "…",
    "PanEntryMode": "05",
    "ReferenceNumber": 214131,
    "ResponseCode": "000",
    "CurrencyCode": "978",
    "OrderCulture": "fr-FR",
    "MerchantTrns": "[PP4689967-bb58334aab]…",
    "CustomerTrns": null,
    "IsManualRefund": false,
    "TargetPersonId": null,
    "TargetWalletId": null,
    "AcquirerApproved": false,
    "LoyaltyTriggered": false,
    "TransactionTypeId": 5,
    "AuthorizationId": "43C4FA",
    "TotalInstallments": 0,
    "CardCountryCode": "BE",
    "CardIssuingBank": "Belfius Bank N.v. / Belfius Ba",
    "RedeemedAmount": 0,
    "ClearanceDate": null,
    "CurrentInstallment": 0,
    "Tags": [],
    "BillId": null,
    "ConnectedAccountId": null,
    "ResellerSourceCode": null,
    "ResellerSourceName": null,
    "MerchantCategoryCode": 5734,
    "ResellerCompanyName": null,
    "CardUniqueReference": "9…7",
    "ExternalTransactionId": null,
    "ResellerSourceAddress": null,
    "CardExpirationDate": "2028-11-30T00:00:00",
    "ServiceId": null,
    "RetrievalReferenceNumber": "403409214131",
    "AssignedMerchantUsers": [
      "b…b",
      "1…9",
      "5…4"
    ],
    "AssignedResellerUsers": [],
    "CardTypeId": 1,
    "ResponseEventId": null,
    "ElectronicCommerceIndicator": null,
    "OrderServiceId": 0,
    "DigitalWalletId": null
  },
  "Created": "2024-02-03T09:50:42.379686Z",
  "CorrelationId": "24-034-644A2828",
  "EventTypeId": 1796,
  "Delay": null,
  "MessageId": "41a8356f-b479-42e3-81c0-aaa230ac7b74",
  "RecipientId": "51ad619f-1845-4156-a411-bbcdb9465c37",
  "MessageTypeId": 512
}

Then a second webhook is received to inform that the payment has been refunded.

{
  "Url": "https://…",
  "EventData": {
    "Moto": false,
    "BinId": 3077,
    "Ucaf": null,
    "Email": null,
    "Phone": null,
    "BankId": "NET_BNCT",
    "Systemic": true,
    "Switching": false,
    "ParentId": "980254ae-5893-460d-8602-290e64258577",
    "Amount": -3.2,
    "ChannelId": "09913a34-c7d2-4e99-a3a7-550f2063d3b1",
    "TerminalId": 16274634,
    "MerchantId": "51ad6…c37",
    "OrderCode": 4034108572274634,
    "ProductId": null,
    "StatusId": "F",
    "FullName": null,
    "ResellerId": null,
    "DualMessage": false,
    "InsDate": "2024-02-03T11:50:42.797",
    "TotalFee": 0,
    "CardToken": "9553…CD57",
    "CardNumber": "5…9",
    "TipAmount": 0,
    "SourceCode": "5991",
    "SourceName": "…",
    "Latitude": null,
    "Longitude": null,
    "CompanyName": "…",
    "TransactionId": "fdd9a1b5-a8d9-411f-b7bc-2409175d5d46",
    "CompanyTitle": "…",
    "PanEntryMode": "81",
    "ReferenceNumber": 214157,
    "ResponseCode": "000",
    "CurrencyCode": "978",
    "OrderCulture": "fr-FR",
    "MerchantTrns": "[PP4689967-bb58334aab]…",
    "CustomerTrns": null,
    "IsManualRefund": false,
    "TargetPersonId": null,
    "TargetWalletId": null,
    "AcquirerApproved": false,
    "LoyaltyTriggered": false,
    "TransactionTypeId": 7,
    "AuthorizationId": "214157",
    "TotalInstallments": 0,
    "CardCountryCode": "BE",
    "CardIssuingBank": "Belfius Bank N.v. / Belfius Ba",
    "RedeemedAmount": 0,
    "ClearanceDate": null,
    "CurrentInstallment": 0,
    "Tags": [],
    "BillId": null,
    "ConnectedAccountId": null,
    "ResellerSourceCode": null,
    "ResellerSourceName": null,
    "MerchantCategoryCode": 5734,
    "ResellerCompanyName": null,
    "CardUniqueReference": "…",
    "ExternalTransactionId": null,
    "ResellerSourceAddress": null,
    "CardExpirationDate": "2028-11-30T00:00:00",
    "ServiceId": null,
    "RetrievalReferenceNumber": "403409214157",
    "AssignedMerchantUsers": [
      "b…b",
      "1…9",
      "5…4"
    ],
    "AssignedResellerUsers": [],
    "CardTypeId": 1,
    "ResponseEventId": null,
    "ElectronicCommerceIndicator": null,
    "OrderServiceId": 0,
    "DigitalWalletId": null
  },
  "Created": "2024-02-03T09:50:42.9681375Z",
  "CorrelationId": "24-034-DB7CA45B",
  "EventTypeId": 1797,
  "Delay": null,
  "MessageId": "e60274b6-e0ff-4884-809a-1cad00e3ed95",
  "RecipientId": "51ad619f-1845-4156-a411-bbcdb9465c37",
  "MessageTypeId": 512
}

We have observed 10 such refunds since October 1st to be compared with 2400+ successful payments.

Considering the flag "IsManualRefund": false, and the very short delay between the payement and the refund, can we rule out a manual action from the operator?

If not manually, why are the payments refunded?

VivaWalletCustomerSupport commented 5 months ago

Hello @fmarchalemisys,

Thank you for your message and apologies for the late response.

As we can observe the above transaction has been cancelled. In the rare event of this systemic transaction please note that is not user initiated, most commonly triggered by a reversal, this may be due to several factors, from poor connection to WiFi or data or a general weakness in the network that affected the operation of the terminal.

Kind regards, Viva Wallet E-commerce Support Team

fmarchalemisys commented 5 months ago

Hi @VivaWalletCustomerSupport ,

Thank you for your reply.

I'm in touch with one of your collaborator about this issue.

I'll summarize the current status in case some other reader is interested in the information.

In addition to the reasons you list, the transaction is also refunded when the user removes the bank card from the reader before the successful payment can be displayed on the screen of the terminal. As the user can't be notified about the success, for their safety, the payment is refunded.

Unfortunately, a successful payment webhook is sent before the refund! Therefore, we see a successful payment and then a refund. If the transaction reversal webhook is not configured or not received or not processed due to some other error, we deliver the good for which we never see the money :unamused:

I believe the successful webhook should not be sent until the transaction is known to be fully validated. Or, at least, you should display a big warning in the doc lest your customers loose money, as we do.

VivaWalletCustomerSupport commented 5 months ago

Hello @fmarchalemisys,

Thank you for your message. We would recommend contacting your sales rep. to inform about a possible solution regarding reversed payments. Regarding webhooks, we will review your request and possibly, it will be available in the future.

Kind regards, Viva Wallet E-commerce Support Team