Payment Gateway Agent
API Reference
Mercoa’s payment gateway agent enables you to seamlessly detect and take action on opportunities to convert a non-card payment to card spend from an invoice document.
Agent Actions
Mercoa’s payment gateway agent can perform the following actions:
- Validate that an invoice contains a card-supporting payment gateway link
- Process a card payment by running a provided card through the payment gateway
Each action is triggered by the corresponding API endpoint.
Usage
To start using the payment gateway agent, all you need to have is the invoice document or email (PDF or HTML).
Validation
First, upon receiving an invoice, you can trigger a validation job with the invoice document to determine if a card conversion is possible.
Upon successful completion, the result of the validation job will contain the following information:
- The extracted payment gateway link (if found)
- Whether the payment gateway supports card
- The associated card processing fees (if applicable)
- A session replay link to review the agent’s actions
Processing
Once you’ve identified an invoice that supports card spend, you can process the payment triggering a processing job with the invoice document and details of the card to be used for the payment.
We recommend that you provide card details via an iFrame link rather than directly in the request body to avoid exposing sensitive data.
Upon successful completion, the result of the processing job will contain the following information:
- The receipt URL for the payment
- A session replay link to review the agent’s actions
If the agent is unable to process the payment, no funds will be moved and the result will contain a descriptive error message explaining what went wrong.