Create a Sales Order with an Authorized 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:
- 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 in one call a sales order with an internal credit card payment that will be authorized. To authorize a payment, you set the Authorize parameter of the payment to true. The operation you create by using this call is asynchronous.
PaymentRef
field of the payment contains the payment reference
of the authorized credit card payment.<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"},
"Authorize": {"value": true}
}
],
"RequestedOn": {"value": "2022-05-10T00:00:00"}
}