
Adaptive Payments Developer Guide August 7, 2012 57
Introducing Adaptive Payments
Embedded Payments
Setting Up Web Pages to Invoke the Embedded Payment Flow Using a
Minibrowser
Use the JavaScript functions in
https://www.paypalobjects.com/js/external/apdg.js to set up and control the
embedded payment flow. This example shows how to initiate the embedded payment flow
after obtaining a payment key.
This example assumes that you obtain a payment key before initiating the flow and that the
key does not change or expire before the sender completes the flow.
To set up a web page to invoke the embedded payment flow:
1. Call the Pay API operation to obtain a valid pay key.
2. Create your form or button.
– You must include the pay key and redirect to
https://www.paypal.com/webapps/adaptivepayment/flow/pay.
– Optionally, include a preapproval key if you want to enable the selection of Preapproval
for future payments
–Set the expType parameter to mini to indicate your preference for the context in which
the PayPal payment flow is displayed.
<form action=
"https://www.paypal.com/webapps/adaptivepayment/flow/pay"
target="PPDGFrame">
<input id="type" type="hidden" name="expType" value="mini">
<input id="paykey" type="hidden" name="paykey" value="AP-..."> <input
id="preapprovalkey" type="hidden" name="preapprovalkey" value="PA-...">
<input type="submit" id="submitBtn" value="Pay with PayPal"> </form>
NOTE: To modify an existing application to use the embedded payment flow, change the
redirect from https://www.paypal.com/webscr?cmd=_ap-
payment&paykey=... to
https://www.paypal.com/webapps/adaptivepayment/flow/pay?
paykey=... after obtaining the pay key.
3. Include the PayPal JavaScript functions from apdg.js.
<script src="https://www.paypalobjects.com/js/external/apdg.js">
</script>
Komentarze do niniejszej Instrukcji