# How to Accept One-Time Payments


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

This guide shows you how to create one-time payment links using
FastStripe’s simplified API.

## Problem

You want to accept a one-time payment for a product or service without
dealing with the complexity of creating products, prices, and checkout
sessions manually.

## Solution

Use FastStripe’s `one_time_payment()` method which handles all the setup
automatically.

``` python
from faststripe.core import StripeApi
import os

# Initialize the API
sapi = StripeApi(os.environ['STRIPE_SECRET_KEY'])
```

## Basic one-time payment

``` python
# Create a simple payment link
checkout = sapi.one_time_payment(
    product_name='Digital Course',
    amount_cents=49_99,  # $49.99
    success_url='https://yoursite.com/success',
    cancel_url='https://yoursite.com/cancel'
)

print(f"Payment URL: {checkout.url[:64]}...")
```

    Payment URL: https://billing.answer.ai/c/pay/cs_test_a1cUOqAjwyxJpKtfksIpNViB...

## Different currencies

FastStripe supports all currencies that Stripe accepts:

``` python
# Euro payment
eur_checkout = sapi.one_time_payment(
    product_name='European Product',
    amount_cents=25_00,  # €25.00
    success_url='https://yoursite.com/success',
    cancel_url='https://yoursite.com/cancel',
    currency='eur'
)

print(f"EUR Payment URL: {eur_checkout.url[:64]}...")
```

    EUR Payment URL: https://billing.answer.ai/c/pay/cs_test_a1xhktl4eWXJwP1aCzuwtzBr...

## Manual approach

If you need more control, you can create products, prices, and checkout
sessions manually:

``` python
# Create product
product = sapi.products.post(
    name='Advanced Course',
    description='Complete Python development course'
)

# Create price
price = sapi.prices.post(
    product=product.id,
    unit_amount=99_99,  # $99.99
    currency='usd'
)

# Create checkout session
checkout = sapi.checkout.sessions_post(
    mode='payment',
    line_items=[{
        'price': price.id,
        'quantity': 1
    }],
    success_url='https://yoursite.com/success',
    cancel_url='https://yoursite.com/cancel'
)

print(f"Manual checkout URL: {checkout.url[:64]}...")
```

    Manual checkout URL: https://billing.answer.ai/c/pay/cs_test_a1wddAo7iSKwVLKJJh69cTSd...

## Tips

- Use test mode (keys starting with `sk_test_`) during development
- FastStripe automatically creates products and prices if they don’t
  exist
- Store the checkout session ID for tracking payments
- Use webhooks to handle successful payments in your application
