Trigger Exchange payment

When the shopper makes the exchange payment, this API creates a transaction record in the RKFL system.

A crypto transaction may take 2 min to 2 hours to complete the transaction. When a crypto transaction is initiated successfully, this API returns the immediate status of the transaction, which can be pending/processing/canceled/completed.

The RKFL wallet receives all crypto transactions and settles with the merchant daily.

The merchant can set up a webhook through the merchant portal to receive updates on every status change in the RKFL system. The merchant must set up only one webhook for crypto and bank transfer.

This API receives the request payload in an encrypted format, where the encryption algorithm is RSA, and the encryption key is the merchant's public key.

// The sample request payload that needs to encrypt
{
  "clientId": "cc238708-02a0-48af-a70d-9d05cfe3a66d",
  "assets": "BTC",
  "cart": [
    {
      "id": "1",
      "name": "Starbucks Gift Card",
      "price": 2,
      "quantity": 1,
      "localAmount": 2,
      "localCurrency": "USD"
    },
    {
      "id": "3",
      "name": "Best Buy Gift Card",
      "price": 2,
      "quantity": 1,
      "localAmount": 2,
      "localCurrency": "USD"
    },
    {
      "id": "5",
      "name": "Amazon Gift Card",
      "price": 1,
      "quantity": 1,
      "localAmount": 1,
      "localCurrency": "USD"
    }
  ],
  "shippingAddress": {
    "city": "jam",
    "email": "[email protected]",
    "state": "jh",
    "country": "india",
    "phoneNo": "7004703084",
    "zipcode": "831008",
    "address1": "some address",
    "address2": "",
    "landmark": "",
    "lastname": "singh",
    "firstname": "manish"
  },
  "offerId": "1656674750778",
  "nativeAmount": "5",
  "savepassword": false,
  "code2fa": "",
  "merchantStoreCurrency": "USD"
}

// clientId is the RKFL merchant id.

// The key "data" should generate from the below way.
export const data = async (toEncrypt, publicKey) => {
  const buffer = Buffer.from(toEncrypt);
  const encrypted = crypto.publicEncrypt(publicKey, buffer);
  return encrypted.toString('base64');
};

POST /exchanges/payments/{exchange_name}

The value of exchange_name are "coinbase/okcoin/kraken/gemini/binanceus"

Error codes to be handled over the front end in payment API

code: 418,

message: 'Authentication Failed! Please try again after some time.'

code: 419,

message: 'Insufficient Balance'

code: 420,

message: 'Address whitelist is pending!'

code: 421,

message: 'Coin Wallet is not supported at this moment! please try again after some time.'

code: 422,

message: 'Amount is less than minimum transaction amount supported by'

Headers

Request Body

{
  "id": "176c7937-b4c9-48ac-bda9-a9b1a9472de1",
  "status": 1,
  "nativeAmount": "5.00",
  "nativeCurrency": "USD",
  "amount": "0.00423297",
  "receivedAmount": "0.00423227",
  "currency": "ETH",
  "type": 0,
  "description": null,
  "check": [
    {
      "id": "1",
      "num": 0,
      "name": "In store",
      "price": 5,
      "quantity": 1,
      "localAmount": 5,
      "statusRefund": {
        "pending": 0,
        "success": 0,
        "rejected": 0
      },
      "amountFinal": 5
    }
  ],
  "subscriptionIds": [
    
  ],
  "subscriptionOrder": false,
  "meta": {
    "hash": {
      "value": [
        "794afe809c063d6655d638dd731f07212063ebc967a8fc963334ab65fa0dfc2b"
      ],
      "network": "ethereum"
    },
    "offerId": "8ac346d4-19c2-4f55-b1f0-c3588ca16140",
    "receiverAddress": "0x27544a72AcB6567Dc261cB38c651dA96DD4C9bf4"
  },
  "stockId": null,
  "userId": null,
  "merchantId": "14ec584d-53af-476d-aacd-2b7f025cf21b",
  "settlementId": "fcec8a08-dd19-485d-9657-dd64498b0f83",
  "statusRefund": 20,
  "localAmount": "5.00",
  "referenceDwolla": null,
  "localCurrency": "USD",
  "merchantPayableAmount": "5",
  "errorMessage": null,
  "settlementStatus": 1,
  "txMetaId": "9504cebd-841a-4eb2-aed4-660522fed92d",
  "partnerId": null,
  "createdBy": "14ec584d-53af-476d-aacd-2b7f025cf21b",
  "createdAt": "2022-06-21T14:32:34.529Z",
  "updatedAt": "2022-06-21T15:44:55.400Z",
  "merchant": {
    "shopData": {
      "url": "https://webhook.site",
      "logo": "https://dev-rocketfuel-videos.s3.us-east-1.amazonaws.com/shoplogo/MTRlYzU4NGQtNTNhZi00NzZkLWFhY2QtMmI3ZjAyNWNmMjFi_1651734165.png",
      "companyName": "Rocketfuel",
      "description": "buy rocket fuel at cheap price"
    }
  },
  "customer": {
    "email": "",
    "fullname": ""
  },
  "currencyInfo": {
    "isFiat": false
  },
  "stock": null,
  "partner": null,
  "txMetadata": {
    "id": "9504cebd-841a-4eb2-aed4-660522fed92d",
    "shippingAddress": null,
    "nativeConversionRate": "1"
  },
  "receivedAmountFinal": 5,
  "receivedAmountCal": 4.999178485307677
}

Last updated