1

I have created virtual (subscription) type of products in Magento 2.2.5 CE.

And when I tried to purchase subscription type product( recurring payment type) PayPal returns three IPNs. I have used this as my reference Handling Recurring Payments (I know it is deprecated but we'll upgrade soon)

When I place an order with Paypal express, PayPal deducts two times the same amount. I think PayPal first treat my order as a simple sale order and then after creating a recurring profile and deduct recurring payment. I have concluded this because of following debugging logs and IPN messages


IPN message types

  • 'txn_type' = cart/(some times express_checkout)
  • 'txn_type' = recurring_payment_profile_created
  • 'txn_type' = recurring_payment

Logs

    [2019-01-31 07:24:01] main.DEBUG: array (
      'url' => 'https://api-3t.sandbox.paypal.com/nvp',
      'SetExpressCheckout' => 
      array (
        'PAYMENTACTION' => 'Sale',
        'AMT' => '49.99',
        'CURRENCYCODE' => 'USD',
        'RETURNURL' => 'https://recurring_products.com/paypal/express/return/',
        'CANCELURL' => 'https://recurring_products.com/paypal/express/cancel/',
        'INVNUM' => '1000049131',
        'SOLUTIONTYPE' => 'Mark',
        'NOSHIPPING' => 1,
        'GIROPAYCANCELURL' => 'https://recurring_products.com/paypal/express/cancel/',
        'GIROPAYSUCCESSURL' => 'https://recurring_products.com/checkout/onepage/success/',
        'BANKTXNPENDINGURL' => 'https://recurring_products.com/checkout/onepage/success/',
        'SHIPPINGAMT' => '0.00',
        'ITEMAMT' => '49.99',
        'TAXAMT' => '0.00',
        'L_NUMBER0' => NULL,
        'L_NAME0' => 'Monthly',
        'L_QTY0' => 1,
        'L_AMT0' => '49.99',
        'L_BILLINGTYPE0' => 'RecurringPayments',
        'L_PAYMENTREQUEST_0_ITEMCATEGORY0' => 'Digital',
        'L_BILLINGAGREEMENTDESCRIPTION0' => 'Monthly Subscription',
        'METHOD' => 'SetExpressCheckout',
        'VERSION' => '72.0',
        'USER' => '****',
        'PWD' => '****',
        'SIGNATURE' => '****',
        'BUTTONSOURCE' => 'Magento_Cart_Community',
      ),
      'response' => 
      array (
        'TOKEN' => 'EC-xxxxxxxxxxxxxxxxx',
        'TIMESTAMP' => '2019-01-31T07:24:01Z',
        'CORRELATIONID' => 'xxxxxxxxxxxx',
        'ACK' => 'Success',
        'VERSION' => '72.0',
        'BUILD' => '88888888',
      ),
    ) [] []
    [2019-01-31 07:24:36] main.DEBUG: array (
      'url' => 'https://api-3t.sandbox.paypal.com/nvp',
      'GetExpressCheckoutDetails' => 
      array (
        'TOKEN' => 'EC-xxxxxxxxxxxxxxxxx',
        'METHOD' => 'GetExpressCheckoutDetails',
        'VERSION' => '72.0',
        'USER' => '****',
        'PWD' => '****',
        'SIGNATURE' => '****',
        'BUTTONSOURCE' => 'Magento_Cart_Community',
      ),
      'response' => 
      array (
        'TOKEN' => 'EC-xxxxxxxxxxxxxxxxx',
        'BILLINGAGREEMENTACCEPTEDSTATUS' => '1',
        'CHECKOUTSTATUS' => 'PaymentActionNotInitiated',
        'TIMESTAMP' => '2019-01-31T07:24:36Z',
        'CORRELATIONID' => '633419f321d4a',
        'ACK' => 'Success',
        'VERSION' => '72.0',
        'BUILD' => '88888888',
        'EMAIL' => 'sample.user@example.com',
        'PAYERID' => 'zzzzzzzzzzzzzzz',
        'PAYERSTATUS' => 'verified',
        'FIRSTNAME' => 'test',
        'LASTNAME' => 'buyer',
        'COUNTRYCODE' => 'US',
        'ADDRESSSTATUS' => 'Confirmed',
        'CURRENCYCODE' => 'USD',
        'AMT' => '49.99',
        'ITEMAMT' => '49.99',
        'SHIPPINGAMT' => '0.00',
        'HANDLINGAMT' => '0.00',
        'TAXAMT' => '0.00',
        'INVNUM' => '1000049131',
        'NOTIFYURL' => 'http://recurring_products.com/paypal/ipn',
        'INSURANCEAMT' => '0.00',
        'SHIPDISCAMT' => '0.00',
        'INSURANCEOPTIONOFFERED' => 'false',
        'L_NAME0' => 'Monthly',
        'L_QTY0' => '1',
        'L_TAXAMT0' => '0.00',
        'L_AMT0' => '49.99',
        'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
        'PAYMENTREQUEST_0_AMT' => '49.99',
        'PAYMENTREQUEST_0_ITEMAMT' => '49.99',
        'PAYMENTREQUEST_0_SHIPPINGAMT' => '0.00',
        'PAYMENTREQUEST_0_HANDLINGAMT' => '0.00',
        'PAYMENTREQUEST_0_TAXAMT' => '0.00',
        'PAYMENTREQUEST_0_INVNUM' => '1000049131',
        'PAYMENTREQUEST_0_NOTIFYURL' => 'http://recurring_products.com/paypal/ipn',
        'PAYMENTREQUEST_0_INSURANCEAMT' => '0.00',
        'PAYMENTREQUEST_0_SHIPDISCAMT' => '0.00',
        'PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID' => 'business.paypal@example.com',
        'PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED' => 'false',
        'L_PAYMENTREQUEST_0_NAME0' => 'Monthly',
        'L_PAYMENTREQUEST_0_QTY0' => '1',
        'L_PAYMENTREQUEST_0_TAXAMT0' => '0.00',
        'L_PAYMENTREQUEST_0_AMT0' => '49.99',
        'PAYMENTREQUESTINFO_0_ERRORCODE' => '0',
      ),
    ) [] []
    [2019-01-31 07:24:38] main.DEBUG: array (
      'url' => 'https://api-3t.sandbox.paypal.com/nvp',
      'CreateRecurringPaymentsProfile' => 
      array (
        'TOKEN' => 'EC-xxxxxxxxxxxxxxxxx',
        'PROFILESTARTDATE' => '2019-01-30 23:24:36',
        'PROFILEREFERENCE' => '44-ddddddddddddddddddddddddddddddd',
        'DESC' => 'Monthly Subscription',
        'AUTOBILLAMT' => 'AddToNextBilling',
        'BILLINGPERIOD' => 'Month',
        'BILLINGFREQUENCY' => '1',
        'AMT' => '49.99',
        'CURRENCYCODE' => 'USD',
        'METHOD' => 'CreateRecurringPaymentsProfile',
        'VERSION' => '72.0',
        'USER' => '****',
        'PWD' => '****',
        'SIGNATURE' => '****',
        'BUTTONSOURCE' => 'Magento_Cart_Community',
      ),
      'response' => 
      array (
        'PROFILEID' => 'I-WWWWWWWW',
        'PROFILESTATUS' => 'ActiveProfile',
        'TIMESTAMP' => '2019-01-31T07:24:38Z',
        'CORRELATIONID' => '666666666666',
        'ACK' => 'Success',
        'VERSION' => '72.0',
        'BUILD' => '44444444',
      ),
    ) [] []
    [2019-01-31 07:24:41] main.DEBUG: array (
      'url' => 'https://api-3t.sandbox.paypal.com/nvp',
      'DoExpressCheckoutPayment' => 
      array (
        'TOKEN' => 'EC-xxxxxxxxxxxxxxxxx',
        'PAYERID' => 'zzzzzzzzzzzzzzz',
        'PAYMENTACTION' => 'Sale',
        'AMT' => '49.99',
        'CURRENCYCODE' => 'USD',
        'BUTTONSOURCE' => 'Magento_Cart_Community',
        'NOTIFYURL' => 'https://recurring_products.com/paypal/ipn/',
        'RETURNFMFDETAILS' => 1,
        'SHIPPINGAMT' => '0.00',
        'ITEMAMT' => '49.99',
        'TAXAMT' => '0.00',
        'L_NUMBER0' => NULL,
        'L_NAME0' => 'Monthly',
        'L_QTY0' => 1,
        'L_AMT0' => '49.99',
        'BUSINESS' => NULL,
        'EMAIL' => 'sample.user@example.com',
        'FIRSTNAME' => 'test',
        'LASTNAME' => 'buyer',
        'MIDDLENAME' => NULL,
        'SALUTATION' => NULL,
        'SUFFIX' => NULL,
        'COUNTRYCODE' => 'US',
        'STATE' => NULL,
        'CITY' => NULL,
        'STREET' => '',
        'ZIP' => NULL,
        'PHONENUM' => NULL,
        'ADDROVERRIDE' => 1,
        'METHOD' => 'DoExpressCheckoutPayment',
        'VERSION' => '72.0',
        'USER' => '****',
        'PWD' => '****',
        'SIGNATURE' => '****',
      ),
      'response' => 
      array (
        'TOKEN' => 'EC-xxxxxxxxxxxxxxxxx',
        'SUCCESSPAGEREDIRECTREQUESTED' => 'false',
        'TIMESTAMP' => '2019-01-31T07:24:41Z',
        'CORRELATIONID' => '5555555555555',
        'ACK' => 'Success',
        'VERSION' => '72.0',
        'BUILD' => '88888888',
        'TRANSACTIONID' => '00000000000000000',
        'TRANSACTIONTYPE' => 'cart',
        'PAYMENTTYPE' => 'instant',
        'ORDERTIME' => '2019-01-31T07:24:41Z',
        'AMT' => '49.99',
        'FEEAMT' => '1.75',
        'TAXAMT' => '0.00',
        'CURRENCYCODE' => 'USD',
        'PAYMENTSTATUS' => 'Completed',
        'PENDINGREASON' => 'None',
        'REASONCODE' => 'None',
        'PROTECTIONELIGIBILITY' => 'Eligible',
        'INSURANCEOPTIONSELECTED' => 'false',
        'SHIPPINGOPTIONISDEFAULT' => 'false',
        'PAYMENTINFO_0_TRANSACTIONID' => '00000000000000000',
        'PAYMENTINFO_0_TRANSACTIONTYPE' => 'cart',
        'PAYMENTINFO_0_PAYMENTTYPE' => 'instant',
        'PAYMENTINFO_0_ORDERTIME' => '2019-01-31T07:24:41Z',
        'PAYMENTINFO_0_AMT' => '49.99',
        'PAYMENTINFO_0_FEEAMT' => '1.75',
        'PAYMENTINFO_0_TAXAMT' => '0.00',
        'PAYMENTINFO_0_CURRENCYCODE' => 'USD',
        'PAYMENTINFO_0_PAYMENTSTATUS' => 'Completed',
        'PAYMENTINFO_0_PENDINGREASON' => 'None',
        'PAYMENTINFO_0_REASONCODE' => 'None',
        'PAYMENTINFO_0_PROTECTIONELIGIBILITY' => 'Eligible',
        'PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE' => 'ItemNotReceivedEligible,UnauthorizedPaymentEligible',
        'PAYMENTINFO_0_SELLERPAYPALACCOUNTID' => 'business.paypal@example.com',
        'PAYMENTINFO_0_SECUREMERCHANTACCOUNTID' => '2222222222222',
        'PAYMENTINFO_0_ERRORCODE' => '0',
        'PAYMENTINFO_0_ACK' => 'Success',
      ),
    ) [] []

Update

I have checked in Paypal also there is dual payment received. Paypal summery page reference screen shot

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.