Skip to content

Commit 11b01a3

Browse files
feat(api): add embed.session_generated and embed.viewed webhook event types
1 parent 5336e09 commit 11b01a3

9 files changed

Lines changed: 124 additions & 11 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 214
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-09b6d1b85c657173562e9a372adc74551f07d476122003078e9168467329f792.yml
3-
openapi_spec_hash: a2b3a526310ceccd4ccb59ec428d246f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-2d2600072500797474f0d7798c1a8b668bfbc4e0c6a8f076ca7b4cc7ad82058b.yml
3+
openapi_spec_hash: 7605eb6be77a3d150078916f0eb0e9ac
44
config_hash: 5bb913c05ebeb301ec925b16e75bb251

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,8 @@ Types:
915915
- <code><a href="./src/resources/webhooks.ts">DigitalWalletTokenizationUpdatedWebhookEvent</a></code>
916916
- <code><a href="./src/resources/webhooks.ts">DisputeUpdatedWebhookEvent</a></code>
917917
- <code><a href="./src/resources/webhooks.ts">DisputeEvidenceUploadFailedWebhookEvent</a></code>
918+
- <code><a href="./src/resources/webhooks.ts">EmbedSessionGeneratedWebhookEvent</a></code>
919+
- <code><a href="./src/resources/webhooks.ts">EmbedViewedWebhookEvent</a></code>
918920
- <code><a href="./src/resources/webhooks.ts">ExternalBankAccountCreatedWebhookEvent</a></code>
919921
- <code><a href="./src/resources/webhooks.ts">ExternalBankAccountUpdatedWebhookEvent</a></code>
920922
- <code><a href="./src/resources/webhooks.ts">ExternalPaymentCreatedWebhookEvent</a></code>

