pronamic / wp-pronamic-pay

The Pronamic Pay plugin allows you to easily accept payments with payment methods like credit card, iDEAL, Bancontact and Sofort through a variety of payment providers on your WordPress website.
https://pronamicpay.com
35 stars 14 forks source link

MemberPress » Payment chargeback » Pronamic subscription on hold » Suspend (pause) MemberPress subscription #165

Closed remcotolsma closed 2 years ago

remcotolsma commented 3 years ago

In the event of a Mollie payment chargeback, we give the Pronamic Pay subscription the status on hold. This ensures that future direct debits do not continue.

https://github.com/wp-pay-gateways/mollie/blob/09c60fdfbab9eee85d58909da24c5b82d9ff51fe/src/Gateway.php#L734-L767

However, the MemberPress subscription remains active. Eventually the MemberPress subscription will expire, but it is probably clearer to suspend (pause) the MemberPress subscription directly in case of a chargeback.

For example, with an annual direct debit where a chargeback is made after 2 months, you do not want the customer to keep access for another 10 months.

MeprSubscriptionsCtrl->suspend_subscription() https://gitlab.com/pronamic/memberpress/-/blob/1.2.4/app/controllers/MeprSubscriptionsCtrl.php#L147-160

MeprSubscription->suspend() https://gitlab.com/pronamic/memberpress/-/blob/1.2.4/app/models/MeprSubscription.php#L1095-1107

MeprBaseGateway https://gitlab.com/pronamic/memberpress/-/blob/1.2.4/app/lib/MeprBaseGateway.php#L184-186

remcotolsma commented 3 years ago

🤔 Note: MemberPress members may have the option to pause and resume subscriptions themselves:

Allow Members to Pause & Resume their own subscriptions

Pausing & Resuming Subscriptions This option will only be available if this is enabled and the user purchased their subsciption using PayPal or Stripe.

https://gitlab.com/pronamic/memberpress/-/blob/1.2.4/app/views/admin/options/form.php#L158-168

What should happen if a chargeback results in a paused MemberPress subscription and the user clicks the 'Resume' link on his account page?

$pm->print_user_account_subscription_row_actions($s->ID); https://gitlab.com/pronamic/memberpress/-/blob/1.2.4/app/views/account/subscriptions.php#L98

MeprBaseGateway->print_user_account_subscription_row_actions($sub_id) https://gitlab.com/pronamic/memberpress/-/blob/1.2.4/app/lib/MeprBaseGateway.php#L332-340

remcotolsma commented 3 years ago

Note from customer:

Indien een gebruiker een chargeback aanvraagt, komt de webhook succesvol binnen bij Pronamic. Alleen wordt dit niet correct gekoppeld aan Memberpress. Deze abonnementen blijven namelijk nog actief. Hetzelfde geldt voor gebruikers die een mislukte betaling hebben met creditcard en iDeal. Momenteel los ik dingen nu deels handmatig op maar ik zou dit graag geautomatiseerd willen hebben.

Internal HelpScout ticket: https://secure.helpscout.net/conversation/1501257614/22011?folderId=1425720

@rvdsteege Might it be better to give the MemberPress transaction, that is linked to the Pronamic Pay payment that receives a chargeback, the status 'refunded'?

A chargeback is also a kind of refund?

What is the difference between a chargeback and a refund?

A chargeback is initiated by the card holder and can (but doesn't have to) result in a return of funds. It's the bank's duty to determine whether such a request was reasonable.

A refund is a payment operation initiated by the merchant, it refers to a specific card transaction and allows to return the whole or part of the transaction amount.

https://paylane.com/support/faq/credit-card-processing/what-is-the-difference-between-a-chargeback-and-a-refund/

rvdsteege commented 3 years ago

Might it be better to give the MemberPress transaction, that is linked to the Pronamic Pay payment that receives a chargeback, the status 'refunded'?

👍 However, we currently don't trigger an action when a chargeback for a payment occurs, so we would need to add 'some mechanism' to hook into the payment chargeback from the extension.

remcotolsma commented 3 years ago

Just like amountRefunded we also require a amountChargedBack?

https://github.com/mollie/mollie-api-php/blob/ff22d7725a739e17eaba0e58bb9efcb8dbed9b05/src/Resources/Payment.php#L46-L72

https://docs.mollie.com/reference/v2/payments-api/get-payment

The total amount that was charged back for this payment. Only available when the total charged back amount is not zero.

remcotolsma commented 3 years ago

Discussed at the office with @rvdsteege, question is whether we should add an extra property amountChargedBack to the payment. A good first step is to look at how other gateways deal with chargebacks, awaiting https://github.com/pronamic/wp-pronamic-pay/issues/170.

rvdsteege commented 2 years ago

From customer:

Je zou verwachten dat wanneer een betaling niet lukt om wat voor reden dan ook, het membership niet wordt verlengd. Maar dat lijkt dus niet het geval?

Internal Help Scout ticket: https://secure.helpscout.net/conversation/1891085653/23973/

@remcotolsma how can we improve on this? I think we need to add the amountChargedBack to a payment and then update the MemberPress transaction status to 'Refunded' based on this amount (pausing a MemberPress subscription still gives access).

rvdsteege commented 2 years ago

how can we improve on this?

Decided in https://github.com/pronamic/wp-pronamic-pay/issues/170#issuecomment-1137238535 to keep track of the chargeback amount of a payment. We can then update the MemberPress transaction to 'Refunded' based on this amount.