Closed remcotolsma closed 2 years ago
I prefer adding the payment ID to the webhook URL (doesn't hurt anyone) and then take some time in the (near) future to completely move to custom tables.
Added in https://github.com/wp-pay-gateways/mollie/commit/62714ce56746c912762eee87468ea39891b74971, @rvdsteege can you do a review?
http --form POST http://pay.local/wp-json/pronamic-pay/mollie/v1/webhook id=tr_7UhSN1zuXS
http --form POST http://pay.local/wp-json/pronamic-pay/mollie/v1/webhook/1 id=tr_7UhSN1zuXS
Working as expected, LGTM 👍
If the
wp_postmeta
table contains3.000.000+
items thewp-json/pronamic-pay/mollie/v1/webhook
REST API endpoint is very slow, we had a call from Mollie about this issue. The webhook is slow because thewp_postmeta
table has to be queried to find the payment ID based on the Mollie transaction ID (for example:tr_7UhSN1zuXS
). To solve this we had the idea to use theas_enqueue_async_action()
function from the https://actionscheduler.org/ library. On second thought that's probably not the best solution. Perhaps the easiest for now is to add the payment ID to the webhook URL:wp-json/pronamic-pay/mollie/v1/webhook/123
https://github.com/wp-pay-gateways/mollie/blob/a65e919f6228483c5672be6bdfdb3ae64342975f/src/Gateway.php#L233-L263
Another solution is to introduce custom tables with on index on the payment provider transaction ID field.
@rvdsteege What do you think about the
wp-json/pronamic-pay/mollie/v1/webhook/(?P<payment_id>\d+)
approach?