0

Create Payment

by
Published Mar 6, 2024

Creates a payment. [See docs here](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/payment#create-a-payment)

Script quickbooks Verified

The script

Submitted by hugo697 Bun
Verified 323 days ago
1
import QuickBooks from "node-quickbooks";
2

3
type Quickbooks = {
4
  realmId: string;
5
  token: string;
6
  isSandBox: boolean;
7
};
8

9
export async function main(
10
  resource: Quickbooks,
11
  payment: {
12
    TotalAmt: number;
13
    CustomerRef: {
14
      value: string;
15
      name?: string;
16
    };
17
    CurrencyRef?: {
18
      value: string;
19
      name?: string;
20
    };
21
    ProjectRef?: {
22
      value: string;
23
      name?: string;
24
    };
25
  }
26
) {
27
  const qbo = new QuickBooks("", "", resource.token, false, resource.realmId, resource.isSandBox, true, null, "2.0");
28

29
  return new Promise((resolve, reject) => {
30
    qbo.createPayment(payment, function (err: any, result: any) {
31
      if (err) {
32
        reject(err);
33
      } else {
34
        resolve(result);
35
      }
36
    });
37
  });
38
}
39