packages/mcp-server/src/local-docs-search.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3593,13 +3593,13 @@ const EMBEDDED_METHODS: MethodEntry[] = [
35933593
httpMethod: 'get',
35943594
summary: 'Embedded card UI',
35953595
description:
3596-
'Handling full card PANs and CVV codes requires that you comply with the Payment Card Industry Data Security Standards (PCI DSS). Some clients choose to reduce their compliance obligations by leveraging our embedded card UI solution documented below.\n\nIn this setup, PANs and CVV codes are presented to the end-user via a card UI that we provide, optionally styled in the customer\'s branding using a specified css stylesheet. A user\'s browser makes the request directly to api.lithic.com, so card PANs and CVVs never touch the API customer\'s servers while full card data is displayed to their end-users. The response contains an HTML document (see Embedded Card UI or Changelog for upcoming changes in January). This means that the url for the request can be inserted straight into the `src` attribute of an iframe.\n\n```html\n<iframe id="card-iframe"\n src="https://sandbox.lithic.com/v1/embed/card?embed_request=eyJjc3MiO...;hmac=r8tx1..."\n allow="clipboard-write" class="content"></iframe>\n```\n\nYou should compute the request payload on the server side. You can render it (or the whole iframe) on the server or make an ajax call from your front end code, but **do not ever embed your API key into front end code, as doing so introduces a serious security vulnerability**.\n',
3596+
'**Deprecated.** Use the modern embedded card flow instead: create a session with `POST /v1/cards/{card_token}/embed` and render it via `GET /v1/embed`.\n\nHandling full card PANs and CVV codes requires that you comply with the Payment Card Industry Data Security Standards (PCI DSS). Some clients choose to reduce their compliance obligations by leveraging our embedded card UI solution documented below.\n\nIn this setup, PANs and CVV codes are presented to the end-user via a card UI that we provide, optionally styled in the customer\'s branding using a specified css stylesheet. A user\'s browser makes the request directly to api.lithic.com, so card PANs and CVVs never touch the API customer\'s servers while full card data is displayed to their end-users. The response contains an HTML document (see Embedded Card UI or Changelog for upcoming changes in January). This means that the url for the request can be inserted straight into the `src` attribute of an iframe.\n\n```html\n<iframe id="card-iframe"\n src="https://sandbox.lithic.com/v1/embed/card?embed_request=eyJjc3MiO...;hmac=r8tx1..."\n allow="clipboard-write" class="content"></iframe>\n```\n\nYou should compute the request payload on the server side. You can render it (or the whole iframe) on the server or make an ajax call from your front end code, but **do not ever embed your API key into front end code, as doing so introduces a serious security vulnerability**.\n',
35973597
stainlessPath: '(resource) cards > (method) embed',
35983598
qualified: 'client.cards.embed',
35993599
params: ['embed_request: string;', 'hmac: string;'],
36003600
response: 'string',
36013601
markdown:
3602-
"## embed\n\n`client.cards.embed(embed_request: string, hmac: string): string`\n\n**get** `/v1/embed/card`\n\nHandling full card PANs and CVV codes requires that you comply with the Payment Card Industry Data Security Standards (PCI DSS). Some clients choose to reduce their compliance obligations by leveraging our embedded card UI solution documented below.\n\nIn this setup, PANs and CVV codes are presented to the end-user via a card UI that we provide, optionally styled in the customer's branding using a specified css stylesheet. A user's browser makes the request directly to api.lithic.com, so card PANs and CVVs never touch the API customer's servers while full card data is displayed to their end-users. The response contains an HTML document (see Embedded Card UI or Changelog for upcoming changes in January). This means that the url for the request can be inserted straight into the `src` attribute of an iframe.\n\n```html\n<iframe id=\"card-iframe\"\n src=\"https://sandbox.lithic.com/v1/embed/card?embed_request=eyJjc3MiO...;hmac=r8tx1...\"\n allow=\"clipboard-write\" class=\"content\"></iframe>\n```\n\nYou should compute the request payload on the server side. You can render it (or the whole iframe) on the server or make an ajax call from your front end code, but **do not ever embed your API key into front end code, as doing so introduces a serious security vulnerability**.\n\n\n### Parameters\n\n- `embed_request: string`\n A base64 encoded JSON string of an EmbedRequest to specify which card to load.\n\n- `hmac: string`\n SHA256 HMAC of the embed_request JSON string with base64 digest.\n\n### Returns\n\n- `string`\n\n### Example\n\n```typescript\nimport Lithic from 'lithic';\n\nconst client = new Lithic();\n\nconst response = await client.cards.embed({ embed_request: 'embed_request', hmac: 'hmac' });\n\nconsole.log(response);\n```",
3602+
"## embed\n\n`client.cards.embed(embed_request: string, hmac: string): string`\n\n**get** `/v1/embed/card`\n\n**Deprecated.** Use the modern embedded card flow instead: create a session with `POST /v1/cards/{card_token}/embed` and render it via `GET /v1/embed`.\n\nHandling full card PANs and CVV codes requires that you comply with the Payment Card Industry Data Security Standards (PCI DSS). Some clients choose to reduce their compliance obligations by leveraging our embedded card UI solution documented below.\n\nIn this setup, PANs and CVV codes are presented to the end-user via a card UI that we provide, optionally styled in the customer's branding using a specified css stylesheet. A user's browser makes the request directly to api.lithic.com, so card PANs and CVVs never touch the API customer's servers while full card data is displayed to their end-users. The response contains an HTML document (see Embedded Card UI or Changelog for upcoming changes in January). This means that the url for the request can be inserted straight into the `src` attribute of an iframe.\n\n```html\n<iframe id=\"card-iframe\"\n src=\"https://sandbox.lithic.com/v1/embed/card?embed_request=eyJjc3MiO...;hmac=r8tx1...\"\n allow=\"clipboard-write\" class=\"content\"></iframe>\n```\n\nYou should compute the request payload on the server side. You can render it (or the whole iframe) on the server or make an ajax call from your front end code, but **do not ever embed your API key into front end code, as doing so introduces a serious security vulnerability**.\n\n\n### Parameters\n\n- `embed_request: string`\n A base64 encoded JSON string of an EmbedRequest to specify which card to load.\n\n- `hmac: string`\n SHA256 HMAC of the embed_request JSON string with base64 digest.\n\n### Returns\n\n- `string`\n\n### Example\n\n```typescript\nimport Lithic from 'lithic';\n\nconst client = new Lithic();\n\nconst response = await client.cards.embed({ embed_request: 'embed_request', hmac: 'hmac' });\n\nconsole.log(response);\n```",
36033603
perLanguage: {
36043604
typescript: {
36053605
method: 'client.cards.embed',

src/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ import {
225225
DisputeTransactionCreatedWebhookEvent,
226226
DisputeTransactionUpdatedWebhookEvent,
227227
DisputeUpdatedWebhookEvent,
228+
EmbedSessionGeneratedWebhookEvent,
229+
EmbedViewedWebhookEvent,
228230
ExternalBankAccountCreatedWebhookEvent,
229231
ExternalBankAccountUpdatedWebhookEvent,
230232
ExternalPaymentCreatedWebhookEvent,
@@ -1623,6 +1625,8 @@ export declare namespace Lithic {
16231625
type DigitalWalletTokenizationUpdatedWebhookEvent as DigitalWalletTokenizationUpdatedWebhookEvent,
16241626
type DisputeUpdatedWebhookEvent as DisputeUpdatedWebhookEvent,
16251627
type DisputeEvidenceUploadFailedWebhookEvent as DisputeEvidenceUploadFailedWebhookEvent,
1628+
type EmbedSessionGeneratedWebhookEvent as EmbedSessionGeneratedWebhookEvent,
1629+
type EmbedViewedWebhookEvent as EmbedViewedWebhookEvent,
16261630
type ExternalBankAccountCreatedWebhookEvent as ExternalBankAccountCreatedWebhookEvent,
16271631
type ExternalBankAccountUpdatedWebhookEvent as ExternalBankAccountUpdatedWebhookEvent,
16281632
type ExternalPaymentCreatedWebhookEvent as ExternalPaymentCreatedWebhookEvent,

src/resources/cards/cards.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ export class Cards extends APIResource {
151151
}
152152

153153
/**
154+
* **Deprecated.** Use the modern embedded card flow instead: create a session with
155+
* `POST /v1/cards/{card_token}/embed` and render it via `GET /v1/embed`.
156+
*
154157
* Handling full card PANs and CVV codes requires that you comply with the Payment
155158
* Card Industry Data Security Standards (PCI DSS). Some clients choose to reduce
156159
* their compliance obligations by leveraging our embedded card UI solution
@@ -179,13 +182,7 @@ export class Cards extends APIResource {
179182
* but **do not ever embed your API key into front end code, as doing so introduces
180183
* a serious security vulnerability**.
181184
*
182-
* @example
183-
* ```ts
184-
* const response = await client.cards.embed({
185-
* embed_request: 'embed_request',
186-
* hmac: 'hmac',
187-
* });
188-
* ```
185+
* @deprecated
189186
*/
190187
embed(query: CardEmbedParams, options?: RequestOptions): APIPromise<string> {
191188
return this._client.get('/v1/embed/card', {

src/resources/events/events.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ export interface Event {
177177
* This event is not emitted for Managed Disputes. Use
178178
* `dispute_transaction.created` and `dispute_transaction.updated` instead.
179179
*
180+
* - embed.session_generated: Occurs when a card embed session is successfully
181+
* generated.
182+
* - embed.viewed: Occurs when a card detail is successfully revealed through an
183+
* embed.
180184
* - external_bank_account.created: Occurs when an external bank account is
181185
* created.
182186
* - external_bank_account.updated: Occurs when an external bank account is
@@ -253,6 +257,8 @@ export interface Event {
253257
| 'dispute_transaction.created'
254258
| 'dispute_transaction.updated'
255259
| 'dispute.updated'
260+
| 'embed.session_generated'
261+
| 'embed.viewed'
256262
| 'external_bank_account.created'
257263
| 'external_bank_account.updated'
258264
| 'external_payment.created'
@@ -338,6 +344,8 @@ export interface EventSubscription {
338344
| 'dispute_transaction.created'
339345
| 'dispute_transaction.updated'
340346
| 'dispute.updated'
347+
| 'embed.session_generated'
348+
| 'embed.viewed'
341349
| 'external_bank_account.created'
342350
| 'external_bank_account.updated'
343351
| 'external_payment.created'
@@ -461,6 +469,8 @@ export interface EventListParams extends CursorPageParams {
461469
| 'dispute_transaction.created'
462470
| 'dispute_transaction.updated'
463471
| 'dispute.updated'
472+
| 'embed.session_generated'
473+
| 'embed.viewed'
464474
| 'external_bank_account.created'
465475
| 'external_bank_account.updated'
466476
| 'external_payment.created'

src/resources/events/subscriptions.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ export interface SubscriptionCreateParams {
199199
| 'dispute_transaction.created'
200200
| 'dispute_transaction.updated'
201201
| 'dispute.updated'
202+
| 'embed.session_generated'
203+
| 'embed.viewed'
202204
| 'external_bank_account.created'
203205
| 'external_bank_account.updated'
204206
| 'external_payment.created'
@@ -282,6 +284,8 @@ export interface SubscriptionUpdateParams {
282284
| 'dispute_transaction.created'
283285
| 'dispute_transaction.updated'
284286
| 'dispute.updated'
287+
| 'embed.session_generated'
288+
| 'embed.viewed'
285289
| 'external_bank_account.created'
286290
| 'external_bank_account.updated'
287291
| 'external_payment.created'
@@ -395,6 +399,8 @@ export interface SubscriptionSendSimulatedExampleParams {
395399
| 'dispute_transaction.created'
396400
| 'dispute_transaction.updated'
397401
| 'dispute.updated'
402+
| 'embed.session_generated'
403+
| 'embed.viewed'
398404
| 'external_bank_account.created'
399405
| 'external_bank_account.updated'
400406
| 'external_payment.created'

src/resources/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ export {
333333
type DigitalWalletTokenizationUpdatedWebhookEvent,
334334
type DisputeUpdatedWebhookEvent,
335335
type DisputeEvidenceUploadFailedWebhookEvent,
336+
type EmbedSessionGeneratedWebhookEvent,
337+
type EmbedViewedWebhookEvent,
336338
type ExternalBankAccountCreatedWebhookEvent,
337339
type ExternalBankAccountUpdatedWebhookEvent,
338340
type ExternalPaymentCreatedWebhookEvent,

src/resources/webhooks.ts

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,6 +1765,94 @@ export interface DisputeEvidenceUploadFailedWebhookEvent extends DisputesAPI.Dis
17651765
event_type: 'dispute_evidence.upload_failed';
17661766
}
17671767

1768+
export interface EmbedSessionGeneratedWebhookEvent {
1769+
/**
1770+
* The token of the account associated with the card
1771+
*/
1772+
account_token: string;
1773+
1774+
/**
1775+
* The token of the card associated with the embed session
1776+
*/
1777+
card_token: string;
1778+
1779+
/**
1780+
* Details about the request that generated the embed session
1781+
*/
1782+
device_details: EmbedSessionGeneratedWebhookEvent.DeviceDetails;
1783+
1784+
/**
1785+
* The type of event
1786+
*/
1787+
event_type: 'embed.session_generated';
1788+
1789+
/**
1790+
* The identifier shared by webhook events for the same embed session.
1791+
*/
1792+
session_id: string;
1793+
1794+
/**
1795+
* The type of embed session that was generated
1796+
*/
1797+
session_type: 'CARD_EMBED' | 'PIN_SETTING_EMBED';
1798+
}
1799+
1800+
export namespace EmbedSessionGeneratedWebhookEvent {
1801+
/**
1802+
* Details about the request that generated the embed session
1803+
*/
1804+
export interface DeviceDetails {
1805+
/**
1806+
* The IP address recorded for the request that generated the event
1807+
*/
1808+
ip_address: string;
1809+
}
1810+
}
1811+
1812+
export interface EmbedViewedWebhookEvent {
1813+
/**
1814+
* The token of the account associated with the card
1815+
*/
1816+
account_token: string;
1817+
1818+
/**
1819+
* The token of the card whose details were revealed
1820+
*/
1821+
card_token: string;
1822+
1823+
/**
1824+
* Details about the request that revealed the card detail
1825+
*/
1826+
device_details: EmbedViewedWebhookEvent.DeviceDetails;
1827+
1828+
/**
1829+
* The type of card detail that was revealed
1830+
*/
1831+
embed_type: 'PAN' | 'CVV' | 'EXP_MONTH' | 'EXP_YEAR';
1832+
1833+
/**
1834+
* The type of event
1835+
*/
1836+
event_type: 'embed.viewed';
1837+
1838+
/**
1839+
* The identifier shared by webhook events for the same embed session.
1840+
*/
1841+
session_id: string;
1842+
}
1843+
1844+
export namespace EmbedViewedWebhookEvent {
1845+
/**
1846+
* Details about the request that revealed the card detail
1847+
*/
1848+
export interface DeviceDetails {
1849+
/**
1850+
* The IP address recorded for the request that generated the event
1851+
*/
1852+
ip_address: string;
1853+
}
1854+
}
1855+
17681856
export interface ExternalBankAccountCreatedWebhookEvent extends ExternalBankAccountsAPI.ExternalBankAccount {
17691857
/**
17701858
* The type of event that occurred.
@@ -2356,6 +2444,8 @@ export type ParsedWebhookEvent =
23562444
| DigitalWalletTokenizationUpdatedWebhookEvent
23572445
| DisputeUpdatedWebhookEvent
23582446
| DisputeEvidenceUploadFailedWebhookEvent
2447+
| EmbedSessionGeneratedWebhookEvent
2448+
| EmbedViewedWebhookEvent
23592449
| ExternalBankAccountCreatedWebhookEvent
23602450
| ExternalBankAccountUpdatedWebhookEvent
23612451
| ExternalPaymentCreatedWebhookEvent
@@ -2842,6 +2932,8 @@ export declare namespace Webhooks {
28422932
type DigitalWalletTokenizationUpdatedWebhookEvent as DigitalWalletTokenizationUpdatedWebhookEvent,
28432933
type DisputeUpdatedWebhookEvent as DisputeUpdatedWebhookEvent,
28442934
type DisputeEvidenceUploadFailedWebhookEvent as DisputeEvidenceUploadFailedWebhookEvent,
2935+
type EmbedSessionGeneratedWebhookEvent as EmbedSessionGeneratedWebhookEvent,
2936+
type EmbedViewedWebhookEvent as EmbedViewedWebhookEvent,
28452937
type ExternalBankAccountCreatedWebhookEvent as ExternalBankAccountCreatedWebhookEvent,
28462938
type ExternalBankAccountUpdatedWebhookEvent as ExternalBankAccountUpdatedWebhookEvent,
28472939
type ExternalPaymentCreatedWebhookEvent as ExternalPaymentCreatedWebhookEvent,

0 commit comments

Comments
 (0)