Closed remcotolsma closed 2 years ago
This issue is not completely new, we have the following internal Basecamp to-do open for this: "Abonnementen » Dubbele betalingen mogelijk bij dubbele cron". A possible solution is also to make more use of custom tables and to lock rows while starting up a follow-up payment.
We wrote 2 Mollie CLI commands to help cancel payments.
wp pronamic-pay mollie payments list --api_key=live_●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● --is_cancelable --format=ids`
wp pronamic-pay mollie payments cancel $( wp pronamic-pay mollie payments list --api_key=live_●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● --is_cancelable --format=ids ) --api_key=live_●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
Advantages Mollie Subscriptions API
Disadvantages Mollie Subscriptions API
Are there any real drawbacks?
Disadvantages Mollie Subscriptions API
Note that scheduling an event to occur within 10 minutes of an existing event with the same action hook will be ignored unless you pass unique
$args
values for each scheduled event.
https://developer.wordpress.org/reference/functions/wp_schedule_single_event/
The advantage of this may also be that if a follow-up payment cannot be started at the gateway, we can reschedule the single event. I'm not exactly sure what WordPress does with events that throw an exception. It might not be watertight yet, but this option might solve some issues.
@rvdsteege You mentioned that WooCommerce also schedules events for orders, i couldn't find this: https://github.com/woocommerce/woocommerce/search?q=wp_schedule_single_event.
You mentioned that WooCommerce also schedules events for orders, i couldn't find this.
It's here:
@rvdsteege made a overview of meta usage: https://docs.google.com/spreadsheets/d/1CJHnHcr9s8lkh4Fq9HQmlAThCK69eXiTC3UktyeQKYw/edit?usp=sharing
select p.ID, p.post_title, m.meta_key, m.meta_value from wp_posts as `p` left join wp_postmeta as `m` ON m.post_id = p.ID where p.post_type=‘pronamic_payment’ and m.meta_key LIKE ‘_pronamic%’ group by m.meta_key order by m.meta_key ASC
Key | In JSON | In post meta |
---|---|---|
_pronamic_payment_action_url |
:x: | :white_check_mark: |
_pronamic_payment_address |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_adyen_details_result |
:x: | :white_check_mark: |
_pronamic_payment_adyen_payment_response |
:x: | :white_check_mark: |
_pronamic_payment_adyen_sdk_version |
:x: | :white_check_mark: |
_pronamic_payment_amount |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_city |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_config_id |
:x: | :white_check_mark: |
_pronamic_payment_consumer_account_number |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_consumer_bic |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_consumer_iban |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_consumer_name |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_country |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_currency |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_customer_name |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_description |
:x: | :white_check_mark: |
_pronamic_payment_email |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_end_date |
:white_check_mark: (also through periods) | :white_check_mark: |
_pronamic_payment_entrance_code |
:x: | :white_check_mark: |
_pronamic_payment_first_name |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_issuer |
:x: | :white_check_mark: |
_pronamic_payment_key |
:x: | :white_check_mark: |
_pronamic_payment_language |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_last_name |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_locale |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_method |
:x: | :white_check_mark: |
_pronamic_payment_mollie_change_payment_state_url |
:x: | :white_check_mark: |
_pronamic_payment_mollie_customer_id |
:x: | :white_check_mark: |
_pronamic_payment_omnikassa_2_merchant_order_id |
:x: | :white_check_mark: |
_pronamic_payment_order_id |
:x: | :white_check_mark: |
_pronamic_payment_recurring |
:x: | :white_check_mark: |
_pronamic_payment_recurring_type |
:x: | :white_check_mark: |
_pronamic_payment_source |
:x: | :white_check_mark: |
_pronamic_payment_source_id |
:x: | :white_check_mark: |
_pronamic_payment_start_date |
:white_check_mark: (also through periods) | :white_check_mark: |
_pronamic_payment_status |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_subscription_id |
:white_check_mark: through periods | :white_check_mark: |
_pronamic_payment_telephone_number |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_transaction_id |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_user_agent |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_user_ip |
:white_check_mark: | :white_check_mark: |
_pronamic_payment_version |
:x: | :white_check_mark: |
_pronamic_payment_woocommerce_payment_method |
:x: | :white_check_mark: |
_pronamic_payment_woocommerce_payment_method_title |
:x: | :white_check_mark: |
_pronamic_payment_zip |
:white_check_mark: | :white_check_mark: |
select p.ID, p.post_title, m.meta_key, m.meta_value from wp_posts as `p` left join wp_postmeta as `m` ON m.post_id = p.ID where p.post_type=‘pronamic_pay_subscr’ and m.meta_key LIKE ‘_pronamic%’ group by m.meta_key order by m.meta_key ASC
Key | In JSON | In post meta |
---|---|---|
_pronamic_subscription_amount |
:white_check_mark: through fases | :white_check_mark: |
_pronamic_subscription_config_id |
:x: | :white_check_mark: |
_pronamic_subscription_currency |
:white_check_mark: through fases | :white_check_mark: |
_pronamic_subscription_customer_name |
:white_check_mark: | :white_check_mark: |
_pronamic_subscription_description |
:x: | :white_check_mark: |
_pronamic_subscription_email |
:white_check_mark: | :white_check_mark: |
_pronamic_subscription_end_date |
:white_check_mark: | :white_check_mark: |
_pronamic_subscription_expiry_date |
:white_check_mark: | :white_check_mark: |
_pronamic_subscription_key |
:x: | :white_check_mark: |
_pronamic_subscription_mollie_customer_id |
:x: | :white_check_mark: |
_pronamic_subscription_mollie_mandate_id |
:x: | :white_check_mark: |
_pronamic_subscription_next_payment |
:white_check_mark: | :white_check_mark: |
_pronamic_subscription_next_payment_delivery_date |
:white_check_mark: | :white_check_mark: |
_pronamic_subscription_payment_method |
:x: | :white_check_mark: |
_pronamic_subscription_source |
:x: | :white_check_mark: |
_pronamic_subscription_source_id |
:x: | :white_check_mark: |
_pronamic_subscription_start_date |
:white_check_mark: through fases | :white_check_mark: |
_pronamic_subscription_status |
:white_check_mark: | :white_check_mark: |
I think we can remove the following issues from the Subscriptions follow-up payments improvement project:
We still have a few open issues in the Subscriptions follow-up payments improvement project, but we have already implemented the solution for this issue, so I'm closing this ticket.
We have a customer with many payments and subscriptions where the start-up of the follow-up payments is not going well. At first, the slow server/database seemed to be causing problems, but adding a temporary index on the
wp_postmeta.meta_value
may have played a role as well. However, this issue may be a signal that not all WordPress installations are stable enough to initiate subscription follow-up payments. I don't think it's the first time that this doesn't run as smoothly as we'd like. The WordPress cron doesn't always seem to work well for this. The big question is how are we going to fix/improve this? Is it better to use the Mollie Subscriptions API?Internal HelpScout ticket: https://secure.helpscout.net/conversation/1637278281/22756?folderId=1425710