PSBlog005
"Create A payment for invoice $ReferenceNbr" | |
$body = @" | |
{ | |
`"Type`": {`"value`": `"Payment`"}, | |
`"CustomerID`": {`"value`": `"$CustomerNbr`"}, | |
`"PaymentMethod`": {`"value`": `"$PaymentMethod`"}, | |
`"PaymentAmount`": {`"value`": $UnitPrice}, | |
`"DocumentsToApply`": [{`"ReferenceNbr`": {`"value`": `"$ReferenceNbr`"}}] | |
} | |
"@ | |
$HashArguments = @{ | |
Uri = "$AcumaticaEndPoint/entity/default/18.200.001/Payment" | |
Method = 'PUT' | |
Headers = $headers | |
Body = $body | |
WebSession = $WebSession | |
} | |
$response = Invoke-RestMethod @HashArguments | |
$PaymentAsPSObject = $response | ConvertTo-Json | ConvertFrom-Json | |
$PaymentEntityID = $PaymentAsPSObject.id | |
"Capturing CC Payment for Invoice $ReferenceNbr on EntityID $PaymentEntityID" | |
$body = @" | |
{ | |
`"entity`": | |
{ | |
`"id`": `"$PaymentEntityID`" | |
} | |
} | |
"@ | |
$HashArguments = @{ | |
Uri = "$AcumaticaEndPoint/entity/default/18.200.001/Payment/CaptureCreditCardPayment" | |
Method = 'POST' | |
Headers = $headers | |
Body = $body | |
WebSession = $WebSession | |
} | |
$response = Invoke-RestMethod -Method 'POST' -Headers $headers -Body $body | |
$response | ConvertTo-Json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment