Vexor

vexor.pay()

Payment Creation

The vexor.pay() method allows you to create payment checkouts for various platforms. It supports both a generic method and platform-specific shortcuts.

The vexor.pay() method and its platform-specific shortcuts (vexor.pay.mercadopago(), vexor.pay.stripe(), vexor.pay.paypal(), vexor.pay.talo()) can be used after instantiating Vexor with the project ID and publishable key. The secret key is not mandatory for this method.

Methodvexor.pay(params)

vexor.pay()

Create a payment checkout for a specified platform.

Parameters

Returns

Returns a Promise that resolves to a VexorPaymentResponse object.

const response : VexorPaymentResponse = await vexor.pay({
  platform: 'stripe',
  items: [
    {
      title: 'Product Name',
      description: 'Product Description',
      quantity: 1,
      unit_price: 10.99
    }
  ],
  options: {
    successRedirect: 'https://example.com/success',
    failureRedirect: 'https://example.com/failure'
  }
});

Usage Examples

Here are some examples of how to use the vexor.pay() method:

Generic Usage

  • Generic usage:
const response : VexorPaymentResponse = await vexor.pay({
  platform: 'stripe', // or 'mercadopago' or 'paypal' or 'square' or 'talo'
  items: [
    {
      title: 'T-shirt',
      description: 'Comfortable cotton t-shirt',
      quantity: 2,
      unit_price: 19.99
    }
  ],
  options: {
    successRedirect: 'https://mystore.com/success',
    failureRedirect: 'https://mystore.com/failure'
  }
});

vexor.pay.stripe()

  • Platform-specific shortcut for Stripe:
const response : VexorPaymentResponse = await vexor.pay.stripe({items: [itemsArray]});

vexor.pay.mercadopago()

  • Platform-specific shortcut for MercadoPago:
const response : VexorPaymentResponse = await vexor.pay.mercadopago({items: [itemsArray]});

vexor.pay.paypal()

  • Platform-specific shortcut for PayPal:
const response : VexorPaymentResponse = await vexor.pay.paypal({items: [itemsArray]});

vexor.pay.talo()

  • Platform-specific shortcut for Talo:
const response : VexorPaymentResponse = await vexor.pay.talo({
  items: [itemsArray],
  options: {
    currency: "ARS" // This is required by Talo
  }
});

vexor.pay.square()

  • Platform-specific shortcut for Square:
const response : VexorPaymentResponse = await vexor.pay.square({items: [itemsArray]});

Choose the method that best fits your application's needs and the payment platform you're using.

OptionsPlatform-specific methods can also accept additional options

The vexor.pay() method and its platform-specific shortcuts (vexor.pay.mercadopago(), vexor.pay.stripe(), vexor.pay.paypal(), vexor.pay.square(), vexor.pay.talo()) all return a Promise that resolves to a VexorPaymentResponse object. This object contains the payment URL, a unique identifier, and the raw response from the payment platform.

On this page