# Create a New Charge — OPN (formerly Omise)

> Create a new charge for a specific customer and amount through the OPN platform. See the documentation

- Key: `omise-create-charge`
- Type: Action (Write)
- Version: 0.0.2
- App: OPN (formerly Omise) (`omise`) — https://pipedream.com/apps/omise.md
- This page (HTML): https://pipedream.com/apps/omise/actions/create-charge
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/omise/actions/create-charge/create-charge.mjs

## Description

Create a new charge for a specific customer and amount through the OPN platform. [See the documentation](https://docs.opn.ooo/charges-api#create)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `amount` | `integer` | Yes | The amount for the charge in the smallest currency unit. |
| `currency` | `string` | Yes | The currency for the charge |
| `authorizationType` | `string` | No | The type of the authorization for the charge. |
| `capture` | `boolean` | No | Whether the charge is set to be automatically captured (paid). Valid only for credit and debit card charges. |
| `customer` | `string` | No | The unique identifier for a customer Options are loaded from the connected account. |
| `card` | `string` | No | An unused token identifier to add as a new card to the charge. Options are loaded from the connected account. |
| `description` | `string` | No | Charge description. Supplying information about a purchase (e.g. number of items, type of items, date of delivery) helps Opn Payments better conduct fraud analysis. |
| `expiresAt` | `string` | No | UTC datetime of desired charge expiration in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). |
| `ip` | `string` | No | IP address to attach to the charge. Supplying the customer's real IP address helps Opn Payments better conduct fraud analysis. May be IPv4 or IPv6. |
| `metadata` | `object` | No | Custom metadata (e.g. {"answer": 42}) for charge. |
| `platformFee` | `object` | No | Platform fee object as fixed amount and/or percentage of charge amount. |
| `returnUri` | `string` | No | The URI to which the customer is redirected after authorization. Required if card and customer are not present. |
| `source` | `string` | No | A valid source identifier or source object |
| `webhookEndpoints` | `string[]` | No | URLs to which charge notifications are to be sent. This field can contain a maximum of two URLs. |
| `zeroInterestInstallments` | `boolean` | No | Whether merchant absorbs the interest for installment payments; must match value in associated source. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "omise",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "omise-create-charge",
  arguments: {
    amount: 10,
    currency: "Currency",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "omise-create-charge",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    omise: { authProvisionId: "apn_xxxxxxx" },
    amount: 10,
    currency: "Currency",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "omise-create-charge",
    "configured_props": {
      "omise": { "authProvisionId": "apn_xxxxxxx" },
      "amount": 10,
      "currency": "Currency"
    }
  }'
```

---

- App: https://pipedream.com/apps/omise.md · All apps: https://pipedream.com/apps
