Introduction

This guide helps developers easily incorporate features for processing crypto payments
into their online storefronts. The Digital Crypto Pay REST API provides a seamless user
experience and gives merchants a safe and effective way to accept payments in various
cryptocurrencies.

This documentation equips you with the knowledge to:

    Authenticate and secure your API requests.

    Create purchase orders with detailed configuration options.

    Understand the structure of callback responses for purchase status updates.

    Before integrating, we advise you to go through this guide to become acquainted with the
    features and parameters accessible for the API.

    Authentication

    The Digital Crypto Pay REST API for merchants uses API keys combined with signatures to
    authenticate requests. Each merchant will receive a combination of an API key and an API
    secret, which they will then use to authenticate API requests.

    Signature

    The signature is generated using the HMAC-SHA256 algorithm. It combines the request
    body, a timestamp, and the API_SECRET (provided to the merchant) into a single string.
    This string is then hashed using SHA-256. The timestamp is also included in the request as
    a separate header.
    Below is a code snippet for generating signature used in Digital Crypto Pay REST APIs

    Creating purchases

    Purchases can only be created by merchants using API key and signature authentication. Upon
    successful purchase creation, the response will include a URL that the user needs to open to
    continue the payment flow. The merchant will be notified of any status changes for the created
    purchase via webhooks.

    URL: /v1/api/purchase/init

    METHOD: POST

    HEADERS:

    X-API-KEY: string
    X-SIGNATURE: string
    TIMESTAMP: string

    BODY:

    RESPONSE:

    Headers

    Request must have headers for merchant authentication.

    Header

    Description

    X-API-KEYAPI key provided by Digital Crypto Pay, used for Merchant identification
    X-SIGNATURECryptographic signature for authenticating request payload, with API-SECRET
    TIMESTAMPUNIX timestamp when signature was calculated.

    Body

     

    Field

    Type

    Required

     Description  

    Example

    totalPriceBig DecimalYesTotal price of the purchase order. Should have value in fiat currency100.00
    fiatCurrencystringYesFiat currency in which order should be created. Allowed values for now are: [“EUR”]“EUR”
    cryptoAllowedCurrenciesarray of stringsNoCrypto currencies accepted by the merchant.[“USDT”, “BTC”]
    cryptoAllowedSlippageBig DecimalYesSlippage part0.05
    externalOrderIdstringYesOrderId defined by the merchant that will be returned in the webhook and can be used for easier order tracing“98765”
    externalOrderReferencestringYesOrder reference defined by the merchant that will be returned in the webhook and can be used for easier order tracing“order-ref1234”
    externalOrderTermsAndCon ditionsURLstringYesURL to Terms and conditions that will be shown to the customer in the payment process.“https://fake. url.com?for=te rms_and_condit ions”
    transactionStatusWebhook URLstringYesURL that be triggered on each status change of the pruchase order.“https://fake. url.com?for=tr ansactionstatuswebhook”
    timeoutintYesThe number of seconds before payment will auto-close.900
    lineItemsArray of ListITemNoCollection of line items that can be shown in the UI to shopper when paying the order[<ListItem> ]
    KYCKYCNoKYC object for current shopper that trusted merchants can provide so that identification part on Digital Crypto Payment part is skipped.KYC

     

    ListItem:

    NN

    Field

    Type

    Required

     Description  

    Example

    nameStringYesName of single line item“fake line item”
    descriptionStringNoDecription of single line item“Detailed description for fake line item instead of lorem ipsum”
    quantityIntegerYesQuantity of single line item1
    priceBig DecimalYesPrice of single line item100

     

    KYC:

     

    Field

    Type

    Required

     Description  

    Example

    emailStringYesShopper’s email“user@fakemail.provider”
    phoneNumberStringYesShopper’s phone number“+1234566789”
    firstNameStringYesShopper’s first name“Fake”
    lastNameStringYesShopper’s last name“User”
     countryTax String Yes Country where the shopper is considered a tax resident for tax purposes “IT”

     

    Callback for purchase stage changes

    Callbacks will be called each time a status of purchase order changes. Callbacks will use URL defined in the body of the request for creating the purchase order.

    METHOD: POST

    HEADERS:

    X-SIGNATURE: string

    X-TIMESTAMP: string

    Body:

    Body:

     

    Field

    Type

    Required

     Description  

    data<Data>YesDetails of related pruchase order
    typeStringYesEvent type for which the webhook was triggered
    externalCustomerIdStringYesexternal customer Id 

    Data:

     

    Field

    Type

    Required

     Description  

    idUUIDYesinternal Id of the purchase order
    createdAtdatetimeYesDate and time when the purchase order was created
    updatedAtdatetimeYesDate and time hwen the purchase order was updated last
     totalPricebigDecimal YesTotal price of the order
     fiatCurrencystring [EUR,USD] YesFiat currency for the purchase order
     quoteCurrencyAmount bigDecimal YesCrypto currency equivalent of the purchase order price
     feeAmount bigDecimal YesFee amount
     extraFeeAmount bigDecimal YesAdditional fee amount
     networkFeeAmount bigDecimal Yes Fee used for transaction
     areFeesIncluded[true,false] YesIndicates if the fees are included in the original price, or if they were added on
     flow[buy,direct] YesIndicates if shopper bought crypto to pay merchant with it or if shopper paid with crypto directly
     status[confirmed, completed, cancelled, failed] YesStatus of the purchase order
     walletAddressstring YesMerchant’s wallet address
     cryptoTransactionId string YesId of the crypto transaction
     failureReason stringNoReason of the failure in case the status is “Failed”
     bankTransferReference stringNoBank transfer reference when flow is “buy”
     currency string YesPurchase order fiat currency
     customerId string YesId of the shopper
     eurRate bigDecimalNoRate for EUR conversion
     usdRatebigDecimal NoRate for USD conversion
     externalTransactionIdstringYes TransactionId
     stagesList of Stage YesList of stages that this order came through so far
     countrystring  YesCountry of the shopper
     externalOrderIdstring YesOrderId provided by the merchant on order creation request
     externalOrderReferencestring YesOrder reference provided by the merchant on order creation request