> For the complete documentation index, see [llms.txt](https://simpaypl.gitbook.io/simpay-laravel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simpaypl.gitbook.io/simpay-laravel/payments/transactions/generate-transaction.md).

# Generate transaction

```php
SimPay::payment()->generate()
    ->amount(15.00)
    // rest of fields are optional
    ->returns(
        new \SimPay\Laravel\Dto\ReturnData(
            'successUrl',
            'failedUrl',
        ),
    )
    ->billing(
        new \SimPay\Laravel\Dto\Payment\CustomerFullData(
            'First name',
            'Surname',
            'Street',
            'House number',
            'Flat',
            'City',
            'Region',
            'Post Code',
            'Country code',
            'Company',
        )
    )
    ->shipping(
        new \SimPay\Laravel\Dto\Payment\CustomerFullData(
            'First name',
            'Surname',
            'Street',
            'House number',
            'Flat',
            'City',
            'Region',
            'Post Code',
            'Country code',
            'Company',
        )
    )
    ->customer(
        new \SimPay\Laravel\Dto\Payment\CustomerData(
            'Name',
            'Email',
            'IP address',
            'Country Code (eg. PL, US, CY, GB)',
        )
    )
    ->antifraud(
        new \SimPay\Laravel\Dto\Payment\AntiFraudData(
            'UserAgent',
            'SteamID64',
            'Minecraft player username',
            'Minecraft player uuid',
            'systemID (mandatory for Recurrent Payments)',
        )
    )
    ->control('Control Data (for your integration, ex. your id from database)')
    ->description('Transaction Description')
    ->currency('Currency Code (default: PLN)')
    ->cart([
        new \SimPay\Laravel\Dto\Payment\CartItemData(
            name: 'Test product',
            quantity: 1,
            price: 5,
            procuder: 'Test producer',
            category: 'T-Shirts',
            code: 'TSHRT01' 
        ),
    ])
    ->referer('REFERRAL CODE')
    // one of
        ->directChannel('blik')
        // or
        ->channels(['blik', 'paysafecard', 'velo', 'blik-paylater', 'paypo'])
        // or
        ->channelTypes(new \SimPay\Laravel\Dto\Payment\ChannelTypeData(
            blik: true, // BLIK, BLIK Pay Later
            transfer: true, // Polish banks
            cards: true, // Credit cards
            ewallets: true, // Google Pay / Apple Pay  
            paypal: true, 
            paysafe: true, // PaysafeCard, Skrill
            latam: true, // Latin America payments
            postponed: false, // PayPo
        ))
    // make() is required to create payment.
    ->make();
```

Response will be [TransactionGeneratedResponse](/simpay-laravel/global-responses/transactiongeneratedresponse.md).\
\
If you want to use directChannel please see <https://docs.simpay.pl/payment/methods> to see available channels.
