M2P Coupons Applying to All Invoices Instead of First

First issue:
============
When enabling the Membership 2 Pro Coupon addon, recurring payments connected to PayPal get set to the value of the discounted amount and are not updated on all subsequent billing cycles. Coupons are only suppose to be for the first cycle's transaction, but all transactions are assuming the discounted amount. Reporting in M2P shows that the internal system expects to bill the full membership amount, but the data logged from the transaction shows that the discounted amount is actually being charged. This is confirmed through PayPal's logging.

The initial details of the recurring subscription details shows the proper data. The "Regular Amount" is 44.00 while the "Billed Amount" is 1.00. Then, on the next billing cycle, another invoice is generated showing only 44.00 as the "Billed Amount" and this amount is showed as paid. However, PayPal did not reflect this amount.

See screenshot: http://storage5.static.itmages.com/i/17/0914/h_1505373470_6299371_ef56032bcc.png

Looking deeper into the POST data from the transaction shows the discrepancy. The initial invoice is billed correctly. However, the subsequent invoice is actually being billed as the first invoice was.

Screenshots:
Initial Billing: http://storage6.static.itmages.com/i/17/0914/h_1505373718_1848450_09a0ee4649.png
Subsiquent Billing: http://storage2.static.itmages.com/i/17/0914/h_1505373621_8559732_adde8b5c3c.png

So, even though the subscription states, "You will pay $1.00 first time and then $44 each day." in fact, only the original invoiced amount is actually charged ($1.00), even though M2P reports that $44.00 was charged and paid.

Screenshot: http://storage9.static.itmages.com/i/17/0914/h_1505373982_3612167_890ec03acc.png

Second issue:
=============
I would *like* to be able to actually accomplish the above by design. I would like to be able to apply a couple to the full billing cycle of a subscription. So that a defined discount will apply to all subsequent payments. But, I would like this to be selectable between [1-time discount | Permanent Discount]. Also, I would like the reporting to reflect which type of discount is being applied.

    mediastead

    Hello James, thank you for looking into all of this.

    As it turns out, this is actually a continuation of a previous ticket I have open, so I am going to cross link them.

    In my previous ticket, there was a question of coupons and whether they are recurring for the life of the account. It is confirmed that coupons do in fact recur.

    So, in addition to coupons recurring, my tests reveal that invoices also recur.

    That being said, the work that has to be done is actually not on the PayPal side, but on the Membership 2 Pro side:

    Since both coupons and invoices are recurring, the verbiage throughout the membership website and back end has to be changed. Currently, on the checkout page it is saying that coupons are applied to the first month and then the price goes back up to the set membership price after that.

    Also, all of the invoices for the subscriber are showing the same thing ... after the first bill, each recurring payment after that is showing as the set membership price even though in PayPal it is charging the original coupon/invoice price.

    And lastly, in the admin back end, all of the records in the billing section, as well as where you go to see payments of each individual member are reflecting the same thing ... PayPal is charging the price of the discount after the coupon, and/or the price you set in the invoice, but all of these records are showing that the member is paying full prices after each recurring payment.

    The only place in the back end that the record is showing correctly is:
    Membership 2 > All Members > (click blue icon next to member) > (click the link under the payments column) > (click "show transaction" under an invoice showing the full price) .... Under this page, you will see the time of the transactions, the gateway used, and the amount paid, which is the discounted coupon/invoice amount.

    Here is the original (albeit incomplete) ticket ... now that the dots are connected, hopefully it is easier to see the big picture.

    PLEASE NOTE:
    I love that coupons and invoices recur. Please keep this the way it is, and just fix the way the information is reflected in the website.

    In the future, you may decide to give people the option of choosing whether something recurs, or whether it is a one time thing, but for now I am requesting that recurring be the default.

    Thanks so much!

    https://premium.wpmudev.org/forums/topic/recurring-couponsdiscount-for-membership-2-pro/

    Dimitris

    Hello there!

    As confirmed and stated in this other thread here

    https://premium.wpmudev.org/forums/topic/recurring-couponsdiscount-for-membership-2-pro#post-1276808

    coupon discounts are being applied in all recurring payments in PayPal end, there're multiple places in M2PRO plugin though, that normal prices are being shown instead, like in the checkout screen in frontend, or in invoices in wp-admin area.

    We're waiting for a resolution on this from our devs, me or another colleague of mine will keep you posted here as soon as we've got some valuable insights!

    Take care,
    Dimitris

    Ivan

    Hi mediastead !

    For quick changing texts on front end I added /public_html/wp-content/mu-plugins/wpmu_membership_changings.php MU plugin to your site with the following code

    <?php
    function wpmu_membership_changings( $desc, $short, $currency, $total_price, $membership, $invoice ) {
    	if ( 1 != $membership->pay_cycle_repetitions && isset( $_POST['apply_coupon_code'] ) && ! empty( $_POST['coupon_code'] ) && ! empty( $_REQUEST['membership_id'] ) ) {
    		$start = strpos( $desc, "first time" );
    		if ( $start ) {
    			$end = strpos( $desc, "(each" );
    			if ( !$end ) {
    				$end = strpos( $desc, "each" );
    			}
    			if ( $end ) {
    				$desc = substr( $desc, 0, $start ) . substr( $desc, $end ) ;
    			}
    		} else {
    			$start = strpos( $desc, "First payment" );
    			if ( 0 === $start ) {
    				$desc = sprintf(
    						'You will make %4$s payments of <span class="price">%1$s %2$s</span>, one each %3$s.',
    						$currency,
    						$total_price,
    						MS_Helper_Period::get_period_desc( $membership->pay_cycle_period ),
    						$membership->pay_cycle_repetitions
    						);
    			}
    		}
    	}
    
    	return $desc;
    }
    
    add_filter( 'ms_model_relationship_get_payment_description/recurring', 'wpmu_membership_changings', 11, 6  );

    Also, I'll ping our developer to fix and to implement your suggestion to the plugin.

    Best regards,
    Ivan.