Fuspay
WebsiteSupportDemo Meeting
  • Overview
    • Welcome
  • API ONBOARDING
    • Introduction
    • Partner Onboarding
    • Regenerate Partner Keys
    • IP Check & Whitelisting
  • API Onboarding
  • Authentication
    • Swap, Collection, & P2P Automation
  • Webhook Validation & Request Integrity
  • Currency Swap
    • Introduction
    • Authentication
      • Partner Onboarding Endpoints
      • Partner Activate Endpoint
      • Regenerate Partners Public & Private Keys
      • Digital Signature
    • User KYC
      • Create KYC
      • Verify KYC Status
      • Reconciliation
      • Post KYC Data
    • Exchange Rate
    • Buy
      • Create Order
      • Events
    • Sell
      • Create Order
      • Events
    • Transaction Resolution
      • Overview
      • Log Issue
      • Check Issue Status
    • Transaction Records
      • Pending Transaction
      • Get Single Order Endpoint
      • Get Multiple Order Endpoint
      • Sell/Payout Verification Endpoint
    • Provider/Bank Codes
  • Virtual card
    • Introduction
      • Getting Started
        • Partner Onboarding
        • Partner Activate Endpoint
    • Authentication
    • Partner
      • Create Merchant
      • List of Merchants
    • Merchant
      • Create User
      • Verify User KYC Status
      • List Users
    • User
      • Create Card
      • Fetch Cards
      • Get Card Details
    • Card
      • Fund Card
      • Freeze Card
      • Delete Card
    • Payments
      • Withdraw From Card
      • Withdrawal History
    • Transactions
      • Card Transactions
      • Export Card Transactions
      • Filter Card Transactions
    • Wallet
      • Merchant Wallet Balance
      • Card Wallet Balance
  • Collection and payout
    • Introduction
    • Onboarding
    • Getting Started for Partner
      • Partner Onboarding Endpoints
      • IP Capture & Whitelisting
      • Regenerate Partners Pub/Priv Keys
    • Getting Started for Merchant
    • Collection
      • Digital Signatures
      • Collection (GHS, KHS, ZAR)
      • Collection (Virtual Account-NGN )
      • Fetch Order
      • Assigning Virtual Accounts
        • Get Available Assignable Virtual Account
        • Check if specific account is available for use
        • Create Order- using Available Virtual Account from your Account Pool
        • Cancel Order
      • Get Mobile Money Providers
    • Payout
      • Account verification
      • Payout
      • Payout Status
      • Crypto Withdrawal
        • Wallet Balance
        • Withdrawal Payout
        • Get Withdrawal Payout Fee
      • Bank and Bank Codes
    • Transaction History
      • Get Transaction Records
  • P2p Automation
    • Integration Journey (API-Dashboard)
  • Payment and Utilities
    • Introduction
      • Sign Up
      • Compliance
      • Create an App
      • Configure App
    • Authentication
    • User Onboarding
    • Error Handling
    • Plugin (Frontend)
      • Integrating Finswich checkout via NPM or Yarn
      • Integrating the Finswich Checkout on your Vanilla Javascript app
      • Steps for integrating Finswich Checkout via Flutter
      • Pseudocode for Integrating Finswich Checkout in Application (Native iOS & Android)
    • Services (Backend)
      • Inter-wallet Transfer
      • Bank Transfer
      • Wallet Funding
      • Utility Purchases
  • KYC As A Service
    • Introduction
    • App Registration Endpoint
    • App Activate/Verify Endpoint
    • Request Verification Token
    • KYC (Individual)
      • Get KYC Types
      • Create KYC Request
      • Get Verification Status and User's Data
      • Create order with meta data
      • Migrate
    • KYC (Business)
      • Get KYC Types
      • Create KYC Request
      • Get Verification Status and User's Data
    • Face Stamp
      • Create Facestamp Order
      • Create OTP
      • Verify OTP
      • Post Transaction Data
    • KYC(Transactional)
    • Callbacks (Webhook Responses)
Powered by GitBook
On this page
  • FOR INCOMING TRANSACTIONS/FUNDING
  • TRANSACTION FLOW EVENTS
  1. Payment and Utilities
  2. Services (Backend)

Wallet Funding

PreviousBank TransferNextUtility Purchases

Last updated 6 months ago

FOR INCOMING TRANSACTIONS/FUNDING

An incoming transaction is a kind of transaction where users on your platform receives money between into wallet from other wallets, banks or other countries or a funding activity. This is what we refer to as an incoming transactions.

BEFORE INTEGRATION - DO THIS

Before you begin any integration you need to have created an incoming URL endpoint where all request between Finswich & your application will take place for interactions and notifications of incoming transactions. See Below for Image reference

TRANSACTION FLOW EVENTS

  1. User Category: this is used to ensure that the recipient user has the right policy setup to receive the incoming transaction

Req Body

{"event":"USER_CATEGORY","data":{"user_reference":"saudiemcode001","mode":"LIVE"}}

Sample Code on third party

      if (body.event === 'USER_CATEGORY') {

          const user = await this.user_repository.FindById(
            body.data.user_reference,
            [
              '-permissions',
              '-settings',
              '-recovery_keys',
              '-contigency_lock_expires',
              '-contigency_level',
              '-verification_code',
            ],
          );

          return {
            status: 'success',
            message: 'User category sent!',
            data: {
              user_category: body.data.user_reference,
              user,
            },
          };
        }

Credit Transactions Events -Once there is a credit to your Finswich wallet, the notifications will be posted to your incoming webhook URL. you can use the data to update your user’s wallet balance on your application.

Req Body

{"event":"CREDIT_TRANSACTION","data":{"user_reference":"saudiemcode001","amount"10,"currency":"sar","transaction_reference":"FIN-DXVb1CpC6jnTXkqJ1682607236","quarantine":false,"mode":"LIVE"}}
 if (body.event === 'CREDIT_TRANSACTION') {
          //! consider crediting your wallet here
          const credit_model = {
            txn_reference: body.data.txn_reference,
            user_reference: body.data.user_reference,
            amount: body.data.amount,
            currency: body.data.currency,
          };

          const wallet = await this.wallet_repository.FindByUserId(
            credit_model.user_reference,
          );

          if (!wallet) {
            throw new notFoundException(en['wallet-not-found']);
          }

          await this.finswich_txn_logs_repository.CreateTxnLogs({
            txn_reference: credit_model.txn_reference,
            amount: credit_model.amount,
            currency: credit_model.currency,
            user: credit_model.user_reference,
            wallet_id: wallet.id,
            type: 'incoming',
            status: 'success',
          });

          await this.wallet_repository.IncreaseBalance(
            credit_model.user_reference,
            credit_model.amount,
          );

          await this.wallet_repository.UpdateById(
            wallet.id,
            {},
            { total_incoming: credit_model.amount },
          );

          return {
            status: 'success',
            message: en['user-account-credited-success'],
          };
        } else {
          throw badRequestException(en['user-account-credited-failure']);
        }

Setting up the incoming webhook URL