Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iyzipay

Package Overview
Dependencies
Maintainers
0
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iyzipay

iyzipay api node.js client

  • 2.0.63
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4K
decreased by-10.82%
Maintainers
0
Weekly downloads
 
Created
Source

iyzipay-node

NPM version

You can sign up for an iyzico account at https://iyzico.com

Requirements

Node.js v0.10.0 or later

Installation

npm install iyzipay

Usage

Initialization

var Iyzipay = require('iyzipay');

var iyzipay = new Iyzipay({
    apiKey: 'your api key',
    secretKey: 'your secret key',
    uri: 'https://sandbox-api.iyzipay.com'
});

As you can see, credentials information provided while creating new instance of Iyzipay class. If you do not provide iyzipay credentials, default values will be fetched from environment variables by following names.

   IYZIPAY_URI
   IYZIPAY_API_KEY
   IYZIPAY_SECRET_KEY

In other words, you can initialize Iyzipay object like following:

var iyzipay = new Iyzipay();

Sample Usage

var Iyzipay = require('iyzipay');

var iyzipay = new Iyzipay({
    apiKey: 'your api key',
    secretKey: 'your secret key',
    uri: 'https://sandbox-api.iyzipay.com'
});

var request = {
    locale: Iyzipay.LOCALE.TR,
    conversationId: '123456789',
    price: '1',
    paidPrice: '1.2',
    currency: Iyzipay.CURRENCY.TRY,
    installment: '1',
    basketId: 'B67832',
    paymentChannel: Iyzipay.PAYMENT_CHANNEL.WEB,
    paymentGroup: Iyzipay.PAYMENT_GROUP.PRODUCT,
    paymentCard: {
        cardHolderName: 'John Doe',
        cardNumber: '5528790000000008',
        expireMonth: '12',
        expireYear: '2030',
        cvc: '123',
        registerCard: '0'
    },
    buyer: {
        id: 'BY789',
        name: 'John',
        surname: 'Doe',
        gsmNumber: '+905350000000',
        email: 'email@email.com',
        identityNumber: '74300864791',
        lastLoginDate: '2015-10-05 12:43:35',
        registrationDate: '2013-04-21 15:12:09',
        registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        ip: '85.34.78.112',
        city: 'Istanbul',
        country: 'Turkey',
        zipCode: '34732'
    },
    shippingAddress: {
        contactName: 'Jane Doe',
        city: 'Istanbul',
        country: 'Turkey',
        address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        zipCode: '34742'
    },
    billingAddress: {
        contactName: 'Jane Doe',
        city: 'Istanbul',
        country: 'Turkey',
        address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
        zipCode: '34742'
    },
    basketItems: [
        {
            id: 'BI101',
            name: 'Binocular',
            category1: 'Collectibles',
            category2: 'Accessories',
            itemType: Iyzipay.BASKET_ITEM_TYPE.PHYSICAL,
            price: '0.3'
        },
        {
            id: 'BI102',
            name: 'Game code',
            category1: 'Game',
            category2: 'Online Game Items',
            itemType: Iyzipay.BASKET_ITEM_TYPE.VIRTUAL,
            price: '0.5'
        },
        {
            id: 'BI103',
            name: 'Usb',
            category1: 'Electronics',
            category2: 'Usb / Cable',
            itemType: Iyzipay.BASKET_ITEM_TYPE.PHYSICAL,
            price: '0.2'
        }
    ]
};

iyzipay.payment.create(request, function (err, result) {
    console.log(err, result);
    done();
});

You can see further examples in test/samples folder, and run them by npm run-script samples

Mock test cards

Test cards that can be used to simulate a successful payment:

Card NumberBankCard Type
5890040000000016AkbankMaster Card (Debit)
5526080000000006AkbankMaster Card (Credit)
4766620000000001DenizbankVisa (Debit)
4603450000000000DenizbankVisa (Credit)
4729150000000005Denizbank BonusVisa (Credit)
4987490000000002FinansbankVisa (Debit)
5311570000000005FinansbankMaster Card (Credit)
9792020000000001FinansbankTroy (Debit)
9792030000000000FinansbankTroy (Credit)
5170410000000004Garanti BankasıMaster Card (Debit)
5400360000000003Garanti BankasıMaster Card (Credit)
374427000000003Garanti BankasıAmerican Express
4475050000000003HalkbankVisa (Debit)
5528790000000008HalkbankMaster Card (Credit)
4059030000000009HSBC BankVisa (Debit)
5504720000000003HSBC BankMaster Card (Credit)
5892830000000000Türkiye İş BankasıMaster Card (Debit)
4543590000000006Türkiye İş BankasıVisa (Credit)
4910050000000006VakıfbankVisa (Debit)
4157920000000002VakıfbankVisa (Credit)
5168880000000002Yapı ve Kredi BankasıMaster Card (Debit)
5451030000000000Yapı ve Kredi BankasıMaster Card (Credit)

Cross border test cards:

Card NumberCountry
4054180000000007Non-Turkish (Debit)
5400010000000004Non-Turkish (Credit)

Test cards to get specific error codes:

Card NumberDescription
5406670000000009Success but cannot be cancelled, refund or post auth
4111111111111129Not sufficient funds
4129111111111111Do not honour
4128111111111112Invalid transaction
4127111111111113Lost card
4126111111111114Stolen card
4125111111111115Expired card
4124111111111116Invalid cvc2
4123111111111117Not permitted to card holder
4122111111111118Not permitted to terminal
4121111111111119Fraud suspect
4120111111111110Pickup card
4130111111111118General error
4131111111111117Success but mdStatus is 0
4141111111111115Success but mdStatus is 4
41511111111111123dsecure initialize failed

Mock APM Accounts

Mock APM Accounts that can be used to simulate a payment with alternative payment method:

Account Holder NameDescription
successSucceeded payment after succeeded initialize
fail-after-initFailed payment after succeeded initialize
errorFailed initialize

Testing

You need to have mocha installed on your machine in order to run tests.

npm test

Author

Originally by Huseyin Babal (huseyinbabal88@gmail.com). Now officially maintained by iyzico.

Keywords

FAQs

Package last updated on 02 Dec 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc