Package Exports
- cashramp
- cashramp/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cashramp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Cashramp SDK
This is the official NodeJS SDK for Cashramp's API.
β Installation
# NPM
npm install cashramp --save
or
# Yarn
yarn add cashrampπ¨πΎβπ» Quick Start
const Cashramp = require("cashramp");
const cashrampAPI = new Cashramp({
env: "test", // Can be either `test` or `live`
secretKey: "CSHRMP-SECK_apE0rjq1tiWl6VLB",
});
// Example: Fetch available countries
const response = await cashrampAPI.getAvailableCountries();
if (response.success) {
console.log(response.result);
} else {
console.log(response.error);
}API Reference
Queries
getAvailableCountries()getMarketRate({ countryCode })getPaymentMethodTypes({ country })getRampableAssets()getRampLimits()getPaymentRequest({ reference })getAccount()
Mutations
confirmTransaction({ paymentRequest, transactionHash })initiateHostedPayment({ amount, paymentType, countryCode, currency, email, reference, redirectUrl, firstName, lastName })cancelHostedPayment({ paymentRequest })createCustomer({ firstName, lastName, email, country })addPaymentMethod({ customer, paymentMethodType, fields })withdrawOnchain({ address, amountUsd })
Custom Queries
For custom queries, use the sendRequest method:
const query = `
query {
availableCountries {
id
name
code
currency {
isoCode
name
}
}
}
`;
const response = await cashrampAPI.sendRequest({
name: "availableCountries",
query,
});
if (response.success) {
console.log(response.result); // `result` contains the list of countries
}Documentation
For detailed API documentation, visit Cashramp's API docs.