Skip to content

Latest commit

 

History

History
140 lines (86 loc) · 3.47 KB

paymentgateway.md

File metadata and controls

140 lines (86 loc) · 3.47 KB

Trolley JavaScript SDK > PaymentGateway

Class: PaymentGateway

Hierarchy

PaymentGateway

Index

Methods


Methods

create

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

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

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

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

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>