Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Refunds

Matheus B. Nakaya edited this page Jul 5, 2018 · 7 revisions

Introduction

That is the scariest topic for the seller. 😨

But relax... It will not hurt, I promise!

We know, when its happening is very bad. But don't worry, we have a excellent risk analysis team, and we work hard to give you all security that you need to be happy and worry only about your business. 🤑🎉

Features

Index

Refund payment

Authorization able
Basic Auth
OAuth

Refund to credit card

Map<String, Object> newRefund = refund.refundPayment("payment_id", setup);

Refund to bank account

Map<String, Object> taxDocument = new HashMap<>();
taxDocument.put("type", "CPF");
taxDocument.put("number", "57390209674");

Map<String, Object> holder = new HashMap<>();
holder.put("fullname", "Jose Silva");
holder.put("taxDocument", taxDocument);

Map<String, Object> bankAccount = new HashMap<>();
bankAccount.put("type", "CHECKING");
bankAccount.put("bankNumber", "001");
bankAccount.put("agencyNumber", 4444444);
bankAccount.put("agencyCheckNumber", 2);
bankAccount.put("accountNumber", 1234);
bankAccount.put("accountCheckNumber", 1);
bankAccount.put("holder", holder);

Map<String, Object> refundingInstrument = new HashMap<>();
refundingInstrument.put("method", "BANK_ACCOUNT");
refundingInstrument.put("bankAccount", bankAccount);

Map<String, Object> refundBankAccount = new HashMap<>();
refundBankAccount.put("refundingInstrument", refundingInstrument);

Map<String, Object> newRefund = refund.refundPayment(refundBankAccount, "payment_id", setup);

Refund to Moip account

Map<String, Object> moipAccount = new HashMap<>();
moipAccount.put("id", "moip_account_id");

Map<String, Object> refundingInstrument = new HashMap<>();
refundingInstrument.put("method", "MOIP_ACCOUNT");
refundingInstrument.put("moipAccount", moipAccount);

Map<String, Object> refundMoipAccount = new HashMap<>();
refundMoipAccount.put("amount", "500");
refundMoipAccount.put("refundingInstrument", refundingInstrument);

Map<String, Object> newRefund = refund.refundPayment(refundMoipAccount, "payment_id", setup);

Refund order

Authorization able
Basic Auth
OAuth

Refund to credit card

Map<String, Object> newRefund = refund.refundOrder("order_id", setup);

Refund to bank account

Map<String, Object> taxDocument = new HashMap<>();
taxDocument.put("type", "CPF");
taxDocument.put("number", "57390209674");

Map<String, Object> holder = new HashMap<>();
holder.put("fullname", "Jose Silva");
holder.put("taxDocument", taxDocument);

Map<String, Object> bankAccount = new HashMap<>();
bankAccount.put("type", "CHECKING");
bankAccount.put("bankNumber", "001");
bankAccount.put("agencyNumber", 4444444);
bankAccount.put("agencyCheckNumber", 2);
bankAccount.put("accountNumber", 1234);
bankAccount.put("accountCheckNumber", 1);
bankAccount.put("holder", holder);

Map<String, Object> refundingInstrument = new HashMap<>();
refundingInstrument.put("method", "BANK_ACCOUNT");
refundingInstrument.put("bankAccount", bankAccount);

Map<String, Object> refundBankAccount = new HashMap<>();
refundBankAccount.put("refundingInstrument", refundingInstrument);

Map<String, Object> newRefund = refund.refundOrder(refundBankAccount, "order_id", setup);

Refund to Moip account

Map<String, Object> moipAccount = new HashMap<>();
moipAccount.put("id", "moip_account_id");

Map<String, Object> refundingInstrument = new HashMap<>();
refundingInstrument.put("method", "MOIP_ACCOUNT");
refundingInstrument.put("moipAccount", moipAccount);

Map<String, Object> refundMoipAccount = new HashMap<>();
refundMoipAccount.put("amount", "500");
refundMoipAccount.put("refundingInstrument", refundingInstrument);

Map<String, Object> newRefund = refund.refundOrder(refundMoipAccount, "order_id", setup);

Get refund

Authorization able
Basic Auth
OAuth
Map<String, Object> getResponse = refund.get("refund_id", setup);

List refunds of a payment

Authorization able
Basic Auth
OAuth
Map<String, Object> listPaymentRefundResponse = refund.listPaymentRefunds("payment_id", setup);

List refund of a order

Authorization able
Basic Auth
OAuth
Map<String, Object> listOrderRefundsResponse = refund.listOrderRefunds("order_id", setup);
Clone this wiki locally