@yimba/sdk
v2.0.22
Published
React components that implement Yimba SDK Api
Downloads
36
Readme
Yimba SDK Documentation
Introduction
This document describes the use and integration of the Yimba SDK into your application. The Yimba SDK provides quick and simple integration to new or existing applications, allowing you to build a digital mobile wallet with only 5 lines of code! The Yimba SDK returns prebuilt components to your UI within a single line of code.
The Yimba SDK is available in two versions: V1 and V2. Both versions provide the same core functionality, but differ significantly in their user interface design. V2 features a more modern and updated UI, and has been refactored for improved maintainability and performance. V2 is the only version that will continue to receive updates and support. For details, refer to the version history section. If you plan to use V1, please ensure you use the latest version, v1.0.52.
SDK Installation
The SDK can be installed via NPM using standard methods. Using Yarn
yarn add @yimba/sdkUsing NPM
npm i @yimba/sdkAvailable Components
| Component Name | Description | | ---------------- | ------------------------------------------------------------------------------------------------------------------------- | | YimbaCard | Shows a payment card preview with any applied customisation. | | YimbaDesigns | Lists all available card customisation options for your card program. Includes a preview of new card art before applying. |
SDK Overview
In order to use the Yimba SDK, you will need to have been issued your unique Authentication Identification, Client Identification and Passkey. You will not be able to make use of the Yimba SDK without these elements being issued by Yimba.
Process Overview
Your application must first call the Yimba Authentication Service passing both your Username and Password with the request. The authentication service will issue a bearer token that will be valid for 24 hours.
The @yimba/sdk-api package, which is automatically installed as an dependency of this package, provides a getAccessToken method. This method returns a promise that resolves with the authentication token data, allowing you to manage the token within your application.
Obtain Auth Token
import { getAccessToken } from "@yimba/sdk-api";
getAccessToken(username, password).then(authToken => {
// handle the response as required within your app. For example,
// call a dispatch to Redux to store the token
this.props.setAPIToken(authToken);
});Register a New Card
Before using any Yimba Component, you must have a valid CardID. If you do not have one, you need to register a new card first. The registration process returns a unique identifier for the card. To register a card, use the registerCard method from the @yimba/sdk-api package.
Import and Usage Example
import { registerCard } from "@yimba/sdk-api";
registerCard(
accessToken,
clientId,
"BIN Number",
defaultImage,
providerReferenceId,
).then(newCardToken => {
// handle the response as required within your app. For example,
// call a dispatch to Redux to store the card token
this.props.setCardID(newCardToken);
});The registerCard method requires your issued ClientID, Access Token, the card's BIN number, a DefaultCardImage array, and a ProviderReference.
The DefaultCardImage parameter is required and specifies the default card design assigned to a new user before any customisation. It should be a JSON array with the following properties:
| PropName | PropType | Description |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| ImageName | string | A descriptive name e.g: 'My Default Image'. |
| ImageType | string | Specifies the format of the image data. Must be either 'URL' for web-hosted images or 'BASE64' for images provided as a Base64-encoded string. |
| ImageData | string | The actual image content. Provide a direct URL if ImageType is 'URL', or a Base64-encoded string if ImageType is 'BASE64'. |
Example Default Image Array
Passing Image as URL
[
{
ImageName: "My Default Image",
ImageType: "URL",
ImageData:
"https://pbs.twimg.com/profile_images/735509975649378305/B81JwLT7.jpg",
},
];Passing Image as BASE64 Encoded Data
[
{
ImageName: "My Default Image",
ImageType: "BASE64",
ImageData:
"/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCACAAIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhc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R0IrF05LdG8akJbMrxJvbHJNdQ3gu8ESFS28qCVZCMH0zW98KPCI1vWWv7yHNlZEEhujyfwj8Ote3XsOlWke+7lt4FPeVgufzrKSb2N6VWlFv2iueAad4VmtP3s0TSSD7oC8D/GrrWxto3kmQQRKMu5GABXp954m8JWpKm+SUjtChb/61eb+OdSi8STw2+myeRYxjcd6ENI/qQOw7Vm6Lk9WehTzOlRhy04WOS1XxNLMjW1lugtzwzfxyD3PYewrm2Oa6mHwvbMMzX0h9kjA/makHhew6/aLg8/7IroVJ2PLqYnnk5Sd2c9aXht7O6hULmYBSSOce1X9L08swlkiV0jw7hsjAH09a1ovDthDIpDzNz0Yio7+fUdFUTWkUIhXgyICSP8AeBoVLl1ZLrc1kjXv7TLBoooUVsfu4c7VAx15Pr+hrG1u0htbLcRtuJ8JtBHXnPHtWLN4h1O4kLSXbkMQWUcA/XFXNQ1+71+WJ7iG1ijtlIRbeARqM+uOvTvVJpvQmzR//9k=",
},
];IMPORTANT:
The returned CardID is valid for the entire lifetime of the card and does not expire. Only call this method if you do not already have a valid CardID to use with the Yimba SDK.
You must provide a valid BIN number that has been configured within your card programme. BINs are set up during the onboarding process with Yimba. If an invalid BIN number is provided, the promise response will contain the error message:
"Specified Bin Number is not setup for your card programme."The ProviderReference parameter is a unique identifier you use to refer to this card within your system. It is passed during card registration to link your internal reference with the unique card reference returned by Yimba. This maintains user anonymity while allowing you to associate data between your platform and Yimba.
Using Yimba SDK Components
This section details the usage of the individual components available within the SDK.
YimbaCard
The YimbaCard component renders a payment card preview, displaying any customisations currently applied to the card. It includes pre-rendered overlays for the card issuer and program, as illustrated below. To use the YimbaCard component, provide a valid accessToken, clientId, and cardIdentifier as props.
Example Usage
import React from "react";
import { View } from "react-native";
import { YimbaCard } from "@yimba/sdk";
const ExampleScreen = () => (
<View>
<YimbaCard
accessToken={accessToken}
clientId={clientId}
cardIdentifier={cardId}
/>
</View>
);
export default ExampleScreen;Example YimbaCard Output

YimbaDesigns
The YimbaDesigns component renders a list of all available card customisation options for your card programme, including a live preview of the card with any selected design applied. To use the YimbaDesigns component, provide a valid accessToken, clientId, and cardIdentifier as props.
Example Usage
import { YimbaDesigns } from "@yimba/sdk";
const ExampleScreen = () => (
<YimbaDesigns
accessToken={accessToken}
clientId={clientId}
cardIdentifier={cardId}
/>
);
export default ExampleScreen;Note:
'YimbaDesigns' should just be rendered on its own, as it contains all the logic to render as a complete screen within the component.
Example YimbaDesigns Output

