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
34 stars 14 forks source link

Add `cancel_return` URL parameter for PayPal transactions #267

Closed rvdsteege closed 2 years ago

rvdsteege commented 2 years ago

From internal Help Scout ticket (https://secure.helpscout.net/conversation/1657365126/22847):

Ik zie nu dat we binnen onze integratie geen "cancel_return" URL doorgeven aan PayPal waardoor PayPal dus geen "annuleren" link toont. Ik heb een snelle test gedaan en als we wel een "cancel_return" URL meegeven toont PayPal wel een annuleren link.

We can add the cancel_return URL parameter in Gateway.php, for example with:

/**
* Cancel return.
*/
$variables->set_value( 'cancel_return', \urlencode( $payment->get_return_url() ) );

However, this way the payment will not actually be canceled. Therefore, this needs some additional implementation steps.

remcotolsma commented 2 years ago

@rvdsteege What about https://github.com/wp-pay-gateways/paypal/commit/56852cc9d54d20b38f13cecc4fbcde0bd09f9842? Or too much REST API abuse?

rvdsteege commented 2 years ago

Maybe not the REST API as intended, but the URL structure and permission check are nice advantages. I'm fine with the JSON response if the hash or payment ID are incorrect. Under normal circumstances, users won't ever get these results.