mollie / mollie-api-php

Mollie API client for PHP

Home Page:http://www.mollie.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow logging of automatic retries to earlier detect double payments

lode opened this issue · comments

Specifications

  • API Version: v2.50.0

Describe the issue

We had an issue with a double payment on Mollie side for only a single call we made to payments->create(). This is similar to #642. I'm also in contact with support, that'll be okay.

We have quote okay logging on our side which is why I know I only called payments->create() once. But it would have been nice to know of this issue before our customer contacted us :) E.g. by knowing whether the request was retried.

It would be great if we can easily add a logger so we can detect (and log/alert on our end) if this happens, to allow faster investigation of whether double payments were made, or to allow to determine whether this was the issue in case of double payments.

Hi @lode,

Recently support was added for Mollie's idempotency features, so make sure to use the latest version.

Idempotency is enabled by default on this sdk, no action needed. Practically this means that multiple retries due to connection issues will not result in multiple transactions.

Regarding the logging: this sdk is not tied to a single http client or php framework and what people want to log differs from case to case. So I don't see a super convenient way to add this. It's possible however to inject your own http adapter into the MollieApiClient constructor and decorate it with some loggers to tailor it to your needs.

Alternatively, if you're using Guzzle, it's also possible to set a Guzzle middleware that logs the requests/responses for you.

I understand yes.

I will try idempotency (but would like to log anyway).

I dislike adding an own http middleware because of missing out on what you add to the default. But I also see it is tricky to only log this part and not something else.