This article describes the steps needed in order to make a real-time payment against an existing E-Pay account.
NOTE:
This differs from the CreatePaymentAccountTransaction method in the Customer web service in that the transaction will be processed real-time, rather than wait for the daily Account Posting job to run.
Steps
Get E-Pay Account ID
There are two different methods available in order to get the ID of the existing e-pay account that the payment will be charged against:
Query the PaymentAccount OData – Query the PaymentAccount OData while filtering on the CustomerID of the customer to whom the account belongs.
Perform a customer lookup – Perform a CustomerLookUp operation in the Customer web service for the customer to whom the account belongs. In the request for this operation, a response group for payment accounts will have to be specified for them to be returned.
Issue Charge Request
Execute the ChargeAccount operation using the e-pay account ID obtained in step 1. Under the hood this will look up the payment account, create and process a transaction at the payment gateway (based on configuration), and return a response from the gateway along with the CostGuard E-Pay transaction ID.
Example:
POST /api/epayaccount({id})/chargeaccountRequest body:
{ "amount": 10.03, "bankProcessingType": "PPD", "transactionDescriptionID": 4, "transactionSource": "Online", "transactionType": "Credit" }Response:
{ "amount": 10.03, "approvalCode": "123", "approvalDate": "2016-09-09T13: 35: 09.1568626-04: 00", "bankProcessingType": "PPD", "epayAccountID": 42, "epayTransactionID": 1, "errorCode": "12", "errorMessage": "Transaction was declined.", "processDate": "2016-09-09T13: 35: 09.1568626-04: 00", "providerAVSResultCode": "777A7", "providerResultCode": "Accepted", "providerTransactionID": "123C45", "transactionDescriptionID": 4, "transactionSource": "Online", "transactionStatus": "Sent", "transactionType": "Credit" }