Developer's Guide
Table Of Contents
- Adaptive Payments Developer Guide
- Contents
- What’s New?
- Introducing Adaptive Payments
- Adaptive Payments Actors and Objects
- Simple, Parallel, and Chained Payments
- Payment Approval
- Adaptive Payments Service Permissions
- Explicit Approval Payment Flow
- Preapproved Payments Flow
- Implicit Approval Payments Flow
- Embedded Payments
- Embedded Payment Flow Presentations
- Kinds of Embedded Payments
- Embedded Payments Implementation Basics
- Embedded Payment Experience
- Preapprove Future Payments Checkbox
- Shipping Address Information
- Embedded Payment Experience
- Setting Up Web Pages to Invoke the Embedded Payment Flow Using a Lightbox
- Setting Up Web Pages to Invoke the Embedded Payment Flow Using a Minibrowser
- Displaying and Collecting Shipping Addresses
- Guest Payments
- Fee Payment Configuration
- Getting Started
- Pay API Operation
- PaymentDetails API Operation
- ExecutePayment API Operation
- GetPaymentOptions API Operation
- SetPaymentOptions API Operation
- Preapproval API Operation
- PreapprovalDetails API Operation
- CancelPreapproval API Operation
- ConvertCurrency API Operation
- Refund API Operation
- GetFundingPlans API Operation
- GetShippingAddresses API Operation
- Adaptive Payment Commands and Redirects
- Instant Payment Notifications
- Older Versions of the Adaptive Payments API
- 1.8.0 Features
- 1.7.0 Features
- 1.6.0 Features
- New API Operations for Version 1.6.0
- Changes to PayRequest Fields for Version 1.6.0
- Changes to PayResponse Fields for Version 1.6.0
- Changes to ExecutePaymentRequest Fields for Version 1.6.0
- Changes to GetPaymentOptionsResponse Fields for Version 1.6.0
- Changes to SetPaymentOptionsRequest Fields for Version 1.6.0
- Changes to PreapprovalRequest Fields for Version 1.6.0
- Changes to Address Structure for Version 1.6.0
- Changes to DisplayOptions Structure for Version 1.6.0
- New CurrencyConversion Structure for Version 1.6.0
- New InvoiceData Structure for Version 1.6.0
- New InvoiceItem Structure for Version 1.6.0
- New SenderOptions Structure for Version 1.6.0
- New SenderIdentifier Structure for Version 1.6.0
- New AccountIdentifier Structure for Version 1.6.0
- New ReceiverOptions Structure for Version 1.6.0
- New ReceiverIdentifier Structure for Version 1.6.0
- Additional Error Messages for Version 1.6.0
- 1.5.0 Features
- 1.4.0 Features
- 1.3.0 Features
- 1.2.0 Features
- 1.1.0 Features
- Revision History
- Index
Introducing Adaptive Payments
Embedded Payments
58 August 7, 2012 Adaptive Payments Developer Guide
4. Create an embedded flow object and associate it with your payment form or button.
<script>
function <<returnFunctionName>>() {
<<Your code goes here.>>
}
</script>
After Completing This Task:
The following minibrowser return script can be used to determine whether the payment
successfully completed:
PAYMENTDETAILS=$(wget --no-check-certificate \
--output-document=- \
--quiet \
--header="X-PAYPAL-SERVICE-VERSION: 1.0.0" \
--header="X-PAYPAL-SECURITY-USERID: $APIUSER" \
--header="X-PAYPAL-SECURITY-PASSWORD: $APIPASS" \
--header="X-PAYPAL-SECURITY-SIGNATURE: $APISIG" \
--header="X-PAYPAL-REQUEST-DATA-FORMAT: NV" \
--header="X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \
--header="X-PAYPAL-APPLICATION-ID: $APPLICATIONID" \
--post-data="payKey=$PAYKEY&requestEnvelope.errorLanguage=en_US" \
https://www.paypal.com/AdaptivePayments/PaymentDetails)
if echo $PAYMENTDETAILS | grep -q "\&status=COMPLETED"
then echo "Thank you for approving pay key $PAYKEY"
else echo "Sorry, you were unable to approve pay key $PAYKEY. Please try
another transaction!"
fi
Displaying and Collecting Shipping Addresses
PayPal displays the default shipping address and allows the payment sender to change the
address when you set senderOptions.requireShippingAddressSelection to true
in your request to the SetPaymentOptions API operation. You call the
GetShippingAddresses API operation to obtain the selected shipping address after
invoking the embedded payment flow.
The steps in this example assume that you have implemented the JavaScript for invoking the
embedded payment flow, that you have set up your button or form to invoke the flow, and that
you have included the code to close the window associated with the flow.
To display and collect the selected shipping address
1. Call the Pay API operation with actionType set to CREATE to obtain a payment key.
2. Set senderOptions.requireShippingAddressSelection to true in your request
to SetPaymentOptions and call the API operation.