Zoho Books - Update Customer Payment
@sergio
code:
data:privatelast updated:3 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
nodejs
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
8
}
9
this.invoices = JSON.parse(`[
        {
            "invoice_id": "2392161000000094008",
            "amount_applied": 1
        }
    ]
`);
steps.
zoho_books_update_customer_payment
Updates an existing payment information.
auth
(auths.zoho_books)
params
Organization id

In Zoho Books, your business is termed as an organization. If you have multiple businesses, you simply set each of those up as an individual organization. Each organization is an independent Zoho Books Organization with it’s own organization ID, base currency, time zone, language, contacts, reports, etc.

The parameter organization_id should be sent in with every API request to identify the organization.

The organization_id can be obtained from the GET /organizations API’s JSON response. Alternatively, it can be obtained from the Manage Organizations page in the admin console.

 
string ·params.organization_id
Payment id

ID of the customer payment to update.

 
string ·params.payment_id
Customer id

Customer ID of the customer involved in the payment.

 
string ·params.customer_id
Payment mode

Mode through which payment is made. This can be check, cash, creditcard, banktransfer, bankremittance, autotransaction or others. Max-length [100]

string ·params.payment_mode
Invoices

List of invoices associated with the payment. Each invoice object contains invoice_id, invoice_number, date, invoice_amount, amount_applied and balance_amount.

[0]:
 
array ·params.invoices
Amount

Amount paid in the respective payment.

 
string ·params.amount
Date

Date on which payment is made. Format [yyyy-mm-dd]

 
string ·params.date
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
}
31
//See the API docs: https://www.zoho.com/books/api/v3/#Customer-Payments_Update_a_payment

if (!params.organization_id || !params.payment_id || !params.customer_id || !params.payment_mode || !params.invoices || !params.amount || !params.date) {
  throw new Error("Must provide organization_id, payment_id, customer_id, payment_mode, invoices, amount, and date parameters.");  
}

return await require("@pipedreamhq/platform").axios(this, {
  method: "put",
  url: `https://books.${auths.zoho_books.base_api_uri}/api/v3/customerpayments/${params.payment_id}?organization_id=${params.organization_id}`,
  headers: {
    Authorization: `Zoho-oauthtoken ${auths.zoho_books.oauth_access_token}`
  },
  data: {
    customer_id: params.customer_id,
    payment_mode: params.payment_mode,
    amount: params.amount,
    date: params.date,
    reference_number: params.reference_number,
    description: params.description,
    invoices: params.invoices,
    exchange_rate: params.exchange_rate,
    bank_charges: params.bank_charges,
    custom_fields: params.custom_fields,
    invoice_id: params.invoice_id,
    amount_applied: params.amount_applied,
    tax_amount_withheld: params.tax_amount_withheld,
    account_id: params.account_id
  }
});