Trolley JavaScript SDK > PaymentGateway
PaymentGateway
▸ create(batchId: string
, body: any
): Promise
<Payment
>
Defined in PaymentGateway.ts:55
Create a new payment in a batch
const payment = await client.payment.create('B-xx99bb', {
recipient: {
email: '[email protected]',
},
sourceAmount: '10.99',
});
Parameters:
Param | Type | Description |
---|---|---|
batchId | string |
Trolley payment id (e.g. "B-xx999bb") |
body | any |
Payment information |
Returns: Promise
<Payment
>
▸ find(paymentId: string
): Promise
<Payment
>
Defined in PaymentGateway.ts:34
Find a specific payment
const payment = await client.payment.find('P-aabbccc');
Parameters:
Param | Type | Description |
---|---|---|
paymentId | string |
Trolley payment id (e.g. "P-aabccc") |
Returns: Promise
<Payment
>
▸ remove(paymentId: string
, batchId: string
): Promise
<boolean
>
Defined in PaymentGateway.ts:90
Delete a given payment -- Note you can only delete non processed payments
const success = await client.payment.remove('P-aabbccc', 'B-xx99bb');
Parameters:
Param | Type | Description |
---|---|---|
paymentId | string |
Trolley payment id (e.g. "P-aabccc") |
batchId | string |
Trolley payment id (e.g. "B-xx999bb") |
Returns: Promise
<boolean
>
▸ search(batchId: string
, page?: number
, pageSize?: number
, term?: string
): Promise
<Payment
[]>
Defined in PaymentGateway.ts:105
Search for payments in a given batch
Parameters:
Param | Type | Default value | Description |
---|---|---|---|
batchId | string |
- | Trolley payment id (e.g. "B-xx999bb") |
Default value page |
number |
1 | Page number (1 based) |
Default value pageSize |
number |
10 | Page size (0...1000) |
Default value term |
string |
"" | Any search terms to look for |
Returns: Promise
<Payment
[]>
▸ update(paymentId: string
, batchId: string
, body: any
): Promise
<boolean
>
Defined in PaymentGateway.ts:74
Update a given payment
const success = await client.payment.update('P-aabbccc', 'B-xx99bb', {
sourceAmount: '99.99',
});
Parameters:
Param | Type | Description |
---|---|---|
paymentId | string |
Trolley payment id (e.g. "P-aabccc") |
batchId | string |
Trolley payment id (e.g. "B-xx999bb") |
body | any |
Payment update information |
Returns: Promise
<boolean
>