跳转到主要内容
POST
/
events
/
ingest
JavaScript
import DodoPayments from 'dodopayments';

const client = new DodoPayments({
  bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
});

const response = await client.usageEvents.ingest({
  events: [{ customer_id: 'customer_id', event_id: 'event_id', event_name: 'event_name' }],
});

console.log(response.ingested_count);
{
  "ingested_count": 1
}

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
events
object[]
必填

List of events to be pushed

Required array length: 1 - 1000 elements

响应

Events ingested successfully

ingested_count
integer
必填
必填范围: x >= 0