@guachos/bidaiondo-client
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

bidaiondo-client

A simple javascript client for the Bidaiondo API. This library is built to be used with ECS and legacy CJS projects

Install

npm i @guachos/bidaiondo-client

Usage

  • ESM
import { Client as BidaClient } from '@guachos/bidaiondo-client';

async function test() {
  const data = {
    commerce: 'xxxxxxxx',
  }
  const cards = await BidaClient.requestCardInfo({
    data,
  })
  console.log(cards);

  // do something else
}
  • CJS
const BidaClient = require('@guachos/bidaiondo-client').Client;

async function test() { 
  const data = {
    commerce: 'xxxxxxxxx',
  }
  const cards = await BidaClient.requestCardInfo({
    data,
  })
  console.log(cards);

  // do something else
}

Integration on payment Flows (Example)

NOTE: (from Bidaiondo Doc)

"Integration with third parties The merchant integration process will be carried out by Form through one of the following ways:

  1. Transfer of control to the Bidaiondo platform.
  2. Incorporation of the form in an iframe of the business. ** ** This environment only works for payments that are made without the Merchant application Secure Electronic (Unsecured Gateways)."
  • requestPayment
import { Client as BidaClient } from '@guachos/bidaiondo-client';

async function paymentFlow() {
  // do something

  const validCards = await BidaClient.requestCardInfo({
    data: {
      commerce: 'commerce-ID',
    }
  })
  //obtain valid cards or error

  //Check reqeusted `amex` vs valid cards (interrupt payment on error)

  const data = {
    commerce: 'commerce-ID',
    transaction: 'tx-id',
    amount: 1000,
    currency: '978',
    amex: '2',
    language: 'es',
    gateway: '75',
  }

  const paymentResult = await BidaClient.requestPayment({
    data: data,
    key: 'commerce-KEY',
  })

  //obtain form or error

  // do something else
}
  • requestRefund
import { Client as BidaClient } from '@guachos/bidaiondo-client';

async function paymentFlow() {
  // do something

  const data = {
    commerce: 'commerce-ID',
    transaction: 'tx-id',
    amount: 1000,
    currency: '978',
  }

  const refundResult = await BidaClient.requestRefund({
    data: data,
    key: 'commerce-KEY',
  })

  //obtain form or error

  // do something else
}

Supported amex codes

code description
'1' AMERICAN_EXPRESS
'2' VISA
'3' MASTERCARD
'4' DINNERS_CLUB
'5' JCB
'9' MASTERCARD_MAESTRO
'10' VISA_ELECTRON
'11' VIRTUAL_CARD
'12' BIZUM
'13' LUPAY
'14' DISCOVER_GLOBAL

Supported currency codes

see: https://es.iban.com/currency-codes

code description
840 USD
978 EUR
124 CAD
... ...

Supported gateway codes

NOTE: deppend on amex

code description
75 insecure gateway
81 secure gateway

Supported language codes

  • es: Spanish
  • en: English

Package Sidebar

Install

npm i @guachos/bidaiondo-client

Weekly Downloads

0

Version

0.2.1

License

ISC

Unpacked Size

20.3 kB

Total Files

5

Last publish

Collaborators

  • alexbd9106
  • destbreso
  • alejulian9119
  • guajiritos