PayPal Adaptive Payments - 2012 Uživatelská příručka Strana 58

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 298
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 57
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.
Zobrazit stránku 57
1 2 ... 53 54 55 56 57 58 59 60 61 62 63 ... 297 298

Komentáře k této Příručce

Žádné komentáře