PaaS API Docs
  • Getting Started
  • Authentication
  • Use cases
    • Remittance
      • Bonus/Discount on Remittance
    • Business Payments
    • Individual Wallet
    • Business Wallet
    • Payout
  • API References
    • Data Population
      • Spec Sheet
      • Country
      • States
      • Settlement Rates
    • User
      • User Object
        • User Verification
        • Identification Documents
        • User Verification Status
        • CIP Information Status
      • Receive User Object
      • Register a User
      • Update User
      • Business Representatives
        • Business Representatives Object
        • Add Business Representatives
        • Update Business Representatives
        • Get Business Representatives
      • Declaration
        • Declaration Object
        • Declaration
      • Initiate Verification
      • Get User by ID
      • Get Verification Status
      • Add a Receive User
      • Update a Receive User
      • Get Receive User List
    • Funds
      • User Funding Account Object
      • Funding Account Widget
        • OAuth Integration
        • Bank Verification Status
      • Wallet Object
      • Create a Wallet
      • Get Wallet Details
      • Get User Funding Account
      • Delete User Funding Account
      • Add a Receive Account
      • Update a Receive Account
      • Get Receive Accounts
    • Payout
      • Get Banks
      • Get Payers
    • Transaction (External)
      • Transaction Object
      • Create Transaction
      • Get Transaction by ID
      • Cancel Transaction
      • Transaction Delivery
      • Get Transaction Limits
    • Transaction (Wallet)
      • Wallet Transfer Object
      • Create Transfers
        • Load Wallet
        • Unload Wallet
        • Wallet to Wallet Transfer
      • Get Wallet Transfer Details
      • Get Limits
    • Transaction (Payout)
      • Payout Transaction Object
      • Create Payout Transaction
    • Webhooks
      • Subscribe
      • Integration
      • Events
    • Error Codes
  • Sandbox
    • User: Test Values
    • Funds: Test Values
    • Transaction: Test Values
  • Changelog
    • 2023
      • February 14, 2023
      • January 06, 2023
    • 2022
      • December 28, 2022
      • December 26, 2022
      • December 23, 2022
      • December 2, 2022
      • November 21, 2022
      • November 11, 2022
      • October 31, 2022
      • October 17, 2022
      • August 31, 2022
      • August 1, 2022
      • July 25, 2022
      • May 23, 2022
      • April 7, 2022
      • March 30, 2022
      • March 23, 2022
      • Feb 21, 2022
      • Feb 15, 2022
      • Jan 24, 2022
      • Jan 19, 2022
      • March 10, 2022
Powered by GitBook
On this page
  • 1. Include the Widget Script
  • 2. Create a div where widget needs to be placed
  • 3. Initialize the Widget

Was this helpful?

  1. API References
  2. Funds

Funding Account Widget

Read on adding funding accounts in safe and secure way

You will need to use our widget with the type "CARD" to add a card or "BANK" to add a bank as a funding account. A particular user can only have 2 active bank and 2 active card accounts.

To initialize the widget, you will need to first generate a Widget Token, which will only be valid for a certain time period. You will need to pass this token along with the Sender ID to widget initialization snippets.

GET /users/{{user_id}}/widget-token

Field

Required

Type

Description

token

Yes

String

Token Details

user_id

Yes

UUID

User ID

expiry_minutes

Yes

Numeric

Token validity time

curl --location -g --request GET '{{url}}/users/{{user_id}}/widget-token' \
--header 'X-Client-Id: {{client_id}}' \
--header 'X-Client-Secret: {{client_secret}}' \
--header 'Content-Type: application/json'
{
   "expiry_minutes": 15,
   "user_id": "85e1595e-4b08-44d6-acdf-e842149e8f6a",
   "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZW5kZXJJZCI6Ik9EVmxNVFU1TldVdE5HSXdPQzAwTkdRMkxXRmpaR1l0WlRnME1qRTBPV1U0WmpaaFxyXG4iLCJtdG9JZCI6IlFUQXdNd1xyXG4iLCJyb2xlcyI6WyJXSURHRVQiXSwib3JpZ2luYXRvciI6IkEwMDMiLCJleHAiOjE2MzYzMzkxMDEsImFmZmlsaWF0ZSI6IkEwMDMiLCJhZmZpbGlhdGVJZCI6NH0.JEXzaJeqpREbi2j1krWfgTAAKmS9Lh3q7PFpYppO4dU"
}

After you have the Widget Token, you will need to follow the steps mentioned below to set up the widget.

1. Include the Widget Script

<script src="https://widget.v4sandbox.machpay.com/widget/widget.js" charset="utf-8"></script>

2. Create a div where widget needs to be placed

<div id="widget-root"></div>

3. Initialize the Widget

<script>
    var widget = new MachnetWidget({
      elementId: "widget-root",
      userId: "{{user_id}}",
      width: "100%",
      height: "200px",
      type: "card",
      locale: "en",
      stylesheet: "https://example.com/mystyle.css",
      token: "{{token}}",
    });
    widget.init();
</script>
<script>
    var widget = new MachnetWidget({
      elementId: "widget-root",
      userId: "{{userId}}",
      width: "100%",
      height: "200px",
      type: "card",
      locale: "en",
      appScheme:'myapp://myapp', // For oAuth flows. Add deep link for android or iOs app. Not recommended for web browsers.
      userId: '{{userId}}', 
      stylesheet: "https://example.com/mystyle.css",
      token: "{{token}}",
      bankId: {{funding_souce_id}}, // Required only when funding source is in LOGIN_REQUIRED status and user needs to re-login to their bank account
    });
    widget.init();
  </script>
PreviousUser Funding Account ObjectNextOAuth Integration

Last updated 2 years ago

Was this helpful?

and will provide details on the status of the process.

Funding account webhooks
widget events