Table of Contents Previous Next Index

Charging a Credit Card Using DoDirectPayment

Charging a Credit Card Using DoDirectPayment
Use DoDirectPayment to charge a credit card or to authorize a credit card for later capture. Always include the following parameters with DoDirectPayment:
l
l
l
l
l
l
l
l
On success, the DoDirectPayment response returns the Address Verification System (AVS) code, a PayPal transaction ID, and the amount charged.
Final Sale
To charge a credit card for a final sale, include the PAYMENTACTION=Sale field.
[requiredSecurityParameters]&METHOD=DoDirectPayment&CREDITCARDTYPE=VISA
&ACCT=4683075410516684&EXPDATE=012007&CVV2=808&AMT=212.95
&FIRSTNAME=Designer&LASTNAME=Fotos&IPADDRESS=255.55.167.002
&STREET=1234+Easy+Street&CITY=San+Jose&STATE=CA&COUNTRY=United+States
&ZIP=95110&COUNTRYCODE=US&PAYMENTACTION=Sale
Table 2.2
[successResponseFields]&AVSCODE=X&TRANSACTIONID=9CX07910UV614511L&AMT=212.95
Authorizing a Payment
To authorize a credit card for later capture, include the PAYMENTACTION=Authorization field.
[requiredSecurityParameters]&METHOD=DoDirectPayment&CREDITCARDTYPE=VISA
&ACCT=4683075410516684&EXPDATE=012007&CVV2=808&AMT=305.92
&FIRSTNAME=Designer&LASTNAME=Fotos&IPADDRESS=255.55.167.002
&STREET=1234+Easy+Street&CITY=San+Jose&STATE=CA&COUNTRY=United+States
&ZIP=95110&COUNTRYCODE=US&PAYMENTACTION=Authorization
Table 2.4
[successResponseFields]&AVSCODE=X&TRANSACTIONID=4EL6476506322203C&AMT=305.92
To capture the payment, use DoCapture. For details, see “Capturing, Authorizing, Voiding, and Reauthorizing”.
Recording the Final Shipping Address
To record a ship-to address for this charge, include the following fields
l
l
l
l
l
l
l
[requiredSecurityParameters]&METHOD=DoDirectPayment&CREDITCARDTYPE=VISA
&ACCT=4683075410516684&EXPDATE=012007&CVV2=808&AMT=212.95
&FIRSTNAME=Designer&LASTNAME=Fotos&IPADDRESS=255.55.167.002
&STREET=1234+Easy+Street&CITY=San+Jose&STATE=CA&COUNTRY=United+States
&ZIP=95110&COUNTRYCODE=US&PAYMENTACTION=Sale
&SHIPTONAME=Louise+P.+Flowerchild&SHIPTOSTREET=1234+Easy+Street
&SHIPTOSTREET2=Apt+22+bis&SHIPTOCITY=New+Orleans&SHIPTOSTATE=LA
&SHIPTOCOUNTRYCODE=US&SHIPTOPHONENUM=504-555-1212&SHIPTOZIP=70114
Table 2.6
[successResponseFields]&AVSCODE=X&TRANSACTIONID=0W099911J1541261D&AMT=212.95
Including Subtotals of Item Cost, Shipping, Handling, and Tax
If you want the PayPal user to see subtotals of item cost, shipping charges, handling charges, and sales tax, include the following parameters:
l
l
l
l
Note:
Be sure that the summed values of ITEMAMT, SHIPPINGAMT, HANDLINGAMT, and TAXAMT equal the value of AMT. You cannot include a zero amount for any of these fields, and you must set all of them.
Table 2.7
[requiredSecurityParameters]&METHOD=DoDirectPayment&CREDITCARDTYPE=VISA
&ACCT=4683075410516684&EXPDATE=012007&CVV2=808&AMT=127.87
&FIRSTNAME=Designer&LASTNAME=Fotos&IPADDRESS=255.55.167.002
&STREET=1234+Easy+Street&CITY=San+Jose&STATE=CA&COUNTRY=United+States
&ZIP=95110&COUNTRYCODE=US&PAYMENTACTION=Sale
&ITEMAMT=115.00&SHIPPINGAMT=7.02&HANDLINGAMT=1.00&TAXAMT=4.85
Table 2.8
[successResponseFields]&AVSCODE=X&TRANSACTIONID=79V13941UC416632T&AMT=127.87
Adding Line Item Details
If you want the PayPal user to see details about the items purchased with the credit card, include these parameters:
l
L_NAMEn: item name or description
l
L_NUMBERn: line item number
l
L_QTYn: item quantity
l
L_TAXAMTn: sales tax for the item
l
L_AMTn: cost of item
You can detail as many items as you want. Beginning with 0, append an index number to the field name and increment that index number by one for each item.
[requiredSecurityParameters]&METHOD=DoDirectPayment&CREDITCARDTYPE=VISA
&ACCT=4683075410516684&EXPDATE=012007&CVV2=808&AMT=127.87
&FIRSTNAME=Designer&LASTNAME=Fotos&IPADDRESS=255.55.167.002
&STREET=1234+Easy+Street&CITY=San+Jose&STATE=CA&COUNTRY=United+States
&ZIP=95110&COUNTRYCODE=US&PAYMENTACTION=Sale&L_DESC0=Cat+Nibbles
&L_NUMBER0=SKU+98099&L_QTY0=2&L_TAXAMT0=0.85&L_AMT0=8.00
L_DESC1=+Flea+Collar&L_NUMBER1=2&L_QTY1=1&L_TAXAMT1=1.10&
L_AMT1=17.00&ITEMAMT=37.00&TAXAMT=1.95
Table 2.10
[successResponseFields]&AVSCODE=X&TRANSACTIONID=3B288546P5019992D&AMT=127.87
If you specify L_AMTn, you must specify the ITEMAMT parameter. The values for L_AMTn and L_QTYn should add up to the ITEMAMT.
If you specify L_TAXAMTn, you must specify the TAXAMT parameter. The values for L_TAXAMTn and L_QTYn should add up to TAXAMT.
Here are examples of ITEMAMT and TAXAMT:
ITEMAMT = (L_AMT0 * L_QTY0) + (L_AMT1 * L_QTY1) + L_AMT2
TAXAMT = (L_TAXAMT0 * L_QTY0) + (L_TAXAMT1 * L_QTY1) + L_TAXAMT2
Note:
If the line item details do not add up to ITEMAMT or TAXAMT, the line item details are discarded, and the transaction is processed using the values of ITEMAMT or TAXAMT. The ACK value in the response is set to SuccessWithWarning.