> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pushcash.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

# Overview

Time to complete: **\< 10 minutes**

This guide walks you through the basic steps to create an API key and process a simulated payment using Push.

## 1. Create an API key

In order to securely access the API, you must first exchange a temporary code for a durable API key.
You can request your temporary code in the dedicated slack channel setup for your organization or by reaching out to [hello@pushcash.com](mailto:hello@pushcash.com).

Once you have received your code, exchange it for an API key by making a request to the `keys/exchange` endpoint.

<Info>The steps below use the sandbox host (`sandbox.pushcash.com`). For production, make the same requests to `api.pushcash.com`.</Info>

```bash theme={null}
$ curl --request POST \
	--url https://sandbox.pushcash.com/keys/exchange \
	--data '{"code": "TEMPORARY_CODE"}'
```

The response should contain your API key which you can use to authenticate your requests to the Push API.

```text theme={null}
Your API key is: pcsk_sandbox_SPBLtVaLWA.EeL0j4DBkp4hDvtuUDO1fACOdOTHzvOzRynMWeHtyuwQ
```

You can verify your API key by making a request to the `keys/verify` endpoint.

```bash theme={null}
export APIKEY=pcsk_sandbox_...
curl --request POST \
	--url https://sandbox.pushcash.com/keys/verify \
 	--header 'Authorization: Bearer '$APIKEY
```

The API will respond with a status code of `200` (OK) and the name of your organization

```text theme={null}
Hello Sportsbook
```

## 2. Process a payment

In order to process a payment, you need to register a user.

```bash theme={null}
curl --request POST \
	--url https://sandbox.pushcash.com/user \
 	--header 'Authorization: Bearer '$APIKEY \
	--header 'X-Idempotency-Key: 1234' \
	--data '{
		"name": {
			"first": "Alfred",
			"last": "Hitchcock"
		},
		"email": "alfred@imdb.com",
		"address": {
			"address_line_1": "1609 10th Ave",
			"locality": "Bodega Bay",
			"administrative_area": "CA",
			"postal_code": "94923",
			"country": "US"
		},
		"date_of_birth": "1899-08-13",
		"government_id": {
			"type": "passport",
			"last4": "7349"
		},
		"phone_number": "(555) 681-3485",
		"tag": "4c8e6b4f",
		"identity_verified": true
	}'
```

The response contains the ID for your registered user.

```json theme={null}
{"id": "user_lVpbPL0K1XIiHx0DxipRbD"}
```

### Create Payment Intent

Now you can submit a request to create a payment intent, replacing "Your user ID" with the `id` from the previous step.

```bash theme={null}
curl --request POST \
	--url https://sandbox.pushcash.com/intent \
 	--header 'Authorization: Bearer '$APIKEY \
	--data '{
		"user_id": "Your user ID",
		"amount": 1500,
		"direction": "cash_in",
		"currency": "USD",
		"redirect_url": "https://docs.pushcash.com/quickstart#redirect"
	}' | sed -n 's/.*"url":"\([^"]*\)".*/\1/p' | xargs open
```

Running the command will open the URL for the payment session in your browser. You should see something like

<img noZoom src="https://mintcdn.com/pushcash/-IO5x-4ojg3Plm-Q/push-ux-screencapture.png?fit=max&auto=format&n=-IO5x-4ojg3Plm-Q&q=85&s=7c71e8146043fbc920b5c8bd1de9e120" width="375" height="667" data-path="push-ux-screencapture.png" />

### Enter Test Credentials

* In sandbox, use `5555 5555 5555 4444` for your card number. Provide any future date for the expiration and any valid 3-digit number for the CVV.
* To authenticate with your bank the username is `mxuser` and password is `password`. Select "checking account" if prompted.

<Info>Simulate payment declines in sandbox using `5999 9919 6976 9266` for your card number.<br /><br />Use `5999 9819 6976 9283` to simulate a decline after the user completes bank authentication.</Info>

### Confirm Deposit

Click "Deposit" to confirm the payment and display the payment confirmation pane. You should see something like

<img noZoom src="https://mintcdn.com/pushcash/-IO5x-4ojg3Plm-Q/push-ux-screencapture-done.png?fit=max&auto=format&n=-IO5x-4ojg3Plm-Q&q=85&s=2afd5e1a8a55b4c8347d59892457a59f" width="375" height="667" data-path="push-ux-screencapture-done.png" />

Finally, click "Back to ..." to return here.

<a id="redirect" />

Congratulations on completing the quickstart 🎉   
