PayPal APIs_ Up and Running_ A Developer's Guide - Michael Balderas [24]
SHIPTOCOUNTRY The country code. Required if using a shipping address. Limited to two single-byte characters.
SHIPTOPHONENUM The phone number. Limited to 20 single-byte characters.
Table 3-2. DoDirectPayment response fields
Field Description
TRANSACTIONID The unique transaction ID of the payment. If the PaymentAction of the request was Authorization, the value of TransactionID is your AuthorizationID for use with the Authorization and Capture API.
AMT This value is the amount of the payment you specified in the DoDirectPayment request.
AVSCODE The Address Verification System response code. Limited to one single-byte alphanumeric character .
CVV2MATCH The results of the CVV2 check by PayPal.
L_FMFfilterID n The filter ID, including the filter type (PENDING, REPORT, or DENY), the filterID, and the entry number, n, starting from 0. filterID is one of the following values:
1 = AVS No Match
2 = AVS Partial Match
3 = AVS Unavailable/Unsupported
4 = Card Security Code (CSC) Mismatch
5 = Maximum Transaction Amount
6 = Unconfirmed Address
7 = Country Monitor
8 = Large Order Number
9 = Billing/Shipping Address Mismatch
10 = Risky ZIP Code
11 = Suspected Freight Forwarder Check
12 = Total Purchase Price Minimum
13 = IP Address Velocity
14 = Risky Email Address Domain Check
15 = Risky Bank Identification Number (BIN) Check
16 = Risky IP address Range
17 = PayPal Fraud Model
L_FMFfilterNAME n The filter name, including the filter type, (PENDING, REPORT, or DENY), the filterNAME, and the entry number, n, starting from 0 .
Simple Direct Payment Integration
To implement a Direct Payment transaction, you need to invoke the DoDirectPayment API and provide information to identify the buyer’s credit or debit card and the amount of the payment. Setting up the transaction is accomplished through the following steps:
Specify the amount of the transaction, including the currency if it is not in U.S. dollars. You should specify the total amount of the transaction if it is known; otherwise, specify the subtotal.
AMT=amount
CURRENCYCODE=currencyID
Specify the payment action. It is best practice to explicitly specify the payment action as one of the following values:
PAYMENTACTION=Sale
PAYMENTACTION=Authorization
Specify the IP address of the buyer’s computer:
IPADDRESS=xxx.xxx.xxx.xxx
Specify information about the card being used. You must specify the type of card as well as the account number:
CREDITCARDTYPE=Visa
ACCT=1234567891011123
The type of credit/debit card being used, the card issuer, and the Payment Receiving Preferences setting on your PayPal Profile might require that you set the following fields as well:
EXPDATE=012010
CVV2=123
Specify information about the card holder. You must provide the first and last name of the card holder, as well as the billing address associated with the card:
FIRSTNAME=John
LASTNAME=Doe
STREET=1313 Mockingbird Lane
CITY=Any town
STATE=Any state
ZIP=11111
COUNTRYCODE=US
Direct Payment Integrations
Direct Payment is probably the easiest component to integrate for NVP access. You can add DoDirectPayment functionality to your checkout processor by adding the code in Example 3-1 and providing your API credentials. For instructions on creating those credentials, refer to Creating an API Signature. Additionally, after you have completed testing and are ready to go live, change $environment = 'sandbox' to $environment='live'.
Example 3-1. dodirectpayment.php
/** DoDirectPayment NVP example; last modified 08MAY23.
*
* Process a credit card payment.
*/
$environment = 'sandbox'; // or 'beta-sandbox' or 'live'
/**
* Send HTTP POST Request
*
* @param string The API method name
* @param string The POST Message fields in &name=value pair