Skip to main content

Introduction to QR Payment Webhooks

Ripio provides webhook notifications to keep your application informed about real-time status updates for QR Payments. These events cover the process of converting cryptocurrency to fiat currency and completing QR code payments to merchants. Similar to On-Ramp and Off-Ramp events, QR Payment webhooks are sent as POST requests with a JSON payload to your configured endpoint. It is crucial to validate the signature of every incoming webhook request as detailed in the Webhooks Introduction.

Event Payload Structure

Each QR Payment event notification message contains a JSON-formatted payload with the following general structure:
  • eventType (String): The specific type of QR Payment event that occurred.
  • issueDatetime (String): The Coordinated Universal Time (UTC) timestamp indicating when the event was triggered (e.g., "2024-04-25T18:22:37Z").
  • transaction (Object): An object containing details of the QR Payment associated with the event.

QR Payment Event Types

The following event types are supported for QR Payments:

SELL_AND_PAY.DEPOSIT.RECEIVED

  • Description: Sent after Ripio successfully received a cryptocurrency deposit to the address associated with the QR Payment. This indicates that the crypto deposit has been detected on the blockchain.
  • transaction typically includes: QR Payment fields (see below), including details of the crypto deposit.

SELL_AND_PAY.DEPOSIT.BLOCKED

  • Description: Sent when the cryptocurrency deposit has been blocked. This can occur due to compliance issues, suspicious activity, or other security reasons. The deposit will not be processed and may be subject to review.
  • transaction typically includes: QR Payment fields.

SELL_AND_PAY.PAYMENT_ORDER.COMPLETED

  • Description: Sent after the QR code payment to the merchant has been successfully completed. This indicates that the cryptocurrency has been converted to fiat currency and the payment order has been processed to the merchant.
  • transaction typically includes: QR Payment fields, including payment confirmation details in the paymentOrder object.

SELL_AND_PAY.DEPOSIT_WITHOUT_SELL_AND_PAY.REFUND_PROCESSING

  • Description: Sent when a cryptocurrency deposit is received that is not associated with any existing QR Payment. This triggers a refund process to return the cryptocurrency to the sender. Note: This event does NOT contain a full QR Payment object.
  • transaction structure: This event has a special structure containing only cryptoDeposit (the deposit information) and refundTxnHash (the refund transaction hash). See the special transaction object section below for details.

SELL_AND_PAY.DEPOSIT.REFUND_PROCESSING

  • Description: Sent when a refund of the cryptocurrency deposit is being processed for a QR Payment. This can occur if the transaction was cancelled, failed, or if the deposit was blocked. The cryptocurrency will be returned to the customer’s refund address.
  • transaction typically includes: QR Payment fields with refund processing details.

Transaction Object Fields for QR Payment Events

The transaction object for QR Payment events includes the following fields (matching the SellAndPayWebhookSerializer structure):
  • id (String): Unique identifier for the QR Payment.
  • createdAt (String): Date and time the QR Payment was created (UTC format).
  • expiresAt (String): Date and time when the transaction will expire (UTC format).
  • customerId (String): Unique identifier of the customer associated with the transaction.
  • trade (Object, nullable): Trade execution details containing information about the crypto-to-fiat conversion. Will be null if the trade has not been executed yet. See SellAndPayTrade schema for structure.
  • paymentOrder (Object, nullable): Payment order details for the QR code payment to the merchant. Will be null if the payment order has not been created yet. See SellAndPayPaymentOrder schema for structure.
  • amount (String): Payment amount in fiat currency to be paid to the merchant.
  • cryptoAmount (String): The amount of cryptocurrency required/deposited.
  • paymentCurrency (String): The fiat currency used for the QR code payment to the merchant (e.g., “ARS”, “BRL”).
  • depositCurrency (String): The cryptocurrency deposited by the customer (e.g., “USDC”, “BTC”).
  • depositNetwork (String): The blockchain network used for the cryptocurrency deposit (e.g., “ETHEREUM”, “POLYGON”).
  • depositAddress (String): The cryptocurrency address where the deposit was made.
  • status (String): The current status of the QR Payment (e.g., “CONFIRMED_DEPOSIT”, “COMPLETED”, “REFUNDED”).
  • cryptoDeposit (Object, nullable): Information about the cryptocurrency deposit made by the customer. Will be null until a deposit is detected on the blockchain. See SellAndPayCryptoDeposit schema for structure.
  • refundTxnHash (String, nullable): Transaction hash for the refund transaction on the blockchain. Present when a refund has been processed.

