Payment & Prepayment deletion through the custom button from Sales Order

In Sage X3, we are working on payment integration from x3 to the third party payment gateway. Here, we are doing sale/auth/refund/void transactions on the client’s payment gateway through Sales Order/Invoice transactions from X3. Here, we will provide prepayment & payment deletion functionality through the void button.

New Stuff:- How to change the LOT’s expiration date (for multiple sites) in Sage X3

Prepayment & Payment deletion in x3

As per the requirement analysis and the functionality provided, we are creating automated prepayment and payment in x3 on the click of sale button from Sales Order which will create Sale transaction in the payment gateway respectively. After the successful payment & prepayment creation, if the user wants to cancel or refund the transaction created on payment gateway, the adverse effect in x3 will be deleting the payment & prepayment created against the sales order.

Note:This will be only applicable if the respective payment and prepayment against the sales order is not posted in x3.

If the payment is posted for the sales order in x3, then the user need to manually run account cancellation process from the payment entry in x3 to cancel/refund the payment transaction in x3. There are many validations which we need to check while deleting the payment which are as follows:

  • Payment and prepayment should exist for the particular sales order.
  • Sales Order status should not be closed.
  • Payment against the sales order should not been posted.
  • Closing table whichever opened while deleting the payment and prepayment entry to avoid systematic error I.e. “Too many tables opened in x3”

In our analysis, we have found out there are few hurdles coming in the way while deleting the payment which we need to handle through code i.e to set default mask as sales order mask again to avoid different system errors.



The above statement is written to call specific standard delete function from x3.

Delete [ZPYH] where NUM=ZPAYNUM

The above statement is written to delete payment entry from the payment table from x3.

Delete [ZDUD]  where NUM=ZVCRNUM

The above statement is written to delete prepayment entry from the prepayment table from x3.


The above statement is written to call the functions used after the deletion of the payment and prepayment entry from x3.


The above statement is written to call the functions used after the deletion of the payment and prepayment entry from x3.

Note: We need to handle any system error occurred during the customization of deletion of payment and prepayment entry against the sales order/invoice screen. Supposedly if we are opening masks or tables opened for our process then we need to close the tables and masks to avoid any type of crashing/error in Sales order/delivery/invoice transactions.

We can also provide the same functionality from sales delivery and invoice as well, whenever the user delete/close the sales order and the payment with prepayment is created (payment not posted)


Here, we are having the advantages :-

  • We don’t have to manually delete the payment & prepayment entries or run any account cancellation document from payment entry
  • All the functionalities runs from a single click from custom button to delete/cancel/refund transaction from Sales order/delivery/invoice.

This blog is used for understanding the process of deletion of payment and prepayment from Sales Order through code before payment posting and without effecting standard functionalities or crashing the screen. This blog’s functionality will provide users to delete payment and prepayment through sales order/delivery/invoice screen from a single click whenever the user want to cancel/delete/refund any sale transactions.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partner is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation competence.

Greytrix caters to a wide range of Sage X3, a Sage Business Cloud Solution, offerings. Our unique GUMU™ integrations include Sage X3 for Sage, Dynamics 365 CRM and Magento eCommerce along with Implementation and Technical Support worldwide for Sage X3. Currently we are Sage X3 Implementation Partner in East Africa, Middle East, Australia, Asia, US, UK. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight  and Letter of Credit and India Legislation for Sage X3 to Sage business partners, end users and Sage PSG worldwide.

Greytrix is a recognized Sage champion ISV Partner for GUMU™ Sage X3 – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage X3 – Salesforce is a 5-star rated app listed on Salesforce AppExchange and GUMU™ integration for Dynamics 365 CRM – Sage ERP listed on Microsoft AppSource.

For more information on Sage X3 Integration and Services, please contact us at, We will like to hear from you.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert