activemerchant / active_merchant

Active Merchant is a simple payment abstraction library extracted from Shopify. The aim of the project is to feel natural to Ruby users and to abstract as many parts as possible away from the user to offer a consistent interface across all supported gateways.
http://activemerchant.org
MIT License
4.53k stars 2.5k forks source link

ISSUE with method ActiveMerchant::Billing::PaypalExpressGateway.cancel_recurring #4873

Closed nampt-3121 closed 8 months ago

nampt-3121 commented 1 year ago

Hello everyone, thank you for your helpful input. I'm currently facing an issue when attempting to cancel a recurring payment using PayPal. Previously, it worked perfectly fine, but in the past few days, when making a call to PayPal, it returns an error: Profile Id is missing from the request. The profile ID is invalid.

I've gone through debugging and noticed that the request being sent to PayPal is formatted as follows:

Endpoint: https://api-3t.sandbox.paypal.com/2.0/ Method: POST Body:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header>
    <RequesterCredentials xmlns="urn:ebay:api:PayPalAPI" xmlns:n1="urn:ebay:apis:eBLBaseComponents" env:mustUnderstand="0">
      <n1:Credentials>
        <n1:Username>Username</n1:Username>
        <n1:Password>Password</n1:Password>
        <n1:Subject/>
        <n1:Signature>Signature</n1:Signature>
      </n1:Credentials>
    </RequesterCredentials>
  </env:Header>
  <env:Body>
    <ManageRecurringPaymentsProfileStatusReq xmlns="urn:ebay:api:PayPalAPI">
      <ManageRecurringPaymentsProfileStatusRequest xmlns:n2="urn:ebay:apis:eBLBaseComponents">
        <n2:Version>124</n2:Version>
        <n2:ManageRecurringPaymentsProfileStatusRequestDetails>
          <ProfileID>I-XXXXXXX</ProfileID>
          <n2:Action>Cancel</n2:Action>
        </n2:ManageRecurringPaymentsProfileStatusRequestDetails>
      </ManageRecurringPaymentsProfileStatusRequest>
    </ManageRecurringPaymentsProfileStatusReq>
  </env:Body>
</env:Envelope>

Interestingly, changing <ProfileID>I-XXXXXXX</ProfileID> to <n2:ProfileID>I-XXXXXXX</n2:ProfileID>makes it work fine.

Could someone provide a more detailed explanation for this behavior? Also, regarding the recent days when this function stopped working, could it be due to a recent API update on PayPal's side? If so, how can we confirm that?

Thank you very much for your assistance.

peterbysh commented 11 months ago

Experiencing the exact same issue..

curiousepic commented 11 months ago

Marking this "of interest" before a cleanup of stale issues

github-actions[bot] commented 9 months ago

To provide a cleaner slate for the maintenance of the library, this PR/Issue is being labeled stale after 60 days without activity. It will be closed in 14 days unless you comment with an update regarding its applicability to the current build. Thank you!