PayPal APIs_ Up and Running_ A Developer's Guide - Michael Balderas [29]
https://www.paypal.com/webscr?cmd=_ap-payment&paykey=value
If you are the API caller and you specify your email address in the senderEmail field, PayPal will implicitly approve the payment without redirecting to PayPal. You can also use a preapproval to execute the payment and avoid explicit approval. The required preapproval fields are outlined in Table 4-6.
Table 4-6. Preapproval fields
Field Description
preapprovalKey Preapproval key for the approval set up between you and the sender
pin Sender’s personal identification number, if one was specified when the approval agreement was created
SetPaymentOptions API Operation
The SetPaymentOptions API is used to specify settings for a payment of the actionType CREATE. SetPaymentOptions has four different request fields, outlined in Table 4-7.
Table 4-7. SetPaymentOptionsRequest fields
Field Descriptions
displayOptions The container used to specify which images should be used when emailing customers.
initiatingEntity The PayPal financial partner initiating the payment. These must be set up via the Admin tool prior to using the PayPal APIs.
payKey This field identifies the payment for which you wish to set up payment options. This is the key that is returned in the PayResponse message.
requestEnvelope This is required information common to each API operation. This would include things such as the language in which error messages are displayed.
Next, we look at the different request fields and their additional values.
displayOptions
displayOptions has two optional fields that you can specify, outlined in Table 4-8.
Table 4-8. displayOptions fields
Field Description
emailHeaderImageUrl The URL that points to the location of the image used in the header of customer emails. The image dimensions are 43 pixels high x 240 pixels wide.
emailMarketingImageUrl The URL that points to the location of the marketing image used in customer emails. The image dimensions are 80 pixels high x 530 pixels wide.
initiatingEntity
initiatingEntity has only one optional field, outlined in Table 4-9.
Table 4-9. initiatingEntity field
Field Description
institutionCustomer Details about the party that initiated this payment. This payment is made by the API caller on behalf of the initiating party. The initiating party can be an institution or a customer of that institution. The initiating party must be set up by PayPal Merchant Services.
institutionCustomer has the additional fields outlined in Table 4-10.
Table 4-10. institutionCustomer fields
Field Description
countryCode The two-character country code of the end user’s home country (required)
displayName The full name of the consumer as known by the institution (required)
email The email address of the consumer as known by the institution
firstName The first name of the consumer as known by the institution (required)
institutionCustomerId The unique identifier assigned to the consumer by the institution (required)
institutionId The unique identifier assigned to the institution (required)
lastName The last name of the consumer as known by the institution (required)
requestEnvelope
requestEnvelope has two fields, outlined in Table 4-11.
Table 4-11. 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.
ResponseEnvelope
Once you execute your SetPaymentOptions request, you will receive a ResponseEnvelope that contains information about the success or failure of the SetPaymentOptions request. The response fields are outlined in Table 4-12.
Table 4-12. SetPaymentOptions response fields
Field Description
ack The acknowledgment code. Possible