# Process Payment

## zapiProcessCartWithPayment

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

#### Request Body

| Name                                                | Type    | Description                                                                                                                                                                   |
| --------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| zapiToken<mark style="color:red;">\*</mark>         | integer | Token that must be used for a reseller to communicate with the supplier system.                                                                                               |
| cartId<mark style="color:red;">\*</mark>            | integer | The ID of the cart which the transaction is to be applied to.                                                                                                                 |
| 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.                                                                                                                                             |
| paymentMethodType<mark style="color:red;">\*</mark> | integer | See Payment Method Type IDs in the appendix.                                                                                                                                  |
| location<mark style="color:red;">\*</mark>          | object  | Object describing where this transaction took place, required for logging                                                                                                     |
| deviceData<mark style="color:red;">\*</mark>        | string  | Data from the device payment is being processed on.                                                                                                                           |
| creditCardDetails<mark style="color:red;">\*</mark> | object  | Object containing either standard credit card info. Required only for payment type 2000.                                                                                      |
| gratuityDetails                                     | object  | Object containing amount and type of gratuity to add to transaction/booking.                                                                                                  |
| voucherDetails                                      | object  | Object containing information pertaining to the voucher. Required only for payment type 2004.                                                                                 |
| transactionType<mark style="color:red;">\*</mark>   | integer | See Payment Method Type IDs in the appendix.                                                                                                                                  |
| 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). |
| currency/isoCode<mark style="color:red;">\*</mark>  | string  | Currency in which to charge to the provided payment method.                                                                                                                   |

{% tabs %}
{% tab title="200: OK " %}

```xml
<?xml version="1.0" encoding="utf-8"?>
<response>
    <zapiVersion>2.1</zapiVersion>
    <error>0</error>
    <message>OK</message>
    <methodResponse>
        <methodName>zapiProcessCartWithPayment</methodName>
        <methodErrorCode>0</methodErrorCode>
        <methodErrorMessage>Booking Processed</methodErrorMessage>
        <bookingInformation>
            <bookingId>40245</bookingId>
            <bookingReference>3QX932R</bookingReference>
            <bookingMessage>
                <![CDATA[Client booking has been created.]]>
            </bookingMessage>
        </bookingInformation>
        <transactionResult>
            <transactionErrorCode>0</transactionErrorCode>
            <bookingId>40245</bookingId>
            <bookingReference>3QX932R</bookingReference>
            <transactionId>99783</transactionId>
            <transactionAmount>0</transactionAmount>
            <transactionMethod>2002</transactionMethod>
            <bookingMessage>
                <![CDATA[Client booking has been created.]]>
            </bookingMessage>
        </transactionResult>
    </methodResponse>
</response>
```

{% endtab %}
{% endtabs %}

For information on payment types, please see Payment Method Type IDs in the appendix.&#x20;

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

```xml
<request>
	<zapiToken></zapiToken>
	<zapiAccountId></zapiAccountId>
	<zapiUserId></zapiUserId>
	<zapiMethod>
		<methodName>zapiProcessCartWithPayment</methodName>
		<location>
		        <altitude></altitude>
		        <latitude></latitude>
		        <longitude></longitude>
		        <locationTimestamp></locationTimestamp>
		        <primaryAccountId></primaryAccountId>
		        <secondaryAccountId></secondaryAccountId>
        	</location>
        	<deviceData>
           		<deviceUUID></deviceUUID>
        	</deviceData>
		<cartId></cartId>
		<paymentMethod>
			<paymentMethodType></paymentMethodType>
		</paymentMethod>
		<transactionDetails>
            			<transactionType></transactionType>
            			<transactionAmount></transactionAmount>
            		<currency>
                		<isoCode></isoCode>
            		</currency>
			<creditCardDetails>
				<nameOnCard></nameOnCard>
				<number></number>
				<expMonth></expMonth>
				<expYear></expYear>
				<csv></csv>
				<cartType></cardType>
				<rawSwipeData></rawSwipeData>
				<track1Data></track1Data>
				<track2Data></track2Data>
			</creditCardDetails>
			<gratuityDetails>
                		<gratuityId>0</gratuityId>
                		<gratuityTypeId>0</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>zapiProcessCartWithPayment</methodName>
        <methodErrorCode></methodErrorCode>
        <methodErrorMessage></methodErrorMessage>
        <bookingInformation>
            <bookingId></bookingId>
            <bookingReference></bookingReference>
            <bookingMessage></bookingMessage>
        </bookingInformation>
        <transactionResult>
            <transactionErrorCode></transactionErrorCode>
            <bookingId></bookingId>
            <bookingReference></bookingReference>
            <transactionId></transactionId>
            <transactionAmount></transactionAmount>
            <transactionMethod></transactionMethod>
            <bookingMessage></bookingMessage>
        </transactionResult>
    </methodResponse>
</response>
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