Special Transaction Object for SELL_AND_PAY.DEPOSIT_WITHOUT_SELL_AND_PAY.REFUND_PROCESSING

This event has a different transaction structure with only the following fields:
  • cryptoDeposit (Object): Information about the cryptocurrency deposit that was received without an associated QR Payment. See SellAndPayCryptoDeposit schema for structure.
  • refundTxnHash (String, nullable): Transaction hash for the refund transaction on the blockchain. Will be present once the refund is processed.
Note: The exact fields and their presence might vary slightly depending on the transaction state. Always inspect the payload of received webhooks.

QR Payment Event Flows

The following sequences illustrate the expected order of events in common QR Payment scenarios. Your system should be prepared to handle webhooks that might arrive out of the typical order due to network conditions or other factors.
  1. Standard Successful QR Payment Flow: SELL_AND_PAY.DEPOSIT.RECEIVED → SELL_AND_PAY.PAYMENT_ORDER.COMPLETED
    • Description: This is the usual flow for a successful QR Payment, starting from the receipt of a cryptocurrency deposit, followed by the completion of the QR code payment to the merchant.
  2. Deposit Blocked Flow: SELL_AND_PAY.DEPOSIT.BLOCKED → SELL_AND_PAY.DEPOSIT.REFUND_PROCESSING
    • Description: In this scenario, the cryptocurrency deposit is blocked due to compliance or security reasons, and subsequently a refund is processed to return the cryptocurrency to the customer.
  3. Transaction Cancellation and Refund Flow: SELL_AND_PAY.DEPOSIT.RECEIVED → SELL_AND_PAY.DEPOSIT.REFUND_PROCESSING
    • Description: After a deposit is received, the transaction may be cancelled (e.g., due to payment processing failure, customer request, or timeout), leading to a refund of the cryptocurrency deposit.
  4. Deposit Without QR Payment Flow: SELL_AND_PAY.DEPOSIT_WITHOUT_SELL_AND_PAY.REFUND_PROCESSING
    • Description: This event is triggered when a cryptocurrency deposit is received at a QR Payment deposit address but there is no associated transaction. The system automatically processes a refund to return the cryptocurrency to the sender.

Important Considerations

  • Idempotency: Your webhook endpoint should be designed to handle duplicate webhook deliveries gracefully. Use the transactionId and eventType to identify and deduplicate events if necessary.
  • Signature Validation: Always validate the webhook signature to ensure the request is genuinely from Ripio. See the Webhooks Introduction for details on signature validation.
  • Asynchronous Processing: Process webhooks asynchronously to avoid blocking your webhook endpoint and to ensure timely responses to Ripio’s servers.
  • Error Handling: Implement robust error handling and logging for your webhook processing logic to debug issues effectively.
  • Event Order: While events generally follow the flows described above, your system should not strictly depend on receiving events in a specific order. Design your logic to handle events arriving out of sequence.

Example Webhook Payloads

Example 1: SELL_AND_PAY.PAYMENT_ORDER.COMPLETED

Standard QR Payment completed successfully:

Example 2: SELL_AND_PAY.DEPOSIT_WITHOUT_SELL_AND_PAY.REFUND_PROCESSING

Deposit received without an associated transaction (special structure):
For more information on configuring webhooks and validating signatures, please refer to the Webhooks Introduction.