***

title: Run a sale
icon: money-check
intro: Run a sale with a single-use token.
published: true
---------------------

For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.payroc.com/essentials-guides/hosted-fields/llms.txt. For full documentation content, see https://docs.payroc.com/essentials-guides/hosted-fields/llms-full.txt.

After a customer enters their payment details into Hosted Fields, we tokenize them and return a single-use token. To run a sale, use the single-use token with our API.

The API method that you need to use depends on the payment type that the single-use token represents, for example, card details or bank account details.

## Before you begin

### Single-use token

Make sure that your integration can handle submissionSuccess events to receive a single-use token when a customer submits their payment details.

### Headers

To create the header of each POST request, you must include the following parameters:

* **Content-Type:** Include application/json as the value for this parameter.
* **Authorization:** Include your Bearer token in this parameter.
* **Idempotency-Key:** Include a UUID v4 to make the request idempotent.

```curl
-H "Content-Type: application/json"
-H "Authorization: <Bearer token>"
-H "Idempotency-Key: <UUID v4>"
```

### Errors

Make sure that your integration can handle errors. If a request is unsuccessful, we return an error that follows the [RFC 7807 format](https://www.rfc-editor.org/rfc/rfc7807). For more information about errors, go to [Errors](/api/errors).

## Integration steps

The method that you need to use to run the sale depends on the customer's payment type:

* If the single-use token represents card details, go to [Run a sale with card details](/guides/take-payments/hosted-fields/run-a-sale#run-a-sale-with-card-details).
* If the single-use token represents ACH or PAD details, go to [Run a sale with bank account details](/guides/take-payments/hosted-fields/run-a-sale#run-a-sale-with-bank-account-details).

## Run a sale with card details

To run a sale with card details, send a POST request to our Payments endpoint.

| Endpoint   | Prefix     | URL                                                                              |
| :--------- | :--------- | :------------------------------------------------------------------------------- |
| Test       | `api.uat.` | [https://api.uat.payroc.com/v1/payments](https://api.uat.payroc.com/v1/payments) |
| Production | `api.`     | [https://api.payroc.com/v1/payments](https://api.payroc.com/v1/payments)         |

### Request parameters

<Warning>
  **Important:** The request includes parameters for functions and features that we don't cover in this guide. These functions and features might require additional integration effort and cost. For more information, contact our Integrations Team at [integrationsupport@payroc.com](mailto:integrationsupport@payroc.com).
</Warning>

For the paymentMethod object, send values for the following parameters:

* **type:** Send a value of `singleUseToken`.
* **token:** Send the single-use token that you received in the submissionSuccess event.

<EndpointSchemaSnippet endpoint="POST /payments" selector="request.body" />

### Example request

<EndpointRequestSnippet endpoint="POST /payments" />

### Response fields

If your request is successful, our gateway uses the card details to run a sale. The response contains the following fields:

<EndpointSchemaSnippet endpoint="POST /payments" selector="response.body" />

### Example response

<EndpointResponseSnippet endpoint="POST /payments" />

## Run a sale with bank account details

To run a sale with bank account details, send a POST request to our Bank Transfer Payments endpoint.

| Endpoint   | Prefix     | URL                                                                                                          |
| :--------- | :--------- | :----------------------------------------------------------------------------------------------------------- |
| Test       | `api.uat.` | [https://api.uat.payroc.com/v1/bank-transfer-payments](https://api.uat.payroc.com/v1/bank-transfer-payments) |
| Production | `api.`     | [https://api.payroc.com/v1/bank-transfer-payments](https://api.payroc.com/v1/bank-transfer-payments)         |

### Request parameters

<Warning>
  **Important:** The request includes parameters for functions and features that we don't cover in this guide. These functions and features might require additional integration effort and cost. For more information, contact our Integrations Team at [integrationsupport@payroc.com](mailto:integrationsupport@payroc.com).
</Warning>

For the paymentMethod object, send values for the following parameters:

* **type:** Send a value of `singleUseToken`.
* **token:** Send the single-use token that you received in the submissionSuccess event.
* **accountType:** Indicate if the bank account is a savings account or a checking account.
* **secCode:** If the single-use token represents ACH details, indicate how the customer authorized the payment.

<EndpointSchemaSnippet endpoint="POST /bank-transfer-payments" selector="request.body" />

### Example request

<EndpointRequestSnippet endpoint="POST /bank-transfer-payments" />

### Response fields

If your request is successful, our gateway uses the bank account details to run a sale. The response contains the following fields:

<EndpointSchemaSnippet endpoint="POST /bank-transfer-payments" selector="response.body" />

### Example response

<EndpointResponseSnippet endpoint="POST /bank-transfer-payments" />