Last updated
These docs are intended for a developer audience.Dismiss

Manage payment instrument options

This topic describes how to manage payment instrument options using the Rebilly Instruments JavaScript library.

Basic payment instrument management setup

Important

This topic assumes that you have already completed one of the Get started guides, and are looking to customize or extend the functionality.

Payment methods that are displayed in payment forms are based on the gateway configuration. For more information, see Set up a payment gateway.

This example describes the basic setup for payment instrument management using the Rebilly Instrument JavaScript library. It only displays payment methods for which the customer has existing payment instruments. If the customer does not have any existing instruments, no methods are displayed.

For this example, you do not need to add purchase data.

In this example, features.hideContinue is set to true, which prevents the customer from proceeding to perform a payment. This ensures that only payment instrument management is allowed.

Example

import RebillyInstruments from '@rebilly/instruments';

RebillyInstruments.mount({
  jwt: 'jwt-example',
  apiMode: 'sandbox',
  paymentInstruments: {
    allowDeactivate: true,
    allowUpdate: true,
    allowMakeDefault: true,
    allowCreate: true,
  },
  features: {
    hideContinue: true,
  },
});

Manage payment instruments options

The following can be specified in the options property of the RebillyInstruments.mount method:

  • allowDeactivate: Allows the customer to deactivate payment instruments.
  • allowUpdate: Allows the customer to update payment instruments.
  • allowMakeDefault: Allows the customer to set a default payment instrument.
  • allowCreate: Allows the customer to create new payment instruments.

Advanced payment instrument management setup

This example describes the advanced setup for payment instrument management using the Rebilly Instrument JavaScript library. This setup provides purchase data, which facilitates the use of any payment methods that are permitted for the provided purchase data.

If no specific payment is expected, use the money purchase data type for a minimum value. Payment gateways that accept this minimum value must be configured to display this payment method.

Payment methods that are displayed in payment forms are based on the gateway configuration. For more information, see Set up a payment gateway.

Example

import RebillyInstruments from '@rebilly/instruments';

RebillyInstruments.mount({
  jwt: 'jwt-example',
  apiMode: 'sandbox',
  money: {
    amount: 1,
    currency: 'USD',
  },
  paymentInstruments: {
    allowDeactivate: true,
    allowUpdate: true,
    allowMakeDefault: true,
    allowCreate: true,
  },
  features: {
    hideContinue: true,
  },
});

Payment instrument management during payment

To enable payment flows with any purchase data, remove or set the features.hideContinue flag to false.