This page discusses key concepts for integrating with CPN. Understanding these concepts can help you integrate with CPN more effectively.
CPN authenticates your API requests using a unique key associated with your
account. All authentication is performed in the HTTP header of requests to the
API. If a key is not provided, or an incorrect key is provided, the API returns
a 401 - Invalid Credentials
error. All requests must use HTTPS; the API
rejects any requests using plain HTTP.
Circle provides API keys for authentication with the CPN API. These keys are provided manually during onboarding. The following is an example of how to set up the authentication header:
curl --location --request GET 'https://api.circle.com/v1/cpn/payments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_API_KEY}'
For endpoints that create transactions and payments, CPN requires an idempotency key to be included in the request body. The idempotency key must be in the UUID ∂v4 format. This allows the API to identify if a repeated request is unique or duplicate, and prevent unintended duplicate transactions.
To generate an idempotency key, use a UUID generator in your selected programming language. Generated UUIDs can then be passed to the API as idempotency keys.
Quotes are real-time exchange rates and settlement costs for a specific payment corridor. A quote includes the following key elements:
A payment represents the end-to-end CPN payment flow, including the onchain transaction and RFI check. It is initiated by locking in a quote and providing the required recipient details.
The payment process begins when an OFI locks in a quote and submits sender and beneficiary details. The transaction undergoes compliance checks, including the RFI process if required. Once all necessary compliance checks are completed, the payment enters the onchain transaction phase, where it awaits the transfer of USDC. After the crypto transfer is received, the BFI initiates a fiat transfer to the final recipient.
During the fiat transfer, the CPN sends webhook notifications to the OFI indicating that the transfer has been confirmed or canceled. If the fiat transfer is canceled or fails for any reason, the BFI issues a refund of crypto to the OFI.
When a BFI needs more information about a sender or an OFI, they create a Request for Information (RFI). This additional information is required to meet regulatory or risk compliance checks. The OFI is required to gather the appropriate information and respond to the request in a set period of time. If the OFI does not respond in time, the payment associated with the RFI is cancelled.
CPN defines 3 levels of RFI requests, each with a specific set of fields. The OFI is expected to include all fields specified by the level when responding to the RFI. Failure to provide the appropriate fields can lead to payment failure.
The BFI can initiate an RFI at the following points of the payment process:
Depending on the point in the process where the RFI is created, the OFI may be notified synchronously in an API response, or asynchronously by webhook. RFIs are typically resolved by returning the relevant information through the API. RFIs can also be raised and resolved through direct support tickets with CPN.
A transaction in the CPN API represents a transfer of funds onchain to fund the
payment. Once payment is in the CRYPTO_FUNDS_PENDING
status, the OFI should
create the onchain transaction using CPN's transaction endpoints. Through these
endpoints, the OFI can initiate and broadcast the transaction. The OFI uses its
own wallet integration to sign transactions before sending them to the API. CPN
provides transaction updates through webhooks. Transactions follow these steps: