1.1.7 • Published 2 years ago

@novo-x/stripe v1.1.7

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Stripe Service

Available methods

  • createCardPaymentMethod: creates a payment method
  • attachPaymentMethodToCustomer: attach payment method to existent customer
  • detachPaymentMethodFromCustomer: detach payment method from existent customer
  • getCouponData: retrieves a specific coupon
  • getPaymentIntent: retrieves a payment intent
  • createPaymentIntent: creates a payment intent
  • createCustomer: creates a customer
  • createSetupIntent: creates a setup intent
  • retrieveFirstPaymentMethodFromCustomer: retrieves the first payment method of an existent customer
  • refund: refunds a payment intent

Usage examples

yarn add @novo-x/stripe

import {StripeService} from "@novo-x/stripe"

const MyService = new StripeService(
    '123456789', // apiKey
    {
        apiVersion: '2020-08-27',
        typescript: true,
    }, // config,
);

const paymentMethod = await MyService.createCardPaymentMethod({
    cardNumber: '1234123412341234',
    expirationMonth: 07,
    expirationYear: 2027,
    cvc: '123'
});

const paymentMethod = await MyService.attachPaymentMethodToCustomer(
    '123456789', // stripePaymentMethodId: 
    '123456789' // stripeCustomerId
);

const paymentMethod = await MyService.detachPaymentMethodFromCustomer(
    '123456789' // stripePaymentMethodId
);

const coupon = await MyService.getCouponData(
    '123456789' // couponId
);

const paymentIntent = await MyService.createPaymentIntent({
    amount: 120,
    paymentMethodId: '123456789',
    currency: 'EUR',
    statement: 'Smartphone purchase',
    withConnectId: true,
    stripeConnectId: '123456789',
    fee: 10
});

const paymentIntent = await MyService.getPaymentIntent(
    '123456789' // paymentIntentId
);

const customer = await MyService.createCustomer({
    email: 'email@email.com',
    name: 'Stripe Customer',
    phone: '123456789'
};
    
const setupIntent = await MyService.createSetupIntent({
    id: '123456789' // stripe customer's id (previously created)
});

const paymentMethod = await MyService.retrieveFirstPaymentMethodFromCustomer(
    '123456789' // stripe customer's id
);

const refund = await MyService.refund({
    amount: 10,
    refundFee: true,
    reason: 'Requested by the customer',
    paymentIntent: '123456789',
    reverseTransfer: true
});

Dependencies

stripe

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago