Payment payment = Payment.creator()
.setCustomer("cus_000050606806")
.setBillingType(BillingType.PIX)
.setDueDate(new Date())
.setValue(Money.create(new BigDecimal(10.01)))
.setDescription("Teste")
.create();
Payment payment = Payment.creator()
.setCustomer("cus_000072683114")
.setBillingType(BillingType.PIX)
.setDueDate(new Date())
.setInstallmentCount(2)
.setInstallmentValue(Money.create(50))
.setDescription("Teste")
.create();
Para estornar uma cobrança de forma total:
Payment.refunder(paymentId)
.create();
Para estornar parcialmente, informe o valor a ser estornado:
Payment.refunder(266093389L).setValue(new BigDecimal("10.0")).create();
ResourceSet<Payment> paymentResourceSet = Payment.reader().read();
Filtros também podem ser utilizados:
ResourceSet<Payment> paymentResourceSet = Payment.reader()
.setStatus(PaymentStatus.RECEIVED)
.read();
Filtrando pela data de vencimento:
ResourceSet<Payment> paymentResourceSet = Payment.reader()
.setStatus(PaymentStatus.RECEIVED)
.setStartPaymentDate(new Date())
.setFinishDueDate(new Date())
.read()
Payment.statusFetcher("ID").fetch();
Exemplo:
PaymentStatusData paymentStatusData = Payment.statusFetcher("pay_9087711026766517").fetch();
PaymentDeleted paymentDeleted = Payment.deleter(payment.getId()).delete();
Payment payment = Payment.restorer(payment.getId()).create();