> For the complete documentation index, see [llms.txt](https://docs.zaui.com/zapi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zaui.com/zapi/zapi-calls/interacting-with-a-cart/transactions/process-single-transaction.md).

# Process Single Transaction

## zapiProcessSingleTransaction

<mark style="color:blue;">`GET`</mark> `https://{yourdomainname}.zaui.net/zapi/`

In the most basic scenarios, all that is needed is the \`cartId\`, \`transactionType\`, and \`transactionAmount\`. When transacting in Cash or Pay Later, no further info is needed.\
\
Credit Card Transactions\
For credit card transactions the details of the cart being transacted need to be included in the request, this can be done in three ways: \
1\. For most gateways all that is needed, is to provide the card name, number, expiry date, and security code, the rest is handled on the back end with the gateway.\
2\. For Stripe transactions not using Stripe Terminal hardware, Stripes libraries must be used to build Stripe Method Id tokens to return to Zaui. In this case, no other credit card info needs to be sent, just this token.\
3\. For transactions using Stripe Terminal hardware, pass the token generated by the device's SDK to the Stripe Payment Intent parameter. As with above, no additional info is needed when passing this token.\
\
NOTE for Stripe Transactions: The API keys needed to provide the Stripe Libraries/SDK access to your Zaui system's Stripe account can be retrieved using the zapiGetSystemInfo call.

#### Query Parameters

| Name                                                | Type    | Description                                                                                                                                                                   |
| --------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| gratuityDetails                                     | object  | Object containing amount and type of gratuity to add to transaction/booking                                                                                                   |
| creditCardDetails<mark style="color:red;">\*</mark> | object  | Object containing either standard credit card info or Stripe Method Id for credit card transaction. Required only for payment type 2000.                                      |
| currency/isoCode<mark style="color:red;">\*</mark>  | string  | String for the ISO code of the currency being transacted in.                                                                                                                  |
| cartId<mark style="color:red;">\*</mark>            | integer | The ID of the cart which the transaction is to be applied to.                                                                                                                 |
| location<mark style="color:red;">\*</mark>          | object  | Object describing where this transaction took place, required for logging                                                                                                     |
| methodName<mark style="color:red;">\*</mark>        | string  | The method being called.                                                                                                                                                      |
| zapiUserId<mark style="color:red;">\*</mark>        | integer | Generated by the supplier system when a new contact is created.                                                                                                               |
| zapiAccountId<mark style="color:red;">\*</mark>     | integer | Generated by the supplier system.                                                                                                                                             |
| zapiToken<mark style="color:red;">\*</mark>         | integer | Token that must be used for a reseller to communicate with the supplier system.                                                                                               |
| transactionAmount<mark style="color:red;">\*</mark> | integer | Amount to charge to the provided payment method (with no currency formatting). This does not include gratuity amount. This value cannot be 0 (unless payment method is 2003). |
| transactionType<mark style="color:red;">\*</mark>   | integer | See Payment Method Type IDs in the appendix.                                                                                                                                  |
| voucherDetails<mark style="color:red;">\*</mark>    | object  | Object containing information pertaining to the voucher. Required only for payment type 2004.                                                                                 |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{    "name": "Cake's name",    "recipe": "Cake's recipe name",    "cake": "Binary cake"}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
{    "message": "Ain't no cake like that."}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Request" %}

```markup
<request>
   <zapiToken></zapiToken>
   <zapiAccountId></zapiAccountId>
   <zapiUserId></zapiUserId>
   <zapiMethod>
      <methodName>zapiProcessSingleTransaction</methodName>
      <location>
         <altitude></altitude>
         <latitude></latitude>
         <longitude></longitude>
         <locationTimestamp></locationTimestamp>
         <primaryAccountId></primaryAccountId>
         <secondaryAccountId></secondaryAccountId>
      </location>
      <cartId></cartId>
      <transactionDetails>
         <transactionType></transactionType>
         <transactionAmount></transactionAmount>
         <currency>
            <isoCode></isoCode>
         </currency>
         <creditCardDetails>
            <stripePaymentMethodId>pm_STRIPE_METHOD_ID</stripePaymentMethodId>
            <stripePaymentIntentId>pm_STRIPE_INTENT_ID</stripePaymentIntentId>
            <token />
            <nameOnCard></nameOnCard>
            <number></number>
            <expMonth></expMonth>
            <expYear></expYear>
            <csv></csv>
         </creditCardDetails>
         <gratuityDetails>
            <gratuityId></gratuityId>
            <gratuityTypeId></gratuityTypeId>
         </gratuityDetails>
         <voucherDetails>
            <companyName></companyName>
            <companyAgentId></companyAgentId>
            <companyId></companyId>
            <voucherNumber></voucherNumber>
         </voucherDetails>
      </transactionDetails>
   </zapiMethod>
</request>
```

{% endtab %}

{% tab title="Response" %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
	<zapiVersion>2.1</zapiVersion>
	<error>0</error>
	<message>OK</message>
	<methodResponse>
		<methodName>zapiProcessSingleTransaction</methodName>
		<methodErrorCode></methodErrorCode>
		<methodErrorMessage></methodErrorMessage>
		<transactionResult>
			<transactionErrorCode>0</transactionErrorCode>
			<bookingId></bookingId>
			<transactionId></transactionId>
			<transactionAmount></transactionAmount>
			<transactionMethod></transactionMethod>
			<bookingMessage></bookingMessage>
		</transactionResult>
        	<cart>
			<cartId></cartId>
			<customers>
				<customer></customer>
			</customers>
			<activities></activities>
			<products></products>
			<transactions></transactions>
			<remainingBalance>
				<balance></balance>
			</remainingBalance>
			<cartTotals>
				<bookingNumber></bookingNumber>
				<modifyBookingNumber></modifyBookingNumber>
				<activityTotal></activityTotal>
				<activityTax></activityTax>
				<productTotal></productTotal>
				<productTax></productTax>
				<packageTotal></packageTotal>
				<activitySurplusFees></activitySurplusFees>
				<surchargeTotal></surchargeTotal>
				<perPersonTax></perPersonTax>
				<total></total>
				<tax></tax>
				<totalIncludingTax></totalIncludingTax>
			</cartTotals>
       			<currencies>
				<currency>
					<currencyName></currencyName>
					<currencySymbol></currencySymbol>
					<isoCode></isoCode>
					<paymentGatewayId></paymentGatewayId>
					<rateId></rateId>
					<rate></rate>
					<totalConvertedWithRate></totalConvertedWithRate>
				</currency>
			</currencies>
		</cart>
	</methodResponse>
</response>
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zaui.com/zapi/zapi-calls/interacting-with-a-cart/transactions/process-single-transaction.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
