Node
Node to access the Hyperswitch API
Using Node SDK for app server is OPTIONAL. You can use our REST APIs for the
Requirements
Installation
npm install @juspay-tech/hyperswitch-node --save
# or
yarn add @juspay-tech/hyperswitch-nodeUsage
const hyperswitch = require('hyperswitch')('snd_efe...');
hyperswitch.paymentIntents.create(
{
// Refer the request body of payments from this API https://app.swaggerhub.com/apis-docs/bernard-eugine/HyperswitchAPI/0.0.1#/Payments/Create%20a%20Payment
amount: 10000,
currency: "USD",
capture_method: "automatic",
amount_to_capture: 10000,
customer_id: "hyperswitchCustomer",
email: "[email protected]",
name: "John Doe",
phone: "999999999",
phone_country_code: "+65",
description: "Its my first payment request",
authentication_type: "no_three_ds",
return_url: "https://app.hyperswitch.io",
shipping: {
address: {
line1: "1467",
line2: "Harrison Street",
line3: "Harrison Street",
city: "San Fransico",
state: "California",
zip: "94122",
country: "US",
first_name: "John",
last_name: "Doe"
},
phone: {
number: "123456789",
country_code: "+1"
}
},
billing: {
address: {
line1: "1467",
line2: "Harrison Street",
line3: "Harrison Street",
city: "San Fransico",
state: "California",
zip: "94122",
country: "US",
first_name: "John",
last_name: "Doe"
},
phone: {
number: "123456789",
country_code: "+1"
}
},
metadata: {
order_details: {
product_name: "Apple iphone 15",
quantity: 1
},
}
}
)
.then(customer => console.log(customer.id))
.catch(error => console.error(error));Sample server code using Hyperswitch Node SDK
Last updated
Was this helpful?

