Create a Return for Credit Without Validation of the Card Refund Against the Original Transaction

If you are using the contract-based REST API to integrate MYOB Acumatica with an external system, this external system can create refunds of credit card payments without validation against the original transactions.

You can verify whether the original transaction number specified for a refund is related to the payment made. You can do this in one of the following ways:

  • On the Processing Centers (CA205000) form, select the Allow Unlinked Refunds check box for the payment method's default processing center.
  • On the Order Types (SO201000) form, clear the Validate Card Refunds Against Original Transactions check box for the sales order type that is used to create a refund.
  • In a contract-based REST API request, set the ValidateCCRefundOrigTransaction value of the SalesOrderPayment entity to false.

Testing of the Request

Before you test the code below, you do the following to configure your client application and the MYOB Acumatica instance to be used:

  1. Deploy a new MYOB Acumatica instance with the SalesDemo dataset. For details on deploying an instance, see To Deploy an MYOB Acumatica Instance.
  2. If you use Postman as the client application for testing, in the IntegrationDevelopmentGuide.postman_collection.json collection (which is located in the IntegrationDevelopment\Help folder of the Help-and-Training-Examples repository on GitHub), make sure the collection variables have the proper values.
  3. To sign in to the instance in the client application, use the tenant name (which you specified when you created the instance) and the PRODWHOLE branch.

Request

You can use the following example of an HTTP request to make a refund. In this request, you will do the following:

  • Set Date to today's date
  • Set Hold to false
  • In Details, specify the inventory items for which the refund must be made
  • Set Payments.Refund to true
  • Specify the Payments.OrigTransactionNbr, Payments.CardAccountNbr, and Payments.CashAccount values from the information of a payment that is not related to the inventory items from Details
  • Set Payments.DocType to Refund

If you run the following example of an HTTP request with Payments.ValidateCCRefundOrigTransaction set to true, the system will generate an error that indicates that the return for credit to be created has no items that were paid with the transaction specified as the original.

Tip: In the request example below, <MYOB Acumatica instance URL> is the URL of the MYOB Acumatica instance (such as https://my.acumatica.com/MyInstance). You can omit the instance name in the URL (that is, you can use https://my.acumatica.com) if the instance is installed in the root of the website.
PUT ?$expand=Details,Payments HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/SalesOrder
Accept: application/json
Content-Type: application/json

{
    "CurrencyID": { "value": "USD" },
    "CustomerID": { "value": "WIDGETCC" },
    "Date": { "value": "2021-07-29T00:00:00+03:00" },
    "Hold": { "value": false },
    "Details": [
        {
            "Branch": { "value": "PRODWHOLE" },
            "InventoryID": { "value": "AACOMPUT01" },
            "OrderQty": { "value": 5 },
            "UnitPrice": { "value": 500 },
            "UOM": { "value": "EA" },
            "WarehouseID": { "value": "WHOLESALE" }
         }
    ],
    "OrderType": { "value": "RC" },
    "PaymentMethod": { "value": "CCAUTHNET" },
    "Payments": [
        {
            "ApplicationDate": { "value": "2021-07-29T00:00:00+03:00" },
            "AppliedToOrder": { "value": 40 },
            "CardAccountNbr": { "value": "VISA:****-****-****-1111" },
            "CashAccount": { "value": "10600" },
            "Currency": { "value": "USD" },
            "DocType": { "value": "Refund" },
            "Hold": { "value": false },
            "OrigTransactionNbr": { "value": "60170494402" },
            "PaymentAmount": { "value": 40 },
            "PaymentMethod": { "value": "CCAUTHNET" },
            "PaymentRef": { "value": "601704533664" },
            "ProcessingCenterID": { "value": "AUTHNETAPI" },
            "Refund": { "value": true },
            "ValidateCCRefundOrigTransaction": { "value": true }
        }
    ]
}

If you change the Payments/ValidateCCRefundOrigTransaction value to false, the request will be executed successfully.