Create a Sales Order with a 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 sales orders with credit
card payments in a single API call. For details about the creation of sales orders,
see Reserving Payments for Sales Orders.
Note:
A sales order
is created with a payment in one transaction. If a payment cannot be created,
the sales order will not be created either.
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:
- 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.
- On the Enable/Disable Features (CS100000) form, make sure the Inventory and Order Management feature is enabled.
- 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.
- 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 a sales order with a credit card payment. The status of the successfully created payment for the sales order is Pending Processing and the payment reference is empty because no credit card payment has been authorized or captured.
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
{
"CustomerID": {"value": "WIDGETCC"},
"Date": {"value": "2020-05-10T00:00:00"},
"Description": {"value": "Internal CC Payment"},
"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": "2020-08-11T00:00:00+03:00"},
"AppliedToOrder": {"value": 480.00},
"CashAccount": {"value": "10600"},
"PaymentAmount": {"value": 980.00},
"PaymentMethod": {"value": "CCAUTHNET"} }
],
"RequestedOn": {"value": "2020-05-10T00:00:00"}
}