Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
var request = require('request');

request({
	url: 'https://sandbox.pagbrasil.com/api/pagstream/subscription/add',
	method: 'POST',
	form: {
		secret: 'input_your_secret',
		pbtoken: 'input_your_token',
		product_name: 'Product Test (1 license)',
		customer_name: 'José da Silva',
		customer_taxid: '91051605962',
		customer_email: 'josedasilva@myemail.com.br',
		customer_phone: '11 3328.9999',
		address_street: 'Av.Paulista, 100',
		address_zip: '01311100',
		address_city: 'São Paulo',
		address_state: 'SP',
		amount_brl: '39.50',
		next_billing_date: '2020-12-01',
		frequency: 'M',
		cc_installments: '1',
		cc_holder: 'joao da silva',
		cc_number: '4984123412341234',
		cc_expiration: '12/29',
		cc_cvv: '123'
		}},

	function (error, response, body) {
		if (!error && response.statusCode == 200) {
			console.log(body);
		}
	}
);

...

9.5. Response:

Code Block
languagexml
<?xml version="1.0" encoding="ISO-8859-1"?>
 <request>
 <subscription>1234567890</subscription>
 <status>2</status>
 <amount_brl>39.50</amount_brl>
 </request>

...