API Setup

Setup Server-Server API calls

Create a payment session through the Hands In API. The following describes the process for creating a Multi-Card payment session. To implement the same for group payment sessions, simply replace all multi-card references with group payments instead.

const handsInApiKey = "your api key"; // We do not recommend hardcoding this! Store this somewhere safe and use environment variables

// reference map just used as an example, in practice this would be stored in a DB
const references = new Map<OrderId, MultiCardId>();

router.post("/multicard", async (req, res, next) => {
	const orderId = req.body.orderId;
	if(!orderId) {
	 * The below is just some pseudocode which describes a
   * process that could be potentially be used in your system.
   * The main points are the following:
   * 1. You are able to check if a multicard session already exists for an order
   * 2. You are able to retrieve the multicard ID from a stored reference
   * 3. If the reference has not been created, you are able to create a multi card 
   *    payment and store a reference 
	const referenceExists = checkReferenceExists(orderId)
	if (referenceExists === true) {
		 const multiCardId = getReference(orderId);
     return res.send(getExistingMultiCard(handsInApiKey, multiCardId));
  } else {
		 const multiCardPayment = createMultiCardPayment(handsInApiKey, orderId);
		 createReference(orderId, multiCardPaymentId);
		 return res.send(multiCardPayment);

// helper functions
function createMultiCardPayment(handsInApiKey, orderId) {
	const orderData = getOrderData(orderId);
	// make call to Hands In API to create multi card payment
	return fetch("https://api.handsin.com/v1/multi-card-payments", "POST", {
			header: {["x-api-key"]: handsInApiKey}, 
			data: {amountMoney: getOrderTotal(orderData)}

function checkReferenceExists(orderId) {
	return reference.has(orderId);

function getReference(orderId) {
	return reference.get(orderId);

function createReference(orderId, multiCardId){
	reference.set(orderId, multiCardId);