# cfpayment PayPal Website Payments Pro Gateway

This page contains information on using and testing the two types of cfpayment gateways used with PayPal: Name-Value Pair and SOAP.

## Name-Value Pair API

The cfpayment core is created with gateway configuration options like so:

`config = structNew(); config.path = "paypal.wpp.NVPGateway"; config.username = "paypal_99999999_biz_api1.paypal.com"; config.password= "abc123xyz789"; config.signature= "AbcDEfgHiJKlMNoPQrstUvWXYz0123456789"; config.returnURL = "http://localhost/cfpayment/api/gateway/paypal/wpp/tests/NVPGatewayTest.cfc?method=runTestRemote&method=testCompleteExpressCheckout"; config.cancelURL = "http://localhost/cfpayment/api/gateway/paypal/wpp/tests/NVPGatewayTest.cfc?method=runTestRemote&method=testCancelExpressCheckout"; cfpayment = createObject("component", "cfpayment.api.core").init(config=config); gateway = cfpayment.getGateway();`

## SOAP API

The PayPal SOAP API support is a big `TODO` right now.

## Tests

The `NVPGatewayTest` MXUnit Test Case contains many individual tests, however it's best to call the two major test methods directly, as the Express Checkout process has a specific order. Before running the Express Checkout test, login to the PayPal Sandbox.

- NVPGatewayTest.testPurchase(): Test the PayPal Direct Payment functionality of the gateway
- NVPGatewayTest.testBeginExpressCheckout(): Test the PayPal Express Checkout process. The test call the PayPal server with the `SetExpressCheckout` command. It then forwards the browser to PayPal to authenticate and confirm payment details. The return URL is to the portion of the test class that: 1) gets customer details, and 2) completes the payment.