ANS-1644 · SUITESCRIPT DEVELOPMENT
Scripting NetSuite Payments: Adapting to Payment Instruments
Learn how to update existing NetSuite scripts to correctly process credit card payments when the Payment Instruments feature is enabled, preventing payment event discrepancies.
Short answer
When NetSuite Payment Instruments is enabled, scripts must use the 'paymentinstruments' sublist instead of 'creditcard' to retrieve payment details. Set the 'paymentoption' field to the payment instrument's ID and ensure the payment event trigger field (e.g., 'chargeit') is set to 'T' to ensure actual credit card charges occur.
Scenario
After enabling NetSuite's Payment Instruments and Payment Link features, organizations with customized payment creation processes, particularly those involving scheduled scripts, may encounter issues. Scripts designed for older payment methods might fail to create payment events, leading to situations where payments are recorded in NetSuite but the actual credit card transactions do not occur, resulting in missing funds.
Solution
To ensure scripts function correctly with NetSuite Payment Instruments, the following adjustments are required:
When reading credit card information from a customer record, use the 'paymentinstruments' sublist instead of the deprecated 'creditcard' sublist. For SuiteScript 2.x, this involves using:
record.getSublistValue('paymentinstruments', ...)When setting the payment option for a transaction, assign the value of the payment instrument's 'id' field to the 'paymentoption' field. This differs from the previous approach where 'paymentmethod' was used for generic types like VISA or cheque.
Ensure that the relevant field responsible for triggering payment events (which may be named 'chargeit' or similar, depending on NetSuite version and configuration) is set to 'T'. Failure to do so will prevent the creation of payment events, meaning the credit card will not actually be charged.
Any existing SuiteScript code attempting to read or reference the 'paymentmethod' field will need to be updated to read the 'paymentoption' field instead.
These adjustments are crucial for ensuring that payments processed via script correctly generate payment events and complete the financial transaction when Payment Instruments is active.
Expert NetSuite Support
Need help with this NetSuite issue?
SuiteScript Development consulting and configuration support
