# @integraledger/lcp/ap2

> The exports of @integraledger/lcp/ap2.

Source: https://lcp.integraledger.com/reference/api/ap2

## Interfaces

### Ap2Offer

#### Properties

| Property       | Type                  |
| -------------- | --------------------- |
|  `checkout`    | `string`              |
|  `checkoutJwt` | `string`              |
|  `payload`     | [`Payload`](#payload) |

***

### MandateContent

#### Properties

| Property         | Type     |
| ---------------- | -------- |
|  `checkout_hash` | `string` |
|  `checkout_jwt?` | `string` |

***

### Presented

#### Properties

| Property            | Type     | Description                                          |
| ------------------- | -------- | ---------------------------------------------------- |
|  `checkout_jwt`     | `string` | The checkout JWT the presenter names as the latest.  |
|  `checkout_mandate` | `string` | The closed Checkout Mandate, an SD-JWT as presented. |

***

### Unsigned

#### Properties

| Property                | Type                   |
| ----------------------- | ---------------------- |
|  `content`              | `object`               |
| `content.checkout_hash` | `string`               |
| `content.checkout_jwt`  | `string`               |
| `content.vct`           | `"mandate.checkout.1"` |

#### Methods

##### complete()

> **complete**(`checkout_mandate`): [`Presented`](#presented)

###### Parameters

| Parameter          | Type     |
| ------------------ | -------- |
| `checkout_mandate` | `string` |

###### Returns

[`Presented`](#presented)

## Type Aliases

### CheckoutOption

> **CheckoutOption** = `object`

The checkout's own `id`, 1–256 characters.

#### Properties

| Property    | Type     |
| ----------- | -------- |
|  `checkout` | `string` |

***

### Jws

> **Jws** = `string`

A compact JWS: three base64url segments joined by ".".

***

### Payload

> **Payload** = `object`

The `checkout_jwt` payload: the commerce object.

#### Index Signature

\[`k`: `string`]: [`Json`](https://lcp.integraledger.com/reference/api#json)

## Variables

### CHECKOUT\_VCT

> `const` **CHECKOUT\_VCT**: `"mandate.checkout.1"` = `"mandate.checkout.1"`

***

### checkoutMandate

> `const` **checkoutMandate**: `Readonly`\<\{ `advertise`: (`payload`, `h`, `link`, `offer`, `agreementUrl?`) => [`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Payload`](#payload); `bound`: (`presented`) => `Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>; `build`: (`offer`, `h`) => `Promise`\<[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Unsigned`](#unsigned)>; `claims`: `boolean`; `id`: `"ap2/checkout-mandate"`; `pattern`: [`LcpPattern`](https://lcp.integraledger.com/reference/api/x402#lcppattern); `read`: (`doc`) => [`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | \{ `agreement?`: `string`; `h`: `` `0x${string}` ``; `link`: `string`; `offer`: [`Ap2Offer`](#ap2offer); }; `tie`: (`options`) => \[`"ap2"`, \{ `options`: readonly [`CheckoutOption`](#checkoutoption)\[]; }]; `unplaced`: (`option`) => [`CheckoutOption`](#checkoutoption); }>

***

### issuedDigest

> `const` **issuedDigest**: *typeof* [`digestJson`](https://lcp.integraledger.com/reference/api#digestjson) = `digestJson`

The option digest the issuer keeps: SHA-256 over the RFC 8785 form.

## Functions

### checkoutBinding()

> **checkoutBinding**(`p`): `Promise`\<[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | \{ `payload`: [`Payload`](#payload); }>

AP2's merchant check: the mandate's `checkout_hash` is the hash of the presenter's latest `checkout_jwt`, and a
disclosed `checkout_jwt` is that JWT. Returns that JWT's payload.

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `p`       | `unknown` |

#### Returns

`Promise`\<[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | \{ `payload`: [`Payload`](#payload); }>

***

### checkoutJwtOf()

> **checkoutJwtOf**(`m`): `Promise`\<`string` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

The `checkout_jwt` the mandate discloses.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `m`       | `string` |

#### Returns

`Promise`\<`string` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

***

### jwsPayload()

> **jwsPayload**(`j`): [`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Payload`](#payload)

The payload of a compact JWS, decoded as one JSON object. The signature is never verified.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `j`       | `string` |

#### Returns

[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Payload`](#payload)

***

### readMandate()

> **readMandate**(`m`): `Promise`\<[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`MandateContent`](#mandatecontent)>

The closed Checkout Mandate inside an SD-JWT: exactly one resolved object whose `vct` is `mandate.checkout.1`, its
`checkout_hash`, and its `checkout_jwt` when disclosed.

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `m`       | `unknown` |

#### Returns

`Promise`\<[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`MandateContent`](#mandatecontent)>

***

### tie()

> **tie**(`options`): \[`"ap2"`, \{ `options`: readonly [`CheckoutOption`](#checkoutoption)\[]; }]

The binding slot: the checkouts this ATR was minted for, each by its own `id`.

#### Parameters

| Parameter | Type                                            |
| --------- | ----------------------------------------------- |
| `options` | readonly [`CheckoutOption`](#checkoutoption)\[] |

#### Returns

\[`"ap2"`, \{ `options`: readonly [`CheckoutOption`](#checkoutoption)\[]; }]
