# Stripe (Legacy)

{% hint style="info" %}
The following reference documentation is for the **Legacy** Stripe Pay book.
{% endhint %}

## Overview

The **Stripe Pay** Book integrates with Stripe, offering a way to automate Stripe's payment processing capabilities. This integration enables users to perform various operations on Stripe objects, including connecting to Stripe, retrieving, creating, updating, and deleting records, as well as managing invoices.

## Prerequisites

1. **Stripe Account**: You need to have an active Stripe account.
2. **API Key**: Obtain your Stripe API key, which is required for Kognitos to communicate with Stripe. You can find this in your Stripe dashboard under "Developers" > "API keys".

### Learning the Stripe Pay Book in Kognitos

1. Navigate to **Books → All Books.**
2. Click on **Stripe Pay (Legacy)**.
3. Click on **Add Connection.**
4. Enter your credentials when prompted.

## Procedures

### Fetching Data

Fetch data from Stripe using the following syntax:

```
get a customer from stripe whose email is "john.doe@example.com"
```

```
get an invoice from stripe whose status is "open"
```

### Add New Records

To add a new record to Stripe, you need to specify the type of object you're creating and provide the necessary field values.

#### Examples

1. This creates a new customer with the specified email and name.

```
create a customer in stripe with
  the email is "john.doe@example.com"
  the name is "John Doe"
```

2. This creates a new price with the specified unit amount, currency, and product ID.

```
create a price in stripe with
  the unit_amount is 1000
  the currency is "usd"
  the product is "12232232"
```

### Adding Items to Invoices

To add an item to an invoice in Stripe, use the following syntax:

```
add a item to the invoice with
  the customer is "cus_123ABC"
  the amount is 1500
  the currency is "usd"
```

This adds an item to the specified invoice with the given customer, amount, and currency.

### Sending Invoices

To send an invoice in Stripe, use the following syntax:

```
send the invoice
```

### Deleting Objects

To delete a specific Stripe object, you need to specify the object and its ID.

#### Examples

1. This deletes the customer with the specified ID.

```
delete a customer in stripe with
  the id is "cus_123ABC"
```

2. This deletes the invoice with the specified ID.

```
delete an invoice in stripe with
  the id is "sub_123456789"
```
