Paypal prepayment using the built-in Light box

I work in the built-in adaptive prepaid payment, now the problem I am facing is how to implement the prepayment using the light bar.

I applied the paid actions by installing paykey using a light block that worked well, but the same thing that I followed with a slight modification of the code to request preliminary approval did not work so that the light box would hang. kindly let me know what i'm missing here.

HTML code:

<html> <head> <script src="https://www.paypalobjects.com/js/external/dg.js" type="text/javascript"></script> </head> <body> <form action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/preapprovalkey" target="PPDGFrame" class="standard"> <label for="buy">Buy Now:</label> <input type="image" id="submitBtn" value="Pay with PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif"> <input id="type" type="hidden" name="expType" value="light"> <input id="preapprovalkey" type="hidden" name="preapprovalkey" value="{{preapprovalkey}}"> </form> <script type="text/javascript" charset="utf-8"> var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' }); </script> </body> </html> 
+6
source share
1 answer

dg.js deprecated since PayPal is downloading the DG product, instead you must enable apdg.js and change the action url from pay to preapproval

 <html> <head> <title>AP Redirection Demo</title> <script src="https://www.paypalobjects.com/js/external/apdg.js" type="text/javascript"></script> </head> <body> <form action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/preapproval" target="PPDGFrame" class="standard"> <label for="buy">Pay Now:</label> <input type="image" id="submitBtn" value="Pay with PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif"> <input id="type" type="hidden" name="expType" value="light"> <input id="preapprovalkey" type="input" name="preapprovalkey" value="insert_preapproval_key"> </form> <script type="text/javascript" charset="utf-8"> var dgFlowMini = new PAYPAL.apps.DGFlowMini({ trigger: 'submitBtn' }); </script> </body> </html> 
0
source

Source: https://habr.com/ru/post/945128/


All Articles