Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayPal Express Transaction ID wrong on recurring orders. #1077

Closed
3 tasks done
andrewlimaza opened this issue Sep 3, 2019 · 5 comments
Closed
3 tasks done

PayPal Express Transaction ID wrong on recurring orders. #1077

andrewlimaza opened this issue Sep 3, 2019 · 5 comments

Comments

@andrewlimaza
Copy link
Contributor

Describe the bug
When a recurring membership level's order is created, the transaction_id value is set to the subscription_id.

This only happens on recurring membership orders with PayPal Express.

To Reproduce
Steps to reproduce the behavior:

  1. Create a recurring membership level.
  2. Checkout for this level using PayPal Express.
  3. Navigate to the recently created order and notice that the transaction_id is the same as the subscription_id.

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only Paid Memberships Pro plugin is active.
  • This bug happens with a default WordPress theme active, or Memberlite.
  • I can reproduce this bug consistently using the steps above.
@mircobabini
Copy link
Member

mircobabini commented Mar 6, 2021

Even if PayPal docs says that CreateRecurringPaymentsProfile Response Fields are:

  • PROFILEID
  • PROFILESTATUS
  • TRANSACTIONID

In fact this is not the case. Instead:

  • PROFILEID, always set
  • PROFILESTATUS, sometimes is missing. When missing, means error.
  • TRANSACTIONID, never set

So, at this moment, the only way to get the missing TRANSACTIONID would be:

  • collect the PROFILEID (I-xxxxxxx)
  • call the method $morder->Gateway->getRealPaymentTransactionId( $morder ) which was written exactly to recover the real TRANSACTIONID for order set with TRANSACTIONID=PROFILEID (all PayPal Express orders).

But, first of all, we must avoid to set as status=success orders on which initial payment failed. As proposed here and discussed in the linked issue.

@tictag
Copy link

tictag commented Mar 23, 2021

MODS ONLY Further information on this, including screenshots, are available in plus support ticket: https://www.paidmembershipspro.com/forums/topic/bugfix-paypal-express-transaction-v-subscription-ids-in-order

@mircobabini
Copy link
Member

Update: checking NVP PayPal official deprecated documentation...

Screenshot 2021-05-10 at 16 02 42

That line of the doc is buggy. The initial_payment_txn_id is always provided on new profile created message, while it's not passed on recurring payments.

This means that we can update the order transaction_id as soon as we receive the recurring_payment_profile_created ipn message.

To sum up:

  1. During checkout process, we can use $morder->Gateway->getRealPaymentTransactionId( $morder ) to get the only payment collected which is the initial payment and save the order using the correct payment id.
  2. As soon as we receive the ipn recurring_payment_profile_created ipn message, we can make sure the transaction_id was collected during the checkout or force it to update and throw a warning.

@sc0ttkclark sc0ttkclark added this to the Backlog milestone Jan 24, 2022
@mircobabini
Copy link
Member

Fixed by 67573a1: as soon as the real transaction_id comes, it's replaced.

@dparker1005
Copy link
Member

Closing as resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants