This guide introduces how to get started with using the Cobo Payments JavaScript SDK, which allows you to integrate the Cobo payments service into your existing application using the JavaScript programming language.To learn more about the initial setup steps necessary for utilizing the Payments API, see Send your first request.You can go to GitHub to access the source code of the SDK.
Follow the instructions in Preparation for development environment to set up your Cobo account and create your organization. If an organization has already been set up, ask your organization admin to invite you to join the organization.
Follow the instructions in Send your first request to generate an API key and an API secret, and register the API key on Cobo Portal.
The directory structure after installation is as follows:
waas2-js/├─ node_modules/├─ package.json├─ package-lock.json└─ (to be created later) index.js
If your project already has package.json and package-lock.json, you can directly copy them to the root directory and run npm install to pull dependencies.
Create a file index.js in the root directory and paste the following code into it.
The directory structure after installation is as follows:
waas2-js/├─ node_modules/├─ package.json├─ package-lock.json└─ (to be created later) index.js
If your project already has package.json and package-lock.json, you can directly copy them to the root directory and run npm install to pull dependencies.
// Initialize the default API clientconst apiClient = CoboWaas2.ApiClient.instance// Set the API secretapiClient.setPrivateKey("<YOUR_API_SECRET_IN_HEX>");