Online Book Reader

Home Category

PayPal APIs_ Up and Running_ A Developer's Guide - Michael Balderas [30]

By Root 170 0
values are:

Success: The operation completed successfully.

Failure: The operation failed.

Warning: Warning.

SuccessWithWarning: The operation completed successfully, but there is a warning message.

FailureWithWarning: The operation failed with a warning message.

build The build number; used only by Developer Technical Support.

correlationId The correlation ID; used only by Developer Technical Support.

timestamp The date on which the response was sent. The time currently is not supported.

ExecutePayment API Operation


The ExecutePayment API operation allows you to execute a payment setup with the Pay API operation using the actionType CREATE. The request is comprised of two fields, outlined in Table 4-13.

Table 4-13. ExecutePayment request fields

Field Description

payKey The pay key that identifies the payment to be executed. This is the pay key returned in the PayResponse message.

requestEnvelope Information common to each API operation, such as the language in which an error message is returned.

Additionally, requestEnvelope contains two subfields, outlined in Table 4-14.

Table 4-14. requestEnvelope fields

Field Description

detailLevel The level of detail required by the client application for components such as Item and Transaction. One possible value is ReturnAll , which provides the maximum level of detail (default).

errorLanguage The RFC 3066 language in which error messages are returned (required). By default, it is en_US, which is the only language currently supported.

ExecutePayment returns several elements in its response, outlined in Table 4-15.

Table 4-15. ExecutePayment response fields

Field Description

payErrorList Information about why a payment failed.

paymentExecStatus The status of the payment. Possible values are:

CREATED: The payment request was received, and funds will be transferred once the payment is approved.

COMPLETED: The payment was successful.

INCOMPLETE: Some transfers succeeded and some failed for a parallel payment.

ERROR: The payment failed, and either all attempted transfers failed or all completed transfers were successfully reversed.

REVERSALERROR: One or more transfers failed when attempting to reverse a payment.

responseEnvelope Common response information, including a timestamp and the response acknowledgment status.

Additional values and information related to the ExecutePayment response fields can be found in the online documentation located at http://www.x.com/community/ppx/documentation.

Adaptive Payments Integration


PayPal provides an Integration Wizard for Adaptive Payments as well. It can be found at https://www.paypal-labs.com/integrationwizard/adaptive/main.php. The wizard for Adaptive Payments contains only five steps.

The Integration Wizard starts by presenting an overview of the different types of payment methods you can implement via Adaptive Payments, as shown in Figure 4-9.

Step 1 asks you for your programming language and whether you are working with the sandbox or a live implementation (see Figure 4-10).

Step 2 allows you to download the paypalplatform.php code, shown in Example 4-1 (see Figure 4-11). This code contains all the core handlers for Adaptive Payments information. You will need to provide your API credentials in this file. For instructions on creating those credentials, refer to Creating an API Signature. Once you have completed your testing and are ready to go live, change $Env="sandbox" to $Env="live". This will change the endpoint to the live PayPal endpoint.

Figure 4-9. Adaptive Payments Integration Wizard overview

Step 3 generates the code to implement for your Preapproval Flow handler, shown in Example 4-2 (see Figure 4-12).

Step 4 generates the different payment type handlers for use in your code (see Figure 4-13). You will have an Implicit Payment handler (Example 4-3), a Basic Payment Handler (Example 4-4), a Parallel Payment Handler (Example 4-5), and a Chained Payment Handler (Example 4-6).

Step 5 completes the Integration

Return Main Page Previous Page Next Page

®Online Book Reader