Skip to content

Recurrence products

netorodrigues edited this page Mar 10, 2021 · 5 revisions

Recurrence Configuration

The first thing to do to use the recurrence function is to create recurrent products based on the current platform products and configure them.

In your admin panel, go to Pagar.me > Recurrence Products:

After that, select "Add new Recurrence Product":

Them, choose an existing product in your store to make it recurrent:

After that, just configure your recurring products as you see fit. You can:

  1. Define payment methods; (credit card or boleto)
  2. Allow or not installments;
  3. Allow the product to be sold normally, as recurrent or both;

In addition, the recurrence settings:

  1. Interval / period size;
  2. Interval Type; (monthly or anually)
  3. Recurrence Price; (value to be charged in each cycle)
  4. Number of cycles that the subscription will have;

Them, your recurrent product is created. For each recurrent product, you can perform these actions:

  1. Edit the product
  2. Delete the product

After defining the recurrent product, you can also configure the recurrence rules for your store. In general payment settings,there is a tab for the recurrence settings, there you can:

  1. Enable or disable recurrence in your store;
  2. Show recurrent prices in your product details;
  3. Allow or deny the purchase of recurring products and regular products in the same cart. If denied, you can customize the conflict message.
  4. Allow or deny the purchase of more than one recurring product in the same cart. If denied, you can customize the conflict message.

After all the step by step, your recurring products will be available to be purchased. And when purchased, they will appear in the Pagar.me > Subscriptions space:

There, you have access to invoice details from subscriptions. You can also cancel a subscription.

Interacting via API

To optimize the task of creation of recurring products and the actions related to the subscription as a whole, we provide an API so that an integration can be developed to automate these manual flows dependent on the platform interface.

We developed a collection on Postman so that everything can be done via API. Is possible to:

  1. Create, edit and delete recurrent products;
  2. List and cancel subscriptions;
  3. List and cancel invoices;
  4. Generate authentication tokens with our API: To generate the token and use it to authenticate with our API, it is necessary to use username and password as keys to generate the token.

The used URL will be: http://domíniodasualoja/rest/default/V1/pagarme/recurrence

The collection is available in the following link: https://www.getpostman.com/collections/d9b2e96c1d6a04fcfe7d

You just need to define an Environment in Postman like the following:

{
	"id": "24c5ad09-3cca-4bbe-a319-9c6dbc89ca06",
	"name": "Magento 2 recurrence api Example",
	"values": [
		{
			"key": "url",
			"value": "https://mydomain.com/rest/default/V1/pagarme/recurrence",
			"enabled": true
		},
		{
			"key": "admin_username",
			"value": "Administrator panel username",
			"enabled": true
		},
		{
			"key": "admin_password",
			"value": "Administrator panel password",
			"enabled": true
		},
		{
			"key": "url_magento",
			"value": "http://mydomain.com",
			"enabled": true
		}
	],
	"_postman_variable_scope": "environment",
	"_postman_exported_at": "2021-03-10T17:43:19.982Z",
	"_postman_exported_using": "Postman/7.36.5"
}
Clone this wiki locally