How to use pagarme - 5 common examples

To help you get started, we’ve selected a few pagarme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pagarme / artis / src / utils / strategies / pagarme.js View on Github external
const request = (data) => {
  const commonPayload = parseToPayload(data)
  const paymentData = ifElse(
    prop('cardId'),
    parseCardId,
    getPaymentMethodData,
  )(data)
  const fullPayload = merge(paymentData, commonPayload)

  if (propOr(true, 'createTransaction', data) === false) {
    if (commonPayload.payment_method === 'credit_card') {
      return pagarme.client
        .connect({ encryption_key: commonPayload.encryption_key })
        .then(client => client.security.encrypt(paymentData))
        .then(cardHash => (
          assoc(
            'card_hash',
            cardHash,
            omit([
              'card_cvv',
              'card_expiration_date',
              'card_holder_name',
              'card_number',
            ], fullPayload)
          )
        ))
    }

pagarme

A JavaScript library to interface with Pagar.me API

MIT
Latest version published 6 months ago

Package Health Score

60 / 100
Full package analysis

Popular pagarme functions

Similar packages