Create a Sales Order with a Captured Credit Card Payment

If you are using the contract-based REST API to integrate MYOB Acumatica with an external system, this external system can create a sales order with payments in a single API call. For details about the creation of sales orders, see Reserving Payments for Sales Orders.

Testing of the Request

Before you test the code below, 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 in the Installation Guide.
  2. On the Enable/Disable Features (CS100000) form, make sure the Inventory and Order Management feature is enabled.
  3. 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.
  4. 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 create in one call a sales order with an internal credit card payment that will be captured. To capture a payment, you set the Capture parameter of the payment to true. The operation you create by this call is asynchronous.

The status of the successfully created payment for the sales order is Open because not full amount of the payment in the example is captured. The PaymentRef field of the payment contains the payment reference of the captured credit card payment.
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=Payments HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/SalesOrder
Accept: application/json
Content-Type: application/json

{
    "CustomerID": {"value": "WIDGETCC"},
    "Date": {"value": "2022-05-10T00:00:00"},
    "Description": {"value": "Internal CC Payment (Capture)"},
    "Details": [
        {
            "Branch": {"value": "PRODWHOLE"},
            "DiscountAmount": {"value": 10.00},
            "ExtendedPrice": {"value": 500.00},
            "FreeItem": {"value": false},
            "InventoryID": {"value": "AACOMPUT01"},
            "OrderQty": {"value": 1.00},
            "UnitPrice": {"value": 500.00},
            "UOM": {"value": "EA"},
            "WarehouseID": {"value": "WHOLESALE"}
        },
        {
            "Branch": {"value": "PRODWHOLE"},
            "DiscountAmount": {"value": 10.00},
            "ExtendedPrice": {"value": 500.00},
            "FreeItem": {"value": false},
            "InventoryID": {"value": "AALEGO500"},
            "OrderQty": {"value": 50.00},
            "UnitPrice": {"value": 50.00},
            "UOM": {"value": "EA"},
            "WarehouseID": {"value": "WHOLESALE"}
        }
    ],
    "Hold": {"value": false},
    "LocationID": {"value": "MAIN"},
    "OrderType": {"value": "SO"},
    "Payments": [
        {
            "ApplicationDate": {"value": "2022-08-11T00:00:00+03:00"},
            "AppliedToOrder": {"value": 480.00},
            "CashAccount": {"value": "10600"},
            "PaymentAmount": {"value": 980.00},
            "PaymentMethod": {"value": "CCAUTHNET"},
            "Capture": {"value": true}
        }
    ],
    "RequestedOn": {"value": "2022-05-10T00:00:00"}
}