# Bank payment

{% hint style="warning" %}
DEPRECATED
{% endhint %}

When the shopper makes the bank payment, this API creates a transaction record in the RKFL system.&#x20;

An ACH bank transaction may take 3 - 4 working days to complete the transaction. This API returns the pending status of a bank transaction once it has been successfully initiated.&#x20;

The bank transfer is P2P means from the shopper's bank account to the merchant's bank account. To enable the bank transfer, the merchant must complete the KYB process and link his bank account to the RKFL merchant portal to receive the payment.

The RKFL system deducts the configured merchant fee from the transaction and credits the remaining amount into the merchant's linked bank account.

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.&#x20;

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

```
// The sample request payload that needs to encrypt
{
  clientId: '2335689b-7a4d-420a-9cc0-f5d765a96967',
  amount: 1,
  accountId: '8ebzpaLqdqtlgXB53LemsalJ88ZpWMiwrKnkZ',
  cart: [
    {
      id: '2763',
      name: 'Data cable',
      price: 1,
      quantity: 1,
      localAmount: 1,
      localCurrency: 'USD'
    }
  ],
  stockId: 'd56b7410-4d39-4b32-a055-0828e9ab1ce5',
  offerId: '4e3c59b0a14519ee6d620be63241bd71',
  merchantStoreCurrency: 'USD',
  hostedPageId: ''
  shippingAddress{
    "firstname": "",
    "lastname": "",
    "phoneNo": "",
    "address1": "",
    "address2": "",
    "state": "",
    "city": "",
    "zipcode": "",
    "country": "",
    "landmark": "",
    "email": ""
  }
}

// clientId: The RKFL merchant id
// amount: cart total
// account Id: the merchant bank account id where the fund is to be transferred
// stockId: shopper connected bank account identifier
// offerId: merchant's unique identifier

// 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');
};
```

<mark style="color:green;">`POST`</mark> `/purchases`

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer" + shopper access token |
| Content-Type                                    | String | application/json                |

#### Request Body

| Name                                   | Type   | Description      |
| -------------------------------------- | ------ | ---------------- |
| data<mark style="color:red;">\*</mark> | String | Encrypted object |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
  "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
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rocketfuel.inc/developer-guides/api-reference/payins/utility-apis/bank-payment/bank-payment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
