# Transactions



Create transactions to buy or sell stablecoins. Transactions require an authenticated user (via JWT token) and process payments through Interac e-Transfer.

## Transaction flow [#transaction-flow]

<Steps>
  <Step>
    ### Get a price quote [#get-a-price-quote]

    Fetch current rates using the [Price Quotes](/v2/api-reference/quotes/getQuotes) endpoint.
  </Step>

  <Step>
    ### Create transaction [#create-transaction]

    Submit the transaction with the quote details.
  </Step>

  <Step>
    ### User sends payment [#user-sends-payment]

    For buy transactions, the user completes the Interac e-Transfer using the reference number.
    For sell transactions, the user sends USDC from the wallet address provided.
  </Step>

  <Step>
    ### Processing [#processing]

    Once payment is received, Paytrie processes the transfer.
  </Step>

  <Step>
    ### Completion [#completion]

    For buy transactions, stablecoins are sent to the user's wallet and the transaction status updates to `complete`.
    For sell transactions, CAD is sent to the user's e-Transfer email address and the transaction status updates to `complete`.
  </Step>
</Steps>

## Create a transaction [#create-a-transaction]

```bash
curl -X POST "https://api.paytrie.com/v2/transactions" \
  -H "x-api-key: your-api-key" \
  -H "Authorization: Bearer user-jwt-token" \
  -H "Content-Type: application/json" \
  -d '{
    "leftSideLabel": "CAD",
    "leftSideValue": 1000,
    "rightSideLabel": "USDC-ETH",
    "wallet": "0x742d35Cc6634C0532925a3b844Bc9e7595f8bC3a",
    "quoteId": 337362
  }'
```

The response includes the transaction ID and Interac reference:

```json
{
  "success": true,
  "data": {
    "id": "3943bb00-1551-4f1d-bf32-2d82608bc15e",
    "date": "2025-07-25T14:02:36.000Z",
    "coin": "USDC",
    "leftSideLabel": "CAD",
    "leftSideValue": 1000,
    "rightSideLabel": "USDC-ETH",
    "rightSideValue": 725.35,
    "status": "complete",
    "wallet": "0x742d35Cc6634C0532925a3b844Bc9e7595f8bC3a",
    "paymentType": "interac",
    "paymentId": "pay_123456789",
    "rmtId": "CA1MRUaaErpx",
    "depositAddress": null
  }
}
```

<Callout type="info">
  For buy transactions, the user must complete the Interac e-Transfer using the `rmtId` reference number before the transaction can be processed.
</Callout>

<Card title="API Reference: Create Transaction for authenticated user" href="/v2/api-reference/transactions/createTransaction" icon="arrow-right-left">
  View complete request parameters and response schema
</Card>

## Get transaction details [#get-transaction-details]

```bash
curl "https://api.paytrie.com/v2/transactions/3943bb00-1551-4f1d-bf32-2d82608bc15e" \
  -H "x-api-key: your-api-key" \
  -H "Authorization: Bearer user-jwt-token"
```

<Card title="API Reference: Get Transaction by id" href="/v2/api-reference/transactions/getTransaction" icon="arrow-right-left">
  View complete request parameters and response schema
</Card>

## Transaction statuses [#transaction-statuses]

| Status                    | Description                                          |
| ------------------------- | ---------------------------------------------------- |
| `awaiting-fiat`           | Buy: awaiting the buyer's Interac e-Transfer payment |
| `processing-fiat`         | Buy: Interac payment received, processing            |
| `finalizing-fiat`         | Buy: finalizing the fiat payment                     |
| `sending-crypto`          | Buy: sending the stablecoin to the buyer's wallet    |
| `awaiting-crypto`         | Sell: awaiting the seller's stablecoin transfer      |
| `sending-fiat`            | Sell: sending CAD to the seller                      |
| `complete`                | Transaction completed successfully                   |
| `cancelled`               | Transaction was cancelled                            |
| `expired`                 | Transaction expired before payment (clean timeout)   |
| `expired-contact-support` | Expired with funds to reconcile — contact support    |
| `refunded`                | Transaction was refunded                             |
| `replaced`                | Transaction was replaced                             |

## Webhook notifications [#webhook-notifications]

Set up [Webhooks](/v2/webhooks) to receive real-time notifications when transactions are created or status changes occur.
