- Java >= 6 && <= 8
PagarMe.init("api_key");
transaction = new Transaction();
transaction.setAmount(100);
transaction.setPaymentMethod(Transaction.PaymentMethod.CREDIT_CARD);
transaction.setCardHolderName("Lucas Dos Santos Alves");
transaction.setCardExpirationDate("0916");
transaction.setCardCvv("401");
transaction.setCardNumber("4111111111111111");
transaction.setInstallments(1);
transaction.setCapture(true);
transaction.save();
#### Creating customer object
Customer customer = new Customer();
customer.setName("lucas santos");
customer.setDocumentNumber("15317529506");
customer.setEmail("[email protected]");
#### Creating customer address object
Address address = new Address();
address.setStreet("Rua Piraju");
address.setStreetNumber("218");
address.setComplementary("ao lado da consigáz");
address.setNeighborhood("Interlagos");
address.setZipcode("29045482");
#### Creating customer phone object
Phone phone = new Phone();
phone.setDdd("11");
phone.setNumber("55284132");
#### Adding address & phone on the customer object
customer.setAddress(address);
customer.setPhone(phone);
#### Adding customer object to transaction object and create transaction
transaction.setCustomer(customer);
transaction.save();
transaction = new Transaction();
transaction.setAmount(100);
transaction.setPaymentMethod(Transaction.PaymentMethod.BOLETO);
transaction.save();
transaction = new Transaction();
transaction.find("transaction_id");
transaction = new Transaction();
transaction.findCollection(10,0);
transaction = new Transaction();
transaction.find("transaction_id");
transaction.refund(50);
#### Creating customer object
Customer customer = new Customer();
customer.setName("lucas santos");
customer.setDocumentNumber("15317529506");
customer.setEmail("[email protected]");
#### Creating customer address object
Address address = new Address();
address.setStreet("Rua Piraju");
address.setStreetNumber("218");
address.setComplementary("ao lado da consigáz");
address.setNeighborhood("Interlagos");
address.setZipcode("29045482");
#### Creating customer phone object
Phone phone = new Phone();
phone.setDdd("11");
phone.setNumber("55284132");
#### Adding address & phone on the customer object
customer.setAddress(address);
customer.setPhone(phone);
#### Save customer
customer.save();
Customer customer = new Customer();
customer.find("customer_id");
Customer customer = new Customer();
customer.findCollection(10,0);
int amount = 100;
int days = 30;
int charges = 100;
int installments = 2;
int trialDays = 3;
String name = "Plano teste";
String color = "#bababa";
Plan plan = new Plan();
plan.setCreationParameters(amount, days, name);
plan.setPaymentMethods(Arrays.asList(
PaymentMethod.BOLETO, PaymentMethod.CREDIT_CARD
));
plan.setCharges(charges);
plan.setColor(color);
plan.setInstallments(installments);
plan.setTrialDays(trialDays);
plan.save();
Integer planId = 999;
Plan plan = new Plan();
plan.find(planId);
Plan plan = new Plan();
plan.findCollection(10,0);
Subscription subscription = new Subscription();
subscription.setCreditCardSubscriptionWithCardId(planId, cardId, customer);
subscription.save();
Subscription subscription2 = new Subscription();
subscription2.setCreditCardSubscriptionWithCardHash(planId, cardHash, customer);
subscription2.save();
Subscription subscription3 = new Subscription();
subscription3.setBoletoSubscription(planId, customer);
subscription3.save();
Integer subscriptionId = 999;
Subscription foundSubscription = new Subscription().find(subscriptionId);
Collection<Subscription> subscriptions = new Subscription().findCollection(10, 1);
Integer subscriptionId = 999;
Subscription subscription = new Subscription();
subscription.find(subscriptionId);
subscription.cancel();
Integer subscriptionId = 999;
Subscription subscription = new Subscription();
subscription.find(subscriptionId);
Collection<Transaction> transactions = subscription.transactions();
development based on library pagarme-java Adriano Luis