# Postponing Transactions

The postponement mechanism lets you split a transaction into two distinct stages: first, you send the transaction to Hyp Pay to verify the card and hold the request; later, you finalize the transaction to actually charge the customer.

While this may sound similar to [two-phase commits](/pay/advanced-features/two-phase-commits.md), postponing has some unique features that make it a great fit for certain situations.

## Postponing vs two-phase commits

It's easy to confuse postponing with two-phase commits (also known as J5 transactions), but they differ in how they handle card company approvals and transaction amounts:

* **Support for all credit cards**. Unlike J5 transactions, which require pre-approval from the customer's credit card company and may not support all card types, the postponement mechanism works independently of the card issuer. This means it supports all credit cards without any special terminal configuration.
* **Exact amount**. In a J5 flow, you can authorize a certain amount and later charge the customer for that amount or less. With postponing, you must commit the exact amount you initially requested.
* **Shorter window for finalization**. A postponed transaction must be finalized within 72 hours of the initial request, while J5 transactions normally give you more time.

## When to postpone

Postponing is particularly useful in these cases:

* **Universal compatibility**. You need a "hold" feature that works across all card types and terminals.
* **Inventory management**. If you run an online store and want to make sure an item is actually in stock before charging the customer, you can postpone the transaction. This way, you don't have to deal with refunds if you later find out you can't fulfill the order.
* **Protection against duplicate holds**. Customers might accidentally submit duplicate requests if they don't see an immediate confirmation. Postponing acts as a safety net: you can hold all requests and then finalize only one, preventing duplicate charges.

## Postponing a transaction

Performing a postponed transaction involves two steps: initiating the request through the payment page and then finalizing it via the API.

### Step 1: Requesting a postponed transaction

To postpone a transaction, you just need to add the `Postpone=True` parameter to your [payment page request](/pay/getting-started/creating-a-payment-page.md#create-a-payment-page-request). This tells Hyp Pay to verify the card and hold the transaction instead of charging it right away.

Here's an example of a payment page request to postpone a payment:

{% code overflow="wrap" %}

```http
https://pay.hyp.co.il/p/?action=APISign&What=SIGN&KEY=your-api-key&PassP=your-api-password&Masof=0010345518&Amount=10&PageLang=ENG&Postpone=True
```

{% endcode %}

When a customer submits the payment page, Hyp Pay will redirect them back to your site. In the payment completion redirect, `CCode=800` indicates success, meaning the transaction is held and waiting for you to finalize it.

If you're using a [custom error page](/pay/getting-started/prerequisites-and-initial-setup.md#configure-success-and-error-pages), Hyp will redirect the customer to it even though the postponement request was successful. If you've chosen to display errors on the payment page instead of using a custom error page, Hyp Pay will redirect to the success page.

In either case, your page logic should check for `CCode=800` in the redirect URL. If it's there, **display a success message to the customer** confirming that their payment request has been received and will be finalized later.

Make sure to **save the value of the `Id` parameter** from the redirect URL. You'll need this unique transaction ID to finalize the charge in the next step.

### Step 2: Finalizing the transaction

A postponed transaction must be finalized within **72 hours** of the initial request. If you decide not to go through with the payment, you can simply leave the transaction in its `800` status, and it won't be charged.

When you're ready to finalize the payment, send a GET request with the `commitTrans` action. You'll need the transaction ID (the `Id` value you saved from the redirect, passed as `TransId`), your terminal number (`Masof`), and your API password (`PassP`).

Here's an example API request to finalize a postponed transaction:

{% code overflow="wrap" %}

```http
https://pay.hyp.co.il/p/?action=commitTrans&Masof=0010345518&TransId=403377225&PassP=your-api-password
```

{% endcode %}

A successful finalize request will return a response like this:

```http
Id=404011214&CCode=0&Fild1=&Fild2=&Fild3=&HeshASM=EZ
```

In this response, `CCode=0` indicates success. At this point, the customer is charged and the transaction is finalized.


---

# 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://developers.hyp.co.il/pay/common-use-cases/postponing-transactions.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.
