Creating Payments

To create a payment, you will need to make a POST /api/v1/pay/summary call:

curl -X "POST" "https://api.sandbox.coindirect.com/api/v1/pay/summary" \
     -H 'Authorization: Hawk id="RucpDbCK06k9YxwyLzxJ7x0XgrYpdk6D3tIKDRtEKPwjvdmxCJYbffAD5T9E3M", ts="1636616294", nonce="LZ7rJs", mac="wTVRho+Ayh6rIB3OAjAGJNuF7PuDaiTA5HhlR0tx7O4="' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "amount": "10000",
  "reference": "4a393f21-1164-4b70-b82f-9611eab23b74",
  "merchantId": "0a12a214-1619-43fa-9be1-0029f6a440a0",
  "returnUrl": "https://yourwebsitename.com",
  "type": "IN",
  "currency": "JPY",
  "payInDetails": {
    "currency": "BTC"
  },
  "expiryMinutes": "60"
}'

Let's go through the body parameters in our cURL:

Parameter

Type

Description

merchantId

string

Your Merchant ID. You can find it on the Merchant Details page in your account

reference

string

Your payment reference ID. Feel free to submit any ID to tie the payment to your customer

amount

number

Payment amount

currency

string

Payment currency

returnUrl

string

URL that the customer will be redirected to if they click a "Back to Merchant" button on the payment web page

type

string

To accept payments, please always specify IN to accept payments

expiryMinutes

number

Indicates the payment window - e.g. for how long a payment will be valid. Once it expires e.g. no transaction has been at the payment address during the payment window, the payment will update its status to EXPIRED

payInDetails.currency

string

This optional parameter allows you specify a cryptocurrny code to skip the step at which your customer needs to select the cryptocurrency oftheir choince on the redirect web page. If you do not submit this parameter, keep in mind that you will have to redirect your customer to the redurectUrl that our API returns in the response.

You will then receive the following response from the Coindirect API:

{
 {
  "uuid": "9a34142a-9760-4add-84be-811589f3a784",
  "merchantId": "0a12a214-1619-43fa-9be1-0029f6a440a0",
  "dateCreated": 1636616283493,
  "expiryDate": 1636619880451,
  "reference": "9ccfe7b3-6b51-4fb8-98c9-eafdf37bb6c6",
  "type": "IN",
  "status": "PENDING",
  "displayCurrency": {
    "currency": "JPY",
    "amount": 1E+4,
    "actual": 0
  },
  "walletCurrency": {
    "currency": "EUR",
    "amount": 76.45,
    "actual": 0
  },
  "paidCurrency": {
    "currency": "BTC",
    "amount": 0.00137295,
    "actual": 0
  },
  "feeCurrency": {
    "currency": "EUR",
    "amount": 0.76,
    "actual": 0
  },
  "displayRate": {
    "base": "BTC",
    "counter": "JPY",
    "rate": 7283586.437962052514658218
  },
  "exchangeRate": {
    "base": "BTC",
    "counter": "EUR",
    "rate": 55683.007773347885159365
  },
  "address": {
    "protocol": null,
    "address": "mnJoHg45whcRjiu42kZcF3xCUyx9kHg6Nz",
    "tag": null,
    "uri": "bitcoin:mnJoHg45whcRjiu42kZcF3xCUyx9kHg6Nz",
    "alternatives": []
  },
  "redirectUrl": "https://business.sandbox.coindirect.com/payin?uuid=9a34142a-9760-4add-84be-811589f3a784&flow=direct",
  "returnUrl": "https://yourwebsitename.com",
  "transactions": []
}

Specifically, you might want to look at the redirectUrl parameter value which is basically a URL to the payment web page that you can redirect your customer to.

To see what the payment web page UI looks like, click the link below:

Payment Hosted Page

To have a look a the payment-related API endpoints, please visit the Payments page in the API section:

Payments

Last updated