Skip to content

PaymobAccept/paymob-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ef32ef3 · May 26, 2022

History

60 Commits
Jan 3, 2022
Nov 23, 2021
Aug 23, 2021
Sep 29, 2021
Aug 24, 2021
Aug 23, 2021
Aug 23, 2021
May 26, 2022
Oct 31, 2021
Jan 3, 2022
Aug 29, 2021
Jan 3, 2022
Jan 9, 2022
Oct 24, 2021
Aug 24, 2021

Repository files navigation

Paymob Node SDK

The Fast Way To Get Payment Duds Ready, Ever

ForTheBadge powered-by-paymob

Paymob Node is a minimal, straightforward and easy way to config payment intention methods, voiding, refunding and more..

Find the documentation

Installation

Install the SDK and start the game.

npm install paymob-node

Prerequisites

Paymob Node requires Node.js v10+ to run.

Supported languages

  • JavaScript

Setup

To start using the SDK have to import or include and initialize it with your secrete key.

const { Paymob } = require("paymob-node");
const paymob = Paymob("skl_***");

Intention

Paymob Node offers verity of intention methods like create, retrieve and list.

Note: this examples using express, you can use your favorite framework instead.

  • Create
const payload = {
	amount: "2000",
	currency: "EGP",
	payment_methods: ["card", "wallets", "card-installment"],
	items: [
		{
			"name": "ASC1515",
			"amount": "1000",
			"description": "Smart Watch",
			"quantity": "1"
		},
		{
			"name": "ERT6565",
			"amount": "1000",
			"description": "Power Bank",
			"quantity": "1"
		}
	],
	billing_data: {
		"apartment": "74",
		"email": "[email protected]",
		"floor": "42",
		"first_name": "Jhon",
		"street": "Ethan Land",
		"building": "1907",
		"phone_number": "9135210487",
		"shipping_method": "PKG",
		"postal_code": "01898",
		"city": "Jaskolskiburgh",
		"country": "CR",
		"last_name": "Don",
		"state": "Utah",
	},
	customer: { "first_name": "Jhon", "last_name": "Don", "email": "[email protected]" },
	delivery_needed: false, 	 	
};

app.get("/marketplace/secret/", (req, res) => {
	paymob.Intention.create(payload).then(paymobApiResponse => {
		res.send(paymobApiResponse);
	}).catch(err => {
		res.send(err);	
	});
});