Giter VIP home page Giter VIP logo

Comments (1)

codingwithmanny avatar codingwithmanny commented on June 19, 2024

The package is published here, but it's still a work in progress:

https://www.npmjs.com/package/@codingwithmanny/iyzipay-js

You can also see how it works currently with NextJS App Router API Router.

Example:

File: ./app/api/test/route.ts

// Imports
import Iyzipay from "@codingwithmanny/iyzipay-js";

// Config
const client = Iyzipay({
  apiKey: `${process.env.IYZICO_API_KEY}`,
  secretKey: `${process.env.IYZICO_SECRET_KEY}`,
});

// Route
export async function GET(_request: Request) {
  const response = await client.payment.checkoutForm.create({
    locale: 'tr',
    conversationId: '023456789',
    price: '1.0',
    basketId: 'B67832',
    paymentGroup: 'PRODUCT',
    buyer: {
      id: 'BY789',
      name: 'John',
      surname: 'Doe',
      identityNumber: '74300864791',
      email: '[email protected]',
      gsmNumber: '+905350000000',
      registrationDate: '2013-04-21 15:12:09',
      lastLoginDate: '2015-10-05 12:43:35',
      registrationAddress: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
      city: 'Istanbul',
      country: 'Turkey',
      zipCode: '34732',
      ip: '85.34.78.112'
    },
    shippingAddress: {
      address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
      zipCode: '34742',
      contactName: 'Jane Doe',
      city: 'Istanbul',
      country: 'Turkey'
    },
    billingAddress: {
      address: 'Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1',
      zipCode: '34742',
      contactName: 'Jane Doe',
      city: 'Istanbul',
      country: 'Turkey'
    },
    basketItems: [
      {
        id: 'BI101',
        price: '0.3',
        name: 'Binocular',
        category1: 'Collectibles',
        category2: 'Accessories',
        itemType: 'PHYSICAL'
      },
      {
        id: 'BI102',
        price: '0.5',
        name: 'Game code',
        category1: 'Game',
        category2: 'Online Game Items',
        itemType: 'VIRTUAL'
      },
      {
        id: 'BI103',
        name: 'Usb',
        price: '0.2',
        category1: 'Electronics',
        category2: 'Usb / Cable',
        itemType: 'PHYSICAL'
      }
    ],
    enabledInstallments: [ 1, 2, 3, 6, 9 ],
    callbackUrl: 'https://www.merchant.com/callback',
    currency: 'TRY',
    paidPrice: '1.2'
  });

  return new Response(JSON.stringify({ data: response }));
}

from iyzipay-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.