Ingestion des événements pour la facturation basée sur l’utilisation.
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
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
List of events to be pushed
1 - 1000 elementsAfficher attributs enfants
customer_id of the customer whose usage needs to be tracked
Event Id acts as an idempotency key. Any subsequent requests with the same event_id will be ignored
Name of the event
Custom Timestamp. Defaults to current timestamp in UTC. Timestamps that are older that 1 hour or after 5 mins, from current timestamp, will be rejected.
Events ingested successfully
x >= 0Cette page vous a-t-elle été utile ?
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
}