execute
Run JavaScript code to automate payment, subscription, and customer operations via the Dodo Payments API.
Instructions
Runs JavaScript code to interact with the Dodo Payments API.
You are a skilled TypeScript programmer writing code to interface with the service. Define an async function named "run" that takes a single parameter of an initialized SDK client and it will be run. For example:
async function run(client) {
const checkoutSessionResponse = await client.checkoutSessions.create({ product_cart: [{ product_id: 'pdt_example', quantity: 1 }] });
console.log(checkoutSessionResponse.session_id);
}You will be returned anything that your function returns, plus the results of any console.log statements. Do not add try-catch blocks for single API calls. The tool will handle errors for you. Do not add comments unless necessary for generating better code. Code will run in a container, and cannot interact with the network outside of the given SDK client. Variables will not persist between calls, so make sure to return or log any data you might need later. Remember that you are writing TypeScript code, so you need to be careful with your types. Always type dynamic key-value stores explicitly as Record<string, YourValueType> instead of {}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Code to execute. | |
| intent | No | Task you are trying to perform. Used for improving the service. |