<commit_before># Get it started.

Read [payum's core get it started documentation](https://github.com/Payum/Core/blob/master/Resources/docs/get-it-started.md).
Paypal express checkout was used as example there.

Back to [index](index.md).
<commit_msg>[doc] do better get it started. cleanup, simplify.<commit_after># Get it started. Paypal ExpressCheckout.

In this chapter we are going to talk about [Paypal ExpressCheckout](https://www.paypal.com/webapps/mpp/express-checkout) integration.
We assume you already read [Payum's get it started documentation](https://github.com/Payum/Payum/blob/master/docs/get-it-started.md).
Here we just extend it and describe Paypal specific details.

_**Note**: If you are working with symfony2 framework look at the bundle [documentation instead](https://github.com/Payum/PayumBundle/blob/master/Resources/doc/index.md)._

## Installation

The preferred way to install the library is using [composer](http://getcomposer.org/).
Run composer require to add dependencies to _composer.json_:

```bash
php composer.phar require "payum/paypal-express-checkout-nvp:*@stable"
```

## Configuration

First we have modify `config.php` a bit.
We need to add payment factory and payment details storage.


```php
<?php

use Buzz\Client\Curl;
use Payum\Paypal\ExpressCheckout\Nvp\PaymentFactory as PaypalExpressPaymentFactory;
use Payum\Paypal\ExpressCheckout\Nvp\Api;

$payments['paypal_es'] = PaypalExpressPaymentFactory::create(new Api(new Curl, array(
   'username'  => 'change it',
   'password'  => '<PASSWORD>',
   'signature' => 'change it',
   'sandbox'   => true,
)));
```

## Prepare payment

```php
<?php
// prepare.php

include 'config.php';

$storage = $registry->getStorage($detailsClass);

$paymentDetails = $storage->createModel();
$paymentDetails['PAYMENTREQUEST_0_CURRENCYCODE'] = 'EUR';
$paymentDetails['PAYMENTREQUEST_0_AMT'] = 1.23;
$storage->updateModel($paymentDetails);

$captureToken = $tokenFactory->createCaptureToken('paypal_es', $paymentDetails, 'done.php');

header("Location: ".$captureToken->getTargetUrl());
```

That's it. As you see we configured Paypal ExpressCheckout `config.php` and set details `prepare.php`.
[`capture.php`](https://github.com/Payum/Payum/blob/master/src/Payum/Core/Resources/docs/capture-script.md) and [`done.php`](https://github.com/Payum/Payum/blob/master/src/Payum/Core/Resources/docs/done-script.md) scripts remain same.

Back to [index](index.md).

{'fraction_non_alphanumeric': 0.1431501230516817, 'fraction_numerical': 0.002461033634126333, 'mean_word_length': 5.384816753926701, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 13, 'https://': 6, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '103531', 'n_tokens_mistral': 783, 'n_tokens_neox': 763, 'n_words': 193}