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

Payments

Matheus B. Nakaya edited this page Jul 4, 2018 · 16 revisions

Introduction

The payment is a financial transaction that occurs between the customer and the receiver (it means, probably you).

Features

Index

Create payment

Authorization able
Basic Auth
OAuth

Pay with credit card

TO DO

Pay with credit card hash

The Credit Card Hash is...

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

Map<String, Object> phone = new HashMap<>();
phone.put("countryCode", "55");
phone.put("areaCode", "11");
phone.put("number", "66778899");

Map<String, Object> holder = new HashMap<>();
holder.put("fullname", "Portador Teste Moip");
holder.put("birthdate", "1988-12-30");
holder.put("taxDocument", taxDocument);
holder.put("phone", phone);

Map<String, Object> creditCard = new HashMap<>();
creditCard.put("hash", "CREDIT_CARD_HASH");
creditCard.put("store", false);
creditCard.put("holder", holder);

Map<String, Object> fundingInstrument = new HashMap<>();
fundingInstrument.put("method", "CREDIT_CARD");
fundingInstrument.put("creditCard", creditCard);

Map<String, Object> payment = new HashMap<>();
payment.put("installmentCount", 1);
payment.put("statementDescriptor", "minhaLoja.com");
payment.put("fundingInstrument", fundingInstrument);

Map<String, Object> newPay = payment.pay(payment, "order_id", setup);

Pay with boleto

Map<String, Object> instructionLines = new HashMap<>();
instructionLines.put("first", "First instruction line!");
instructionLines.put("second", "Second instruction line!");
instructionLines.put("third", "Third instruction line!");

Map<String, Object> boleto = new HashMap<>();
boleto.put("expirationDate", "2020-06-20");
boleto.put("instructionLines", instructionLines);
boleto.put("logoUri", "http://www.lojaexemplo.com.br/logo.jpg");

Map<String, Object> fundingInstrument = new HashMap<>();
fundingInstrument.put("method", "BOLETO");
fundingInstrument.put("boleto", boleto);

Map<String, Object> payment = new HashMap<>();
payment.put("installmentCount", 1);
payment.put("statementDescriptor", "minhaLoja.com");
payment.put("fundingInstrument", fundingInstrument);

Map<String, Object> newPay = payment.pay(payment, "order_id", setup);

Pay with online bank debit

Map<String, Object> onlineBankDebit = new HashMap<>();
onlineBankDebit.put("bankNumber", 341);
onlineBankDebit.put("expirationDate", "2017-11-22");

Map<String, Object> fundingInstrument = new HashMap<>();
fundingInstrument.put("method", "ONLINE_BANK_DEBIT");
fundingInstrument.put("onlineBankDebit", onlineBankDebit);

Map<String, Object> payment = new HashMap<>();
payment.put("installmentCount", 1);
payment.put("statementDescriptor", "minhaLoja.com");
payment.put("fundingInstrument", fundingInstrument);

Map<String, Object> newPay = payment.pay(payment, "order_id", setup);

Create pre-authorized payment

Authorization able
Basic Auth
OAuth
Map<String, Object> onlineBankDebit = new HashMap<>();
onlineBankDebit.put("bankNumber", 341);
onlineBankDebit.put("expirationDate", "2017-11-22");

Map<String, Object> fundingInstrument = new HashMap<>();
fundingInstrument.put("method", "ONLINE_BANK_DEBIT");
fundingInstrument.put("onlineBankDebit", onlineBankDebit);

Map<String, Object> payment = new HashMap<>();
payment.put("installmentCount", 1);
payment.put("statementDescriptor", "minhaLoja.com");
payment.put("delayCapture", true);
payment.put("fundingInstrument", fundingInstrument);

Map<String, Object> newPreAuthorizedPayment = payment.pay(payment, "order_id", setup);

Capture pre-authorized payment

Authorization able
Basic Auth
OAuth
Map<String, Object> newConvertion = payment.capturePreAuthorized("pre_authorized_payment_id", setup);

Cancel pre-authorized payment

Authorization able
Basic Auth
OAuth
Map<String, Object> newCancel = payment.cancelPreAuthorized("pre_authorized_payment_id", setup);

Get payment

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

Authorize payment in Sandbox

Authorization able
Basic Auth
OAuth
Map<String, Object> newAuthorize = payment.authorize("payment_id", 9500, setup);
Clone this wiki locally