# Payment intents

## Payment Intents

Payment intents collect the information from your checkout and send it to the Amplify API. In addition to that, they save and update the status of the entire process.

### Status

#### **CREATED**

The checkout process was started but the payer has not selected the amount nor the payment method to be used.

#### **WAITING FOR PAYMENT**

The payer selected the token, network, amount, payment method, and we are waiting for the funds to be received to the right address.

#### **COMPLETED**

The payment is completed successfully

#### **ERROR**

There was an error with the payment.

#### **TIMEOUT**

The payer took more than 15 minutes to transfer the required funds. The transaction is thus invalid.

#### **API**

Most endpoints require authentication. In the request headers you must send the following:

```
{
  "apiKey": "123xxx456",
  "clientId": "123xxx456",
}
```

#### \[GET] [https://api.getamplify.app/payment\_intent/:clientSecret](https://api.getamplify.app/payment_intent/:clientSecret**)

Returns a specific payment intent

**Response**

```
{
    "_id": "65a8609a11ab863177a0de6f",
    "userId": "659xxx7730",
    "walletId": "65axxxe6d",
    "clientSecret": "Dx2xxxvH5",
    "status": "COMPLETED",
    "apiKeyType": "PRODUCTION",
    "receiverId": "receiver-identification",
    "metadata": null,
    "created_at": "2024-01-01T23:19:54.258Z",
    "updated_at": "2024-01-01T23:20:58.934Z",
}
```

Note: The clientSecret is obtained when creating the payment intent

#### \[POST] [https://api.getamplify.app/payment\_intent](https://api.getamplify.app/payment_intent**)

Creates a new payment intent

Authentication required

**Body**

```
{
    // [REQUIRED] Unique receiver or cart indentification
    "receiverId": "receiver-identification"
    /*
     ** [OPTIONAL] Relevant business information that you want to keep track of
     ** across the payment process
    */
    "metadata": {
      "key": "Value",
      "anotherKey": "another value"
    }
}
```

#### **Response**

```
{
    "paymentIntentId": "123...123",
    "clientSecret": "Dx2xxxvH5",
    "walletAddress": "0x...123",
    "receiverId": "receiver-identification",
}
```

#### \[POST] [https://api.getamplify.app/payment\_intent/status](https://api.getamplify.app/payment_intent/status**)

Returns the status of a payment intent

**Body**

```
{
    "clientSecret": "Dx2xxxvH5"
}
```

**Response**

```
{
  "status": "COMPLETED"
}
```
