PayAction

View as MarkdownOpen in Claude

Returned from call.pay(). Tracks an active payment collection operation. Terminal states: finished, error.

Inherits all properties and methods from the base Action interface (controlId, isDone, completed, result, wait()).

Properties

No additional properties beyond the base Action interface.

Methods

Example

import { RelayClient } from '@signalwire/sdk';
const client = new RelayClient({
project: process.env.SIGNALWIRE_PROJECT_ID!,
token: process.env.SIGNALWIRE_API_TOKEN!,
contexts: ['default']
});
client.onCall(async (call) => {
await call.answer();
const action = await call.pay('https://example.com/payment-connector', {
chargeAmount: '29.99',
currency: 'USD',
});
const event = await action.wait();
console.log(`Payment state: ${event.params.state}`);
});
await client.run();