cancel
Showing results for 
Search instead for 
Did you mean: 

Paypal deduct two times payment for subscription type of product

Highlighted
Contributor

Paypal deduct two times payment for subscription type of product

Paypal deduct two times payment for subscription type of product


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 refrence Handling Recurring Payments (https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECRecurringPayments/)


When I place order with Paypal express , paypal deduct two time the same amount. I think paypal first treat my order as simple sale order and then after create recurring profile and deduct recurring payment. I have conclude this because of following debugging logs and IPN messages

IPN messages

- 'txn_type' = **cart/(some times express_checkout)**
- 'txn_type' = **recurring_payment_profile_created**
- 'txn_type' = **recurring_payment**
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 ] https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECRecurringPayments/ [1] (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

[1]: https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECRecurringPayments/

--------------------
IPN message types
-------------------
> - 'txn_type' = **cart/(some times express_checkout)**
> - 'txn_type' = **recurring_payment_profile_created**
> - 'txn_type' = **recurring_payment**

---------------------------------------------------------
Logs
---------------------------------------------------------

<p[Removed. Phone #s not permitted]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',
),
) [] []
'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' => '<removed>',
'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@recurring_payment.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',
),
) [] []
'url' => 'https://api-3t.sandbox.paypal.com/nvp',
'CreateRecurringPaymentsProfile' =>
array (
'TOKEN' => 'EC-xxxxxxxxxxxxxxxxx',
'PROFILESTARTDATE' =&gt[Removed. Phone #s not permitted]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',
),
) [] []
'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@recurring_payment.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@recurring_payment.com',
'PAYMENTINFO_0_SECUREMERCHANTACCOUNTID' => '2222222222222',
'PAYMENTINFO_0_ERRORCODE' => '0',
'PAYMENTINFO_0_ACK' => 'Success',
),
) [] []