# 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

<Steps>
  <Step>
    ### Get a price quote

    Fetch current rates using the [Price Quotes](/docs/price-quotes) endpoint.
  </Step>

  <Step>
    ### Create transaction

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

  <Step>
    ### 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

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

  <Step>
    ### 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

```bash
curl -X POST "https://api.paytrie.com/transaction" \
  -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,
    "gasId": 186324
  }'
```

The response includes the transaction ID and Interac reference:

```json
{
  "message": "New transaction created",
  "status": "success",
  "tx": "3943bb00-1551-4f1d-bf32-2d82608bc15e",
  "rmt": "CA7MREh2Hhg4"
}
```

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

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

## Get transaction details

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

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

## Transaction statuses

| Status                              | Description                            |
| ----------------------------------- | -------------------------------------- |
| `pending request money transfer`    | Waiting for Interac e-Transfer payment |
| `processing request money transfer` | Payment received, processing           |
| `finalizing request money transfer` | Finalizing the transaction             |
| `sending USDC-ETH`                  | Sending USDC on Ethereum               |
| `sending USDC-SOL`                  | Sending USDC on Solana                 |
| `sending cad`                       | Sending CAD (for sell transactions)    |
| `waiting for USDC-ETH transfer`     | Waiting for USDC on Ethereum           |
| `waiting for USDC-SOL transfer`     | Waiting for USDC on Solana             |
| `complete`                          | Transaction completed successfully     |
| `cancelled`                         | Transaction was cancelled              |
| `expired`                           | Transaction expired                    |
| `expired - contact support`         | Transaction expired, contact support   |

## Webhook notifications

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