-
Notifications
You must be signed in to change notification settings - Fork 4
Payments
Lucas Garcia edited this page Sep 6, 2018
·
16 revisions
The payment is a financial transaction that occurs between the customer and the receiver (it means, probably you).
import static br.com.moip.helpers.PayloadFactory.payloadFactory;
import static br.com.moip.helpers.PayloadFactory.value;
Index
Authorization | able |
---|---|
Basic Auth (except if created with escrow ) |
✅ |
OAuth | ✅ |
Map<String, Object> taxDocument = payloadFactory(
value("type", "CPF"),
value("number", "33333333333")
);
Map<String, Object> phone = payloadFactory(
value("countryCode", "55"),
value("areaCode", "11"),
value("number", "66778899")
);
Map<String, Object> holder = payloadFactory(
value("fullname", "Portador Teste Moip"),
value("birthdate", "1988-12-30"),
value("taxDocument", taxDocument),
value("phone", phone)
);
Map<String, Object> creditCard = payloadFactory(
value("number", 5555666677778884),
value("cvc", 123),
value("expirationMonth", 12),
value("expirationYear", 24),
value("holder", holder)
);
Map<String, Object> fundingInstrument = payloadFactory(
value("method", "CREDIT_CARD"),
value("creditCard", creditCard)
);
Map<String, Object> payment = payloadFactory(
value("installmentCount", 1),
value("statementDescriptor", "minhaLoja.com"),
value("fundingInstrument", fundingInstrument)
);
Map<String, Object> newPay = Moip.API.payments().pay(payment, "order_id", setup);
The Credit Card Hash is an encrypted version of the credit card. This encryption must occur on the front-end using our Javascript Encryption SDK.
Map<String, Object> taxDocument = payloadFactory(
value("type", "CPF"),
value("number", "33333333333")
);
Map<String, Object> phone = payloadFactory(
value("countryCode", "55"),
value("areaCode", "11"),
value("number", "66778899")
);
Map<String, Object> holder = payloadFactory(
value("fullname", "Portador Teste Moip"),
value("birthdate", "1988-12-30"),
value("taxDocument", taxDocument),
value("phone", phone)
);
Map<String, Object> creditCard = payloadFactory(
value("hash", "CREDIT_CARD_HASH"),
value("holder", holder)
);
Map<String, Object> fundingInstrument = payloadFactory(
value("method", "CREDIT_CARD"),
value("creditCard", creditCard)
);
Map<String, Object> payment = payloadFactory(
value("installmentCount", 1),
value("statementDescriptor", "minhaLoja.com"),
value("fundingInstrument", fundingInstrument)
);
Map<String, Object> newPay = Moip.API.payments().pay(payment, "order_id", setup);
Map<String, Object> instructionLines = payloadFactory(
value("first", "First instruction line!"),
value("second", "Second instruction line!"),
value("third", "Third instruction line!")
)
Map<String, Object> boleto = payloadFactory(
value("expirationDate", "2020-06-20"),
value("instructionLines", instructionLines),
value("logoUri", "http://www.lojaexemplo.com.br/logo.jpg")
);
Map<String, Object> fundingInstrument = payloadFactory(
value("method", "BOLETO");
value("boleto", boleto);
);
Map<String, Object> payment = payloadFactory(
value("installmentCount", 1),
value("statementDescriptor", "minhaLoja.com"),
value("fundingInstrument", fundingInstrument)
);
Map<String, Object> newPay = Moip.API.payments().pay(payment, "order_id", setup);
Map<String, Object> onlineBankDebit = payloadFactory(
value("bankNumber", 341),
value("expirationDate", "2017-11-22")
);
Map<String, Object> fundingInstrument = payloadFactory(
value("method", "ONLINE_BANK_DEBIT"),
value("onlineBankDebit", onlineBankDebit)
);
Map<String, Object> payment = payloadFactory(
value("installmentCount", 1),
value("statementDescriptor", "minhaLoja.com"),
value("fundingInstrument", fundingInstrument)
);
Map<String, Object> newPay = Moip.API.payments().pay(payment, "order_id", setup);
Map<String, Object> onlineBankDebit = payloadFactory(
value("bankNumber", 341),
value("expirationDate", "2017-11-22")
);
Map<String, Object> fundingInstrument = payloadFactory(
value("method", "ONLINE_BANK_DEBIT"),
value("onlineBankDebit", onlineBankDebit)
);
Map<String, Object> payment = payloadFactory(
value("installmentCount", 1),
value("statementDescriptor", "minhaLoja.com"),
value("delayCapture", true),
value("fundingInstrument", fundingInstrument)
);
Map<String, Object> newPreAuthorizedPayment = Moip.API.payments().pay(payment, "order_id", setup);
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> capture = Moip.API.payments().capturePreAuthorized("payment_id", setup);
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> newCancel = Moip.API.payments().cancelPreAuthorized("payment_id", setup);
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> getResponse = Moip.API.payments().get("payment_id", setup);
Authorization | able |
---|---|
Basic Auth | ✅ |
OAuth | ✅ |
Map<String, Object> newAuthorize = Moip.API.payments().authorize("payment_id", 9500, setup);