Invoice

A collection of methods to retrieve a user's invoice history and process payments for outstanding invoices.

list

List all available invoices, filtered according to user's currency, location, and page language.

Example

const invoices = window.Pelcro.invoice.list();

console.log(invoices);

pay

Mark an invoice as paid. This will automatically charge the customer for the full amount. Emits the invoicePay DOM event when the response is returned successfully.

Example

window.Pelcro.invoice.pay({
  source_id: 12155,
  payment_gateway: 'payment_gateway',
  gateway_token: 'gateway_token'
}, (error, response) => {
  if (error) {
    return console.log("error", error.message);
  }

  const response = response.data;
  console.log(response);
});

Parameters

Parameter

Type

Description

source_id

number

The unique identifier of user's payment source, to be used for charging user

payment_gateway

string

Required with gateway_token if source_id is not set

Options: 'stripe', 'braintree', or 'vantiv'

gateway_token

string

Required with payment_gateway if source_id is not set