Socket
Socket
Sign inDemoInstall

@efesoroglu/shopier-api

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @efesoroglu/shopier-api

Shopier Payment Api


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Install size
485 kB
Created
Weekly downloads
 

Readme

Source

Shopier Api

Usage:

npm install @efesoroglu/shopier-api
Create an instance of the Shopier class.
import Shopier from 'shopier-api'

const shopier = new Shopier('apiKey', 'apiSecret', 'TRY')
Set the buyer's information.
shopier.setBuyer({
  id: '010101',
  product_name: 'Balance',
  first_name: 'Fatih',
  last_name: 'Akdoğan',
  email: 'mail@mail.com',
  phone: '05555555555'
})
Set buyer's billing address.
shopier.setOrderBilling({
  billing_address: 'Kennedy Caddesi No:2592',
  billing_city: 'Istanbul',
  billing_country: 'Türkiye',
  billing_postcode: '34000'
})
Set buyer's shipping address.
shopier.setOrderShipping({
  shipping_address: 'Kennedy Caddesi No:2592',
  shipping_city: 'Istanbul',
  shipping_country: 'Türkiye',
  shipping_postcode: '34000'
})
How much will the customer pay?
For 15₺/$/€:
const paymentPage = shopier.payment(15);

This will return the purchase form as html.

If we give an example for Express JS:
app.get('/pay', (req, res) => {
    res.end(paymentPage);
});

Now that we have render the html, a callback will be required after checkout.

app.post('/payment/shopier/callback', (req, res) => {
    const callback = shopier.callback(req.body);
});
If payment was successful, it will return success, order_id, payment_id, installment.
{ success: true, order_id: 10592, payment_id: 413449826, installment: 0 }
If payment was not successful, it will return success, message.
{ success: false, message: "Payment not completed successfuly." }

Forked from https://github.com/0x178F/shopier-api

FAQs

Last updated on 21 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc