LogoLogo
  • GENERAL
    • Introduction
    • Overview
    • Authentification
    • ENUM description
  • ACQUIRING
    • Customer wallets
    • Invoices
    • Onramp
  • EXCHANGE
    • Crypto exchange
  • PAYOUTS
    • Single Payout
    • Mass Payout
  • WEBHOOKS
    • Overview
    • Types of events
    • Webhook payload
    • Webhook sign check
  • GUIDES
    • General questions
      • What is Calypso Pay?
      • Which blockchains and tokens we support?
    • Calypso UI guides and questions
      • Introduction to Calypso Pay
      • Sandbox mode and limits
      • General
        • How to create new API key
        • How to create an additional account
        • How to add a new asset to account
        • How to add funds to your wallet
        • Protect your withdrawals with additional signatures
        • How to change your top-up address
        • How to use address book
        • How to set up auto currency conversion
        • How to transfer money within Calypso pay
        • Create a webhook
      • Accept Payments via UI
        • How to create an invoice via UI
        • Accept Payments FAQ
      • Make Payments via UI
        • How to create a single payout via UI
        • How to create mass payout via UI
        • Make Payments FAQ
      • Make Exchanges via UI
        • How to exchange one crypto asset to the other
      • Reports
        • How to get reports
        • Report contents description
    • Integration guides and questions
      • Get started with API
      • Use Customer purse via API
        • How create a customer
        • How to get a purse
        • How to get a transaction data
      • Accept Payments via API
        • How to create a Limited Invoice via API
        • How to create a Limited Fiat Invoice via API
        • How to create an Unlimited Invoice via API
        • How to manage interventions via API
        • How to embed invoice data to your payment page
      • Payment widget
        • How to create a limited fiat payment widget via API
        • How to create unlimited payment widget
        • How to embed a payment widget on a web page
      • Make Exchange via API
        • How to create a exchange
        • Get balance information via API
      • Make Payments via API
        • Get balance information via API
        • How to create a single payout via API
        • How to create a mass payout via API
  • API REFERENCE
    • Report API
    • Settlement Payout API
    • Webhook API
    • Payout API
    • Exchange API
    • Fiat API
    • User API
    • Rate API
    • Settlement Wallet API
    • Fiat withdrawal API
    • Account API
    • Currency API
    • Invoice API
    • Settlement Report API
    • Crypto to fiat API
    • Customer Purse API
    • Fiat deposit API
    • Payment Widget API
    • Models
Powered by GitBook
On this page
Export as PDF
  1. GUIDES
  2. Integration guides and questions
  3. Accept Payments via API

How to manage interventions via API

Interventions

This section is only relevant to SINGLE and SINGLE_FIAT invoice types.

There are several scenarios when something can go wrong during your client Invoice payment. Calypso Payment supports following scenarios when you need to intervene into Invoice payment process and manually decide how to proceed.

There are two main types of interventions in Calypso Payment system:

  1. Underpay

If client payed less money than required in the Invoice.

  1. Overpay

If client payed more money than Invoice requires.

  1. To real-time track these scenarios and react to them you can use Calypso Webhook INVOICE_PENDING_INTERVENTION event type.

You can subscribe for this event type using Create Webhook endpoint: POST https://api.calypso.finance/api/v1/subscription/webhook/create

Bash

curl --location --request POST 'https://api.calypso.finance/api/v1/subscription/webhook/create' \
--header 'Key: <your_api_key>' \
--header 'Sign: <your_sign>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "timestamp": 13292792792,
  "account": "0xc195df92dd9db2a8f28e597981f113d6e7582f8b",
  "payload": {
    "notificationEventTypes": [
      "INVOICE_PENDING_INTERVENTION"
    ],
    "requestId": "bf9348b7-2c14-46d7-868c-b597852da319",
    "url": "Your App URL"
  }
}'

After creating a Webhook for INVOICE_PENDING_INTERVENTION event you’ll start receiving incoming requests of a following format in case of an event appearing:

JSON

{
  "requestId": "bf9348b7-2c14-46d7-868c-b597852da319",
  "id": 3,
  "createdDate": "2022-06-17T12:13:05.909616",
  "level": "SUCCESS",
  "service": "INVOICE",
  "eventType": "INVOICE_PENDING_INTERVENTION",
  "data": {
    "parentExternalId": "d9732536-acdd-41bd-87c3-ec40aeeb6a37",
    "message": "Invoice example",
    "type": "INVOICE_PENDING_INTERVENTION",
    "idempotencyKey": "5b0ca8da-6af4-4a1c-9efd-5cbfc19ace09"
  }
}
  1. In case of receiving an incoming request about pending intervention you’ll need to use Get a Specific Invoice endpoint in order to receive detailed information about Invoice and understand your next steps: Get a Specific Invoice (POST https://api.calypso.finance/api/v1/invoice)

You will see changes in the fields:

  • The value of state is PENDING_INTERVENTION

  • The value of interventionType is either OVERPAY or UNDERPAY depending on received amount of money bigger or lower than amount.

  • The value of isInterventionResolved is false.

To resolve this intervention you can withdraw the money to the merchant’s wallet by sending Resolve intervention and receive money to the wallet request (POST https://api.calypso.finance/api/v1/invoice/return-to-paid).

The invoice state changes to PAID and invoice will be completed then.

After invoice became COMPLETED you can mark that intervention was resolved with the client by sending Mark that intervention is resolved in invoice request (POST https://api.calypso.finance/api/v1/invoice/close-intervention).

This request changes the value of field isInterventionResolved to “true”.

PreviousHow to create an Unlimited Invoice via APINextHow to embed invoice data to your payment page

Last updated 3 days ago