Repository: mercadopago/sdk-java
Branch: master
Commit: 37c6a3be1db5
Files: 485
Total size: 1.1 MB
Directory structure:
gitextract_2_mobys_/
├── .code_quality/
│ └── checkstyle_rules.xml
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ ├── feature_request.yml
│ │ └── question.yml
│ └── workflows/
│ ├── main.yml
│ ├── maven-publish-release.yml
│ └── maven-publish-snapshot.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CODE_OF_CONDUCT.md
├── CODING_GUIDELINES.md
├── CONTRIBUTING.md
├── LICENSE
├── PULL_REQUEST_TEMPLATE.md
├── README.md
├── SUPPORT.md
├── build-gradle.sh
├── maven-central-deploy.sh
├── mp_ref_report.md
├── pom.xml
└── src/
├── main/
│ └── java/
│ └── com/
│ └── mercadopago/
│ ├── MercadoPagoConfig.java
│ ├── client/
│ │ ├── MercadoPagoClient.java
│ │ ├── cardtoken/
│ │ │ ├── CardTokenClient.java
│ │ │ └── CardTokenRequest.java
│ │ ├── common/
│ │ │ ├── AddressRequest.java
│ │ │ ├── IdentificationRequest.java
│ │ │ ├── InvoicePeriod.java
│ │ │ ├── PhoneRequest.java
│ │ │ ├── SubMerchant.java
│ │ │ └── SubscriptionSequence.java
│ │ ├── customer/
│ │ │ ├── CustomerAddressRequest.java
│ │ │ ├── CustomerCardClient.java
│ │ │ ├── CustomerCardCreateRequest.java
│ │ │ ├── CustomerClient.java
│ │ │ └── CustomerRequest.java
│ │ ├── identificationtype/
│ │ │ └── IdentificationTypeClient.java
│ │ ├── merchantorder/
│ │ │ ├── MerchantOrderClient.java
│ │ │ ├── MerchantOrderCreateRequest.java
│ │ │ ├── MerchantOrderItemRequest.java
│ │ │ ├── MerchantOrderPayerRequest.java
│ │ │ ├── MerchantOrderReceiverAddressCityRequest.java
│ │ │ ├── MerchantOrderReceiverAddressCountryRequest.java
│ │ │ ├── MerchantOrderReceiverAddressRequest.java
│ │ │ ├── MerchantOrderReceiverAddressStateRequest.java
│ │ │ ├── MerchantOrderShipmentRequest.java
│ │ │ ├── MerchantOrderShippingEstimatedDeliveryRequest.java
│ │ │ ├── MerchantOrderShippingOptionRequest.java
│ │ │ ├── MerchantOrderShippingSpeedRequest.java
│ │ │ └── MerchantOrderUpdateRequest.java
│ │ ├── oauth/
│ │ │ ├── CreateOauthCredentialRequest.java
│ │ │ ├── OauthClient.java
│ │ │ └── RefreshOauthCredentialRequest.java
│ │ ├── order/
│ │ │ ├── AdditionalInfoRequest.java
│ │ │ ├── OrderAutomaticPaymentsRequest.java
│ │ │ ├── OrderClient.java
│ │ │ ├── OrderConfigRequest.java
│ │ │ ├── OrderCreateRequest.java
│ │ │ ├── OrderDifferentialPricing.java
│ │ │ ├── OrderInvoicePeriodRequest.java
│ │ │ ├── OrderItemRequest.java
│ │ │ ├── OrderOnlineConfig.java
│ │ │ ├── OrderPayerAddressRequest.java
│ │ │ ├── OrderPayerRequest.java
│ │ │ ├── OrderPaymentMethodConfig.java
│ │ │ ├── OrderPaymentMethodRequest.java
│ │ │ ├── OrderPaymentRequest.java
│ │ │ ├── OrderPointConfig.java
│ │ │ ├── OrderReceiverAddressRequest.java
│ │ │ ├── OrderRefundPaymentRequest.java
│ │ │ ├── OrderRefundRequest.java
│ │ │ ├── OrderRouteRequest.java
│ │ │ ├── OrderShipmentRequest.java
│ │ │ ├── OrderStoredCredentialRequest.java
│ │ │ ├── OrderSubscriptionDataRequest.java
│ │ │ ├── OrderSubscriptionSequenceRequest.java
│ │ │ ├── OrderTransactionRequest.java
│ │ │ ├── OrderTransactionSecurity.java
│ │ │ ├── PassengerIdentification.java
│ │ │ ├── PayerInfo.java
│ │ │ ├── PlatformInfo.java
│ │ │ ├── PlatformShipment.java
│ │ │ ├── SellerAddress.java
│ │ │ ├── SellerIdentification.java
│ │ │ ├── SellerInfo.java
│ │ │ ├── SellerPhone.java
│ │ │ ├── ShipmentInfo.java
│ │ │ ├── TrackingInfo.java
│ │ │ ├── TravelInfo.java
│ │ │ ├── TravelPassengerRequest.java
│ │ │ └── TravelRouteRequest.java
│ │ ├── payment/
│ │ │ ├── PaymentAdditionalInfoBarcodeRequest.java
│ │ │ ├── PaymentAdditionalInfoPayerRequest.java
│ │ │ ├── PaymentAdditionalInfoRequest.java
│ │ │ ├── PaymentAmountsRequest.java
│ │ │ ├── PaymentAuthenticationRequest.java
│ │ │ ├── PaymentCancelRequest.java
│ │ │ ├── PaymentCaptureRequest.java
│ │ │ ├── PaymentCategoryDescriptorRequest.java
│ │ │ ├── PaymentClient.java
│ │ │ ├── PaymentCounterCurrencyRequest.java
│ │ │ ├── PaymentCreateRequest.java
│ │ │ ├── PaymentDataRequest.java
│ │ │ ├── PaymentDiscountRequest.java
│ │ │ ├── PaymentFeeRequest.java
│ │ │ ├── PaymentForwardDataRequest.java
│ │ │ ├── PaymentInvoicePeriodRequest.java
│ │ │ ├── PaymentItemRequest.java
│ │ │ ├── PaymentMerchantServicesRequest.java
│ │ │ ├── PaymentMethodRequest.java
│ │ │ ├── PaymentNetworkTransactionDataRequest.java
│ │ │ ├── PaymentOrderRequest.java
│ │ │ ├── PaymentPassengerRequest.java
│ │ │ ├── PaymentPayerAddressRequest.java
│ │ │ ├── PaymentPayerPhoneRequest.java
│ │ │ ├── PaymentPayerRequest.java
│ │ │ ├── PaymentPaymentReferenceRequest.java
│ │ │ ├── PaymentPointOfInteractionRequest.java
│ │ │ ├── PaymentReceiverAddressRequest.java
│ │ │ ├── PaymentRefundClient.java
│ │ │ ├── PaymentRefundCreateRequest.java
│ │ │ ├── PaymentRouteRequest.java
│ │ │ ├── PaymentRulesRequest.java
│ │ │ ├── PaymentShipmentsRequest.java
│ │ │ ├── PaymentSubscriptionSequenceRequest.java
│ │ │ ├── PaymentTaxRequest.java
│ │ │ ├── PaymentTransactionDataRequest.java
│ │ │ ├── PaymentTransactionDetailsRequest.java
│ │ │ └── PaymentUserAmountRequest.java
│ │ ├── paymentmethod/
│ │ │ └── PaymentMethodClient.java
│ │ ├── point/
│ │ │ ├── OperatingMode.java
│ │ │ ├── PointClient.java
│ │ │ ├── PointDeviceOperatingModeRequest.java
│ │ │ ├── PointPaymentIntentAdditionalInfoRequest.java
│ │ │ ├── PointPaymentIntentListRequest.java
│ │ │ ├── PointPaymentIntentPaymentRequest.java
│ │ │ └── PointPaymentIntentRequest.java
│ │ ├── preapproval/
│ │ │ ├── PreApprovalAutoRecurringCreateRequest.java
│ │ │ ├── PreApprovalAutoRecurringUpdateRequest.java
│ │ │ ├── PreapprovalClient.java
│ │ │ ├── PreapprovalCreateRequest.java
│ │ │ └── PreapprovalUpdateRequest.java
│ │ ├── preference/
│ │ │ ├── PreferenceAmountsRequest.java
│ │ │ ├── PreferenceBackUrlsRequest.java
│ │ │ ├── PreferenceCategoryDescriptorRequest.java
│ │ │ ├── PreferenceClient.java
│ │ │ ├── PreferenceCounterCurrencyRequest.java
│ │ │ ├── PreferenceDifferentialPricingRequest.java
│ │ │ ├── PreferenceFreeMethodRequest.java
│ │ │ ├── PreferenceItemRequest.java
│ │ │ ├── PreferencePassengerRequest.java
│ │ │ ├── PreferencePayerRequest.java
│ │ │ ├── PreferencePaymentMethodRequest.java
│ │ │ ├── PreferencePaymentMethodsRequest.java
│ │ │ ├── PreferencePaymentTypeRequest.java
│ │ │ ├── PreferenceReceiverAddressRequest.java
│ │ │ ├── PreferenceRequest.java
│ │ │ ├── PreferenceRouteRequest.java
│ │ │ ├── PreferenceShipmentsRequest.java
│ │ │ ├── PreferenceTaxRequest.java
│ │ │ ├── PreferenceTrackRequest.java
│ │ │ ├── PreferenceTrackValuesRequest.java
│ │ │ └── PreferenceUserAmountRequest.java
│ │ └── user/
│ │ └── UserClient.java
│ ├── core/
│ │ └── MPRequestOptions.java
│ ├── example/
│ │ └── apis/
│ │ ├── order/
│ │ │ ├── CancelOrder.java
│ │ │ ├── CaptureOrder.java
│ │ │ ├── CreateOrder.java
│ │ │ ├── CreateOrderPSE.java
│ │ │ ├── CreateOrderWith3DS.java
│ │ │ ├── CreateOrderWithIndustryFields.java
│ │ │ ├── CreateOrderWithPointConfig.java
│ │ │ ├── CreateTransaction.java
│ │ │ ├── DeleteTransaction.java
│ │ │ ├── GetOrderById.java
│ │ │ ├── ProcessOrderById.java
│ │ │ ├── RefundPartial.java
│ │ │ ├── RefundTotal.java
│ │ │ └── UpdateTransaction.java
│ │ └── payment/
│ │ └── Main.java
│ ├── exceptions/
│ │ ├── MPApiException.java
│ │ ├── MPException.java
│ │ ├── MPInvalidWebhookSignatureException.java
│ │ ├── MPJsonParseException.java
│ │ ├── MPMalformedRequestException.java
│ │ └── SignatureFailureReason.java
│ ├── net/
│ │ ├── Headers.java
│ │ ├── HttpMethod.java
│ │ ├── HttpStatus.java
│ │ ├── KeepAliveStrategy.java
│ │ ├── MPDefaultHttpClient.java
│ │ ├── MPElementsResourcesPage.java
│ │ ├── MPHttpClient.java
│ │ ├── MPRequest.java
│ │ ├── MPResource.java
│ │ ├── MPResourceList.java
│ │ ├── MPResponse.java
│ │ ├── MPResultsResourcesPage.java
│ │ ├── MPSearchRequest.java
│ │ └── UrlFormatter.java
│ ├── resources/
│ │ ├── CardToken.java
│ │ ├── ResultsPaging.java
│ │ ├── common/
│ │ │ ├── Address.java
│ │ │ ├── Identification.java
│ │ │ ├── Phone.java
│ │ │ └── Source.java
│ │ ├── customer/
│ │ │ ├── Customer.java
│ │ │ ├── CustomerAddress.java
│ │ │ ├── CustomerAddressCity.java
│ │ │ ├── CustomerAddressCountry.java
│ │ │ ├── CustomerAddressMunicipality.java
│ │ │ ├── CustomerAddressNeighborhood.java
│ │ │ ├── CustomerAddressState.java
│ │ │ ├── CustomerCard.java
│ │ │ ├── CustomerCardCardholder.java
│ │ │ ├── CustomerCardCardholderIdentification.java
│ │ │ ├── CustomerCardIssuer.java
│ │ │ ├── CustomerCardPaymentMethod.java
│ │ │ ├── CustomerCardSecurityCode.java
│ │ │ ├── CustomerDefaultAddress.java
│ │ │ └── Identification.java
│ │ ├── identificationtype/
│ │ │ └── IdentificationType.java
│ │ ├── merchantorder/
│ │ │ ├── MerchantOrder.java
│ │ │ ├── MerchantOrderCollector.java
│ │ │ ├── MerchantOrderItem.java
│ │ │ ├── MerchantOrderPayer.java
│ │ │ ├── MerchantOrderPayment.java
│ │ │ ├── MerchantOrderReceiverAddress.java
│ │ │ ├── MerchantOrderReceiverAddressCity.java
│ │ │ ├── MerchantOrderReceiverAddressCountry.java
│ │ │ ├── MerchantOrderReceiverAddressState.java
│ │ │ ├── MerchantOrderShipment.java
│ │ │ ├── MerchantOrderShippingEstimatedDelivery.java
│ │ │ ├── MerchantOrderShippingOption.java
│ │ │ └── MerchantOrderShippingSpeed.java
│ │ ├── oauth/
│ │ │ ├── CreateOauthCredential.java
│ │ │ ├── OauthCredential.java
│ │ │ └── RefreshOauthCredential.java
│ │ ├── order/
│ │ │ ├── Order.java
│ │ │ ├── OrderAttempts.java
│ │ │ ├── OrderAutomaticPayments.java
│ │ │ ├── OrderCategoryDescriptor.java
│ │ │ ├── OrderChargeback.java
│ │ │ ├── OrderConfig.java
│ │ │ ├── OrderDifferentialPricing.java
│ │ │ ├── OrderDiscountPaymentMethod.java
│ │ │ ├── OrderDiscounts.java
│ │ │ ├── OrderExternalCategory.java
│ │ │ ├── OrderInstallments.java
│ │ │ ├── OrderInstallmentsAvailable.java
│ │ │ ├── OrderInstallmentsInterestFree.java
│ │ │ ├── OrderIntegrationData.java
│ │ │ ├── OrderInvoicePeriod.java
│ │ │ ├── OrderItem.java
│ │ │ ├── OrderOnlineConfig.java
│ │ │ ├── OrderPaging.java
│ │ │ ├── OrderPassenger.java
│ │ │ ├── OrderPayer.java
│ │ │ ├── OrderPayment.java
│ │ │ ├── OrderPaymentDiscount.java
│ │ │ ├── OrderPaymentMethod.java
│ │ │ ├── OrderPointConfig.java
│ │ │ ├── OrderReceiverAddress.java
│ │ │ ├── OrderReference.java
│ │ │ ├── OrderRefund.java
│ │ │ ├── OrderRefundItem.java
│ │ │ ├── OrderRoute.java
│ │ │ ├── OrderSearchResponse.java
│ │ │ ├── OrderShipment.java
│ │ │ ├── OrderStoredCredential.java
│ │ │ ├── OrderSubscriptionData.java
│ │ │ ├── OrderSubscriptionSequence.java
│ │ │ ├── OrderTax.java
│ │ │ ├── OrderTransaction.java
│ │ │ ├── OrderTransactionRefund.java
│ │ │ ├── OrderTransactionSecurity.java
│ │ │ ├── OrderTypeResponse.java
│ │ │ └── UpdateOrderTransaction.java
│ │ ├── payment/
│ │ │ ├── Payment.java
│ │ │ ├── PaymentAdditionalInfo.java
│ │ │ ├── PaymentAdditionalInfoPayer.java
│ │ │ ├── PaymentAmounts.java
│ │ │ ├── PaymentApplicationData.java
│ │ │ ├── PaymentBankInfo.java
│ │ │ ├── PaymentBankInfoCollector.java
│ │ │ ├── PaymentBankInfoPayer.java
│ │ │ ├── PaymentBarcode.java
│ │ │ ├── PaymentCard.java
│ │ │ ├── PaymentCardholder.java
│ │ │ ├── PaymentCounterCurrency.java
│ │ │ ├── PaymentData.java
│ │ │ ├── PaymentDiscount.java
│ │ │ ├── PaymentExpanded.java
│ │ │ ├── PaymentFee.java
│ │ │ ├── PaymentFeeDetail.java
│ │ │ ├── PaymentInvoicePeriod.java
│ │ │ ├── PaymentItem.java
│ │ │ ├── PaymentMethod.java
│ │ │ ├── PaymentOrder.java
│ │ │ ├── PaymentPayer.java
│ │ │ ├── PaymentPaymentReference.java
│ │ │ ├── PaymentPhone.java
│ │ │ ├── PaymentPointOfInteraction.java
│ │ │ ├── PaymentReceiverAddress.java
│ │ │ ├── PaymentRefund.java
│ │ │ ├── PaymentRules.java
│ │ │ ├── PaymentShipments.java
│ │ │ ├── PaymentStatus.java
│ │ │ ├── PaymentSubscriptionSequence.java
│ │ │ ├── PaymentTax.java
│ │ │ ├── PaymentThreeDSInfo.java
│ │ │ ├── PaymentTransactionData.java
│ │ │ ├── PaymentTransactionDetails.java
│ │ │ ├── PaymentUsersAmountCollector.java
│ │ │ └── PaymentUsersAmountPayer.java
│ │ ├── paymentmethod/
│ │ │ ├── PaymentMethod.java
│ │ │ ├── PaymentMethodFinancialInstitutions.java
│ │ │ ├── PaymentMethodSettings.java
│ │ │ ├── PaymentMethodSettingsBin.java
│ │ │ ├── PaymentMethodSettingsCardNumber.java
│ │ │ └── PaymentMethodSettingsSecurityCode.java
│ │ ├── point/
│ │ │ ├── OperatingMode.java
│ │ │ ├── PointCancelPaymentIntent.java
│ │ │ ├── PointDevice.java
│ │ │ ├── PointDeviceOperatingMode.java
│ │ │ ├── PointDevices.java
│ │ │ ├── PointPaymentIntent.java
│ │ │ ├── PointPaymentIntentAdditionalInfo.java
│ │ │ ├── PointPaymentIntentList.java
│ │ │ ├── PointPaymentIntentListEvent.java
│ │ │ ├── PointPaymentIntentPayment.java
│ │ │ ├── PointSearchPaymentIntent.java
│ │ │ └── PointStatusPaymentIntent.java
│ │ ├── preapproval/
│ │ │ ├── Preapproval.java
│ │ │ └── PreapprovalAutoRecurring.java
│ │ ├── preference/
│ │ │ ├── Preference.java
│ │ │ ├── PreferenceAmounts.java
│ │ │ ├── PreferenceBackUrls.java
│ │ │ ├── PreferenceCategoryDescriptor.java
│ │ │ ├── PreferenceCounterCurrency.java
│ │ │ ├── PreferenceDifferentialPricing.java
│ │ │ ├── PreferenceFreeMethod.java
│ │ │ ├── PreferenceItem.java
│ │ │ ├── PreferencePassenger.java
│ │ │ ├── PreferencePayer.java
│ │ │ ├── PreferencePaymentMethod.java
│ │ │ ├── PreferencePaymentMethods.java
│ │ │ ├── PreferencePaymentType.java
│ │ │ ├── PreferenceReceiverAddress.java
│ │ │ ├── PreferenceRoute.java
│ │ │ ├── PreferenceSearch.java
│ │ │ ├── PreferenceShipments.java
│ │ │ ├── PreferenceTax.java
│ │ │ ├── PreferenceTrack.java
│ │ │ ├── PreferenceTrackValues.java
│ │ │ └── PreferenceUserAmount.java
│ │ └── user/
│ │ └── User.java
│ ├── serialization/
│ │ └── Serializer.java
│ └── webhook/
│ └── WebhookSignatureValidator.java
└── test/
└── java/
└── com/
└── mercadopago/
├── BaseClientIT.java
├── BaseClientTest.java
├── client/
│ ├── MercadoPagoClientTest.java
│ ├── cardtoken/
│ │ ├── CardTokenCardholderTestCreateRequest.java
│ │ ├── CardTokenClientIT.java
│ │ ├── CardTokenClientTest.java
│ │ ├── CardTokenTestClient.java
│ │ └── CardTokenTestCreateRequest.java
│ ├── customer/
│ │ ├── CustomerCardClientTest.java
│ │ ├── CustomerClientIT.java
│ │ └── CustomerClientTest.java
│ ├── identificationtype/
│ │ ├── IdentificationTypeClientIT.java
│ │ └── IdentificationTypeClientTest.java
│ ├── merchantorder/
│ │ ├── MerchantOrderClientIT.java
│ │ └── MerchantOrderClientTest.java
│ ├── oauth/
│ │ └── OauthClientTest.java
│ ├── order/
│ │ ├── OrderClientIT.java
│ │ ├── OrderClientTest.java
│ │ ├── OrderClientWith3DSTest.java
│ │ └── OrderPointConfigTest.java
│ ├── payment/
│ │ ├── PaymentClientIT.java
│ │ ├── PaymentClientTest.java
│ │ ├── PaymentRefundClientIT.java
│ │ └── PaymentRefundClientTest.java
│ ├── paymentmethod/
│ │ ├── PaymentMethodClientIT.java
│ │ └── PaymentMethodClientTest.java
│ ├── point/
│ │ ├── PointClientIT.java
│ │ └── PointClientTest.java
│ ├── preapproval/
│ │ ├── PreapprovalClientIT.java
│ │ └── PreapprovalClientTest.java
│ ├── preference/
│ │ ├── PreferenceClientIT.java
│ │ └── PreferenceClientTest.java
│ └── user/
│ ├── UserClientIT.java
│ └── UserClientTest.java
├── helper/
│ ├── HttpStatusCode.java
│ └── MockHelper.java
├── mock/
│ ├── HttpClientMock.java
│ ├── HttpRequestMatcher.java
│ └── MPDefaultHttpClientMock.java
├── net/
│ ├── MPDefaultHttpClientTest.java
│ └── UrlFormatterTest.java
├── resources/
│ └── mocks/
│ ├── helper/
│ │ └── serializer_iso8601_timestamps.json
│ ├── request/
│ │ ├── advancedPayment/
│ │ │ ├── advanced_payment_base.json
│ │ │ ├── captured.json
│ │ │ ├── money_release_date.json
│ │ │ ├── payment_captured.json
│ │ │ └── status_cancelled.json
│ │ ├── card/
│ │ │ └── card_new.json
│ │ ├── customer/
│ │ │ ├── customer_base.json
│ │ │ └── customer_first_name.json
│ │ ├── merchant/
│ │ │ ├── order_base.json
│ │ │ └── order_updated.json
│ │ ├── payment/
│ │ │ ├── captured.json
│ │ │ ├── payment_3ds.json
│ │ │ ├── payment_base.json
│ │ │ ├── payment_boleto.json
│ │ │ ├── payment_captured.json
│ │ │ ├── payment_pix.json
│ │ │ ├── payment_pse.json
│ │ │ └── status_cancelled.json
│ │ ├── point/
│ │ │ ├── devices_operating_mode.json
│ │ │ └── payment_intent.json
│ │ ├── preapproval/
│ │ │ ├── preapproval_base.json
│ │ │ └── preapproval_update.json
│ │ ├── preference/
│ │ │ ├── preference_base.json
│ │ │ └── preference_updated.json
│ │ ├── refund/
│ │ │ ├── refund.json
│ │ │ └── refund_partial.json
│ │ └── request_generic.json
│ └── response/
│ ├── advancedPayment/
│ │ ├── payment_base.json
│ │ ├── payment_cancelled.json
│ │ ├── payment_captured.json
│ │ ├── payment_updated.json
│ │ └── refund.json
│ ├── card/
│ │ ├── card_all.json
│ │ ├── card_new.json
│ │ └── card_single.json
│ ├── cardtoken/
│ │ └── card_token_base.json
│ ├── customer/
│ │ ├── customer_base.json
│ │ ├── customer_updated.json
│ │ └── search_by_email.json
│ ├── identification/
│ │ └── types.json
│ ├── merchant/
│ │ ├── order_base.json
│ │ ├── order_search.json
│ │ └── order_updated.json
│ ├── oauth/
│ │ ├── oauth_credential.json
│ │ └── oauth_refresh_token.json
│ ├── order/
│ │ ├── capture_order_response.json
│ │ ├── create_order_response.json
│ │ ├── create_refund_partial_response.json
│ │ ├── create_refund_total_response.json
│ │ ├── create_transaction_response.json
│ │ ├── order_search_response.json
│ │ └── update_transaction_response.json
│ ├── payment/
│ │ ├── by_external_reference.json
│ │ ├── payment_3ds.json
│ │ ├── payment_base.json
│ │ ├── payment_boleto.json
│ │ ├── payment_cancelled.json
│ │ ├── payment_captured.json
│ │ ├── payment_card_token_error.json
│ │ ├── payment_pix.json
│ │ ├── payment_pse.json
│ │ └── payment_search.json
│ ├── paymentmethod/
│ │ └── payment_method_base.json
│ ├── point/
│ │ ├── devices_list.json
│ │ ├── devices_operating_mode.json
│ │ ├── payment_intent.json
│ │ ├── payment_intent_delete.json
│ │ ├── payment_intent_list.json
│ │ ├── payment_intent_search.json
│ │ └── payment_intent_status.json
│ ├── preapproval/
│ │ ├── preapproval_base.json
│ │ ├── preapproval_list.json
│ │ └── preapproval_update.json
│ ├── preference/
│ │ ├── preference_base.json
│ │ ├── preference_list.json
│ │ └── preference_updated.json
│ ├── refund/
│ │ ├── refund_all.json
│ │ ├── refund_base.json
│ │ ├── refund_list.json
│ │ └── refund_partial.json
│ ├── response_generic_success.json
│ └── user/
│ └── user_base.json
├── serialization/
│ └── SerializerTest.java
└── webhook/
└── WebhookSignatureValidatorTest.java
================================================
FILE CONTENTS
================================================
================================================
FILE: .code_quality/checkstyle_rules.xml
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: 🐛 Bug Report
description: Report a bug or unexpected behavior in the SDK
title: "[BUG]: "
labels: ["bug", "needs-triage"]
assignees: ["danielalfarourrea","luismeli10","orojaspardo"]
body:
- type: markdown
attributes:
value: |
## 🐛 Thanks for reporting this issue!
Please make sure you tested with the latest version of the relevant packages and/or checked existing issues to avoid duplicates. If the bug persists, open the issue with a clear and concise description including screenshots, if applicable. We appreciate your feedback!
**Before reporting a bug:**
- 🔍 **Search [existing issues](./issues?q=is%3Aissue) to avoid duplicates**
- 📚 **Verify you are using the [latest version](../../releases)**
- 💡 **Try to reproduce the problem in sandbox environment**
- ⚠️ **IMPORTANT: Your bug will be resolved faster if you can share a self-contained example that doesn't rely on internal or private dependencies.**
> **🔒 SECURITY WARNING:** Issues without reproduction steps or code examples may be immediately closed as not actionable. Always remember to **REMOVE ALL PII AND PERSONAL INFORMATION** from your examples. **Bugs opened with real data will be immediately reported and closed.**
- type: input
id: sdk-version
attributes:
label: 📦 SDK Version
description: "Example: 2.1.0"
placeholder: "x.y.z"
validations:
required: true
- type: textarea
id: environment-details
attributes:
label: 🖥️ Environment Details
description: |
System and dependencies information
placeholder: |
- Operating System: [e.g. Ubuntu 20.04, Windows 11, macOS 13]
- Language Version: [e.g. Python 3.9.0, Node.js 18.0.0]
- Framework: [e.g. Django 4.0, Express 4.18]
- Package Manager: [e.g. pip 21.0, npm 8.0]
- Other relevant dependencies: ...
validations:
required: true
- type: dropdown
id: country
attributes:
label: 🌎 Country
description: Country where the issue occurs
options:
- Argentina (MLA)
- Brazil (MLB)
- Chile (MLC)
- Colombia (MCO)
- Mexico (MLM)
- Peru (MPE)
- Uruguay (MLU)
- Other
validations:
required: true
- type: textarea
id: description
attributes:
label: 📝 Bug Description
description: A clear and concise description of what the bug is
placeholder: The SDK fails when I try to...
validations:
required: true
- type: textarea
id: expected
attributes:
label: ✅ Expected Behavior
description: A clear description of the behavior you expected from the SDK
placeholder: I expected the SDK to...
validations:
required: true
- type: textarea
id: actual
attributes:
label: ❌ Actual Behavior
description: A description of what the SDK actually does instead
placeholder: Instead, the SDK...
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: 🔄 Steps To Reproduce
description: Detailed steps to reproduce the problem
placeholder: |
1. Configure the SDK with...
2. Execute the method...
3. Send the following parameters...
4. Observe the error...
validations:
required: true
- type: textarea
id: code-sample
attributes:
label: 💻 Code Example
description: |
Minimal code that reproduces the problem. **REMOVE ALL CREDENTIALS AND SENSITIVE DATA.**
You can provide:
- A CodeSandbox (https://codepen.io/pen/)
- A link to a GitHub repository
- A minimal code example that reproduces the problem
- A screenshot of the application if you think it is relevant
**Remember to REMOVE ALL SENSITIVE DATA FIRST.**
render: python
placeholder: |
import mercadopago
sdk = mercadopago.SDK("YOUR_ACCESS_TOKEN") # ⚠️ DO NOT USE REAL TOKENS
# Your code here that reproduces the bug...
validations:
required: true
- type: textarea
id: error-logs
attributes:
label: 📋 Logs and Error Messages
description: Copy complete logs, stack traces, or error messages
render: shell
placeholder: |
Error: ...
Stack trace: ...
- type: checkboxes
id: checklist
attributes:
label: ✅ Checklist
options:
- label: I have verified that I am using the latest SDK version
required: true
- label: I have searched existing issues and this bug has not been reported
required: true
- label: I have included a minimal code example to reproduce the problem
required: true
- label: I have removed all sensitive information (tokens, credentials, real data)
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Support Center Mercado Pago - ES
url: https://www.mercadopago.com/developers/es/support/center
about: Problems with payments, account, or general inquiries
- name: Support Center Mercado Pago - PT
url: https://www.mercadopago.com/developers/pt/support/center
about: Problems with payments, account, or general inquiries
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: ✨ Feature Request
description: Propose a new feature for the Mercado Pago SDK
title: "[FEATURE]: "
labels: ["enhancement", "needs-triage"]
assignees: ["danielalfarourrea","luismeli10","orojaspardo"]
body:
- type: markdown
attributes:
value: |
## 💡 Thanks for contributing with ideas!
Your feedback is valuable to improve the SDK. Before submitting:
- 🔍 **Search [existing issues](./issues?q=is%3Aissue) to avoid duplicates**.
- 📚 **Check the [documentation](https://www.mercadopago.com/developers/es/docs) to confirm this isn't already supported**.
- type: dropdown
id: feature-type
attributes:
label: ⚙️ Feature Type
description: What type of improvement are you proposing?
options:
- New feature
- Enhancement of existing feature
- Support for new Mercado Pago product
- Better error handling
- Documentation improvement
- Performance optimization
- Other
validations:
required: true
- type: textarea
id: problem
attributes:
label: 🎯 Problem to solve
description: Describe the problem or need this feature would solve.
placeholder: |
As a developer of [application type]...
I need [feature]...
To be able to [goal]...
validations:
required: true
- type: textarea
id: solution
attributes:
label: 💡 Proposed Solution
description: Describe how you would like this new feature to work.
placeholder: |
I would like the SDK to support...
The implementation could be...
Usage example:
```
// example code
```
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: 🔄 Alternatives Considered
description: |
Have you tried any workarounds?
Are there similar features in other SDKs or libraries?
placeholder: |
- Alternative 1: ...
- Alternative 2: ...
- In the [language] SDK they do...
- type: checkboxes
id: checklist
attributes:
label: ✅ Checklist
options:
- label: I have searched existing issues and this feature has not been requested before
required: true
- label: I have clearly described the problem I am trying to solve
required: true
- label: I have proposed a concrete solution or API design
required: true
- label: This feature would benefit other users, not just my specific use case
required: true
- label: I have not included any sensitive information (tokens, credentials, real data)
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/question.yml
================================================
name: 💬 Question
description: Ask a question about the Mercado Pago SDK
title: "[QUESTION]: "
labels: ["question", "needs-triage"]
assignees: ["danielalfarourrea","luismeli10","orojaspardo"]
body:
- type: markdown
attributes:
value: |
## 👋 Thanks for using the Mercado Pago SDK!
Before asking your question, please:
- 🔍 **Search [existing issues](./issues?q=is%3Aissue) to see if it was already answered**
- 📚 **Check the [official documentation](https://www.mercadopago.com/developers/es/docs)**
- 💡 **Review the repository examples**
- type: input
id: sdk-version
attributes:
label: 📦 SDK Version
description: "Example: 2.1.0"
placeholder: "x.y.z"
validations:
required: true
- type: dropdown
id: country
attributes:
label: 🌎 Country
description: In which country are you operating?
options:
- Argentina (MLA)
- Brazil (MLB)
- Chile (MLC)
- Colombia (MCO)
- Mexico (MLM)
- Peru (MPE)
- Uruguay (MLU)
- Other
validations:
required: true
- type: textarea
id: context
attributes:
label: 🖥️ Environment Details
description: |
Provide details about your environment to help us understand your setup:
- Platform (Web, Mobile, Backend)
- Framework used
- Relevant error messages
- Documentation consulted
placeholder: |
- Platform: [e.g. Backend, Web, Mobile]
- Language Version: [e.g. Python 3.9.0, Node.js 18.0.0]
- Framework: [e.g. Django 4.0, Express 4.18]
- Other relevant dependencies: ...
- type: textarea
id: question
attributes:
label: ❓ Your Question
description: Ask your question as clearly and specifically as possible. The more detail you provide, the faster we can help.
placeholder: |
What are you trying to do?
What have you tried so far?
What is the result you are getting vs. what you expected?
Is there an error message involved?
validations:
required: true
- type: textarea
id: code-sample
attributes:
label: 💻 Code Example (optional)
description: If applicable, share a code snippet that illustrates your question. **Remember to remove all sensitive data (tokens, credentials, etc)**
render: python
placeholder: |
import mercadopago
sdk = mercadopago.SDK("YOUR_ACCESS_TOKEN") # ⚠️ DO NOT USE REAL TOKENS
# Your code here...
- type: checkboxes
id: checklist
attributes:
label: ✅ Checklist
options:
- label: I have searched existing issues
required: true
- label: I have checked the official documentation
required: true
- label: I have removed sensitive information (tokens, credentials, etc)
required: true
================================================
FILE: .github/workflows/main.yml
================================================
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Compile
run: mvn compile
- name: Run tests
run: mvn test
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN_V2 }}
PUBLIC_KEY: ${{ secrets.PUBLIC_KEY }}
# Upload coverage result
# - name: Upload Coverage
# uses: codecov/codecov-action@v1
# with:
# file: ./target/site/jacoco/jacoco.xml
================================================
FILE: .github/workflows/maven-publish-release.yml
================================================
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Publish package to the Maven Central Repository and GitHub Packages
on:
release:
types: [ released ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- id: publish-to-central
name: Publish to Central Repository
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
run: |
mvn --no-transfer-progress --batch-mode clean deploy
================================================
FILE: .github/workflows/maven-publish-snapshot.yml
================================================
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Publish SNAPSHOT package
on:
release:
types: [ prereleased ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- id: install-secret-key
name: Install GPG Secret Key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- id: publish-to-central
name: Publish to Central Repository
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: |
mvn \
--no-transfer-progress \
--batch-mode \
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \
clean deploy
================================================
FILE: .gitignore
================================================
settings.xml
.idea/
.vscode/
out/
*.iml
target/
maven-central-deploy.log
*.jks
*.cer
*.pem
.DS_Store
.classpath
.settings
.project
classes/
### Gradle ###
.gradle
gradle/
build.gradle
settings.gradle
gradlew
gradlew.bat
# Ignore Gradle GUI config
gradle-app.setting
# Cache of project
.gradletasknamecache
### Gradle Patch ###
# Java heap dump
*.hprof
### Docs
*.html
docs/
================================================
FILE: .pre-commit-config.yaml
================================================
repos:
# Websec hook is MANDATORY, DO NOT comment it.
- repo: https://github.com/melisource/fury_websec-git-hooks
rev: v2.0.0
hooks:
- id: pre_commit_hook
stages: [commit]
- id: post_commit_hook
stages: [post-commit]
# Datasec hook is MANDATORY, DO NOT comment it.
- repo: https://github.com/melisource/fury_datasec-git-hooks
rev: 1.2.2
hooks:
- id: pre_commit_hook
stages: [commit]
- id: post_commit_hook
stages: [post-commit]
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in
our community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment of individuals or the company
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct that could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned with this Code of Conduct, as well as temporarily or
permanently ban any contributor for other behavior deemed inappropriate, threatening, offensive, or harmful with or without prior notice..
## Scope
This Code of Conduct applies within all project spaces and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project email address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
This Code of Conduct also applies outside the project spaces when there is a
reasonable belief that an individual's behavior may have a negative impact on
the project, the company or the community.
## Enforcement
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
================================================
FILE: CODING_GUIDELINES.md
================================================
# Coding Guidelines
The Mercado Pago Java SDK is a collaborative effort from the start. The SDK team thinks that contributions from
different developer will enrich its feature set and make it more relevant to the community.
However, absorbing all contributions as-is, while expedient, might lead to difficulties in maintenance of the codebase
is left unchecked. A collaborative codebase often establish guidelines for contributors to ensure code remains
maintainable over time. The effort to maintain the SDK is no different in this regard, so a bit of guidance is in order.
The purpose of this guide is to set a baseline for contributions. These guidelines are not intended to limit the tools
at your disposal nor to rewire the way you think but rather to encourage good neighbor behavior.
## Language Guidelines
We use **english** language. This is to be consistent everywhere, and to be considerate with developers that do not
speak our native language.
Therefore: source code, comments, documentation, commit messages, review comments, and any other kind of contribution *
MUST* use english language.
Typos are unavoidable, but try to reduce them by using a spellchecker. Most IDEs can be configured to run one
automatically.
## Code Guidelines
To contribute to the project you need to have installed in your machine [pre-commit tool](https://pre-commit.com/) to
check the code style and formatting. To make pre-commit work you must have installed `Docker` as well.
1. To check if pre-commit is installed, you must run the command below successfully:
```
$ pre-commit --version
pre-commit 2.17.0
```
2. After pre-commit is installed at your machine, inside the SDK project folder, you must run the command below to set
up the git hook scripts of the project:
```
$ pre-commit install
```
After that, git hooks will run automatically before every commit command.
Generally speaking, be conscious when contributing and try following the same style that the code in the SDK already
has. If you have any doubts, just ask us!
This rules will be enforced automatically when making a pull requests, and checks will fail if you do not follow them,
resulting in your contribution being automatically rejected until fixed.
## Comment Guidelines
Comments in code are a hard thing to write, not because the words are difficult to produce but because it is hard to
make relevant comments. Too much of it and people do not read comments (and it obfuscates code reading) and too little
of it gives you no recourse but to read large portions of codebase to get insight as to what a feature/codeblock is
doing. Both situations are undesirable and efforts should be made at all time to have a please comment reading
experience
As a general rule you would have to comment on decisions you made while coding that are not part of any specification.
In particular, you should always comment any decision that:
* Departs from common wisdom or convention (The **why's** are necessary).
* Takes a significant amount of time to produce. A good rule of thumb here is that if you spent more than 1 hour
thinking on how to produce a fragment of code that took 2 minutes of wrist time to write you should document your
thinking to aid reader and allow for validation.
* Need to preserve properties of the implementation. This is the case of performance sensitive portions of the codebase,
goroutines synchronization, implementations of security primitives, congestion control algorithms, etc.
As a general rule of what not to comment you should avoid:
* Commenting on structure of programs that is already part of a convention, specified or otherwise.
* Having pedantic explanations of behavior that can be found by immediate examination of the surrounding code artifacts.
* Commenting on behavior you cannot attest.
### Branching Guidelines
Currently `master` is our only long term branch, below a few suggestions of short term branches naming:
* `hotfix/something-needs-fix`: Small routine patches in code to feature already there.
* `feature/something-new`: A new feature or a change in an existent feature. Beware of breaking changes that would
require a major version bump.
* `doc/improves-documentation-for-this-feature`: If you add or change documentation with no impact to the source code.
### Git Guidelines
All commits **SHOULD** follow the [seven rules of a great Git commit message](https://chris.beams.io/posts/git-commit):
1. Separate subject from body with a blank line.
2. Limit the subject line to 72 characters.
3. Capitalize the subject line.
4. Do not end the subject line with a period.
5. Use the imperative mood in the subject line.
6. Wrap the body at 72 characters.
7. Use the body to explain what and why vs. how.
Commits such as "fix tests", "now it's working", and many other common messages we find usually in code **WON'T** be
accepted.
Ideally we would like to enforce these rules, but we are realistic and understand that it might be a big change for some
people. So unless deviating heavily from what was stated we might accept your commits even if not following these rules
perfectly.
Please avoid taking too much time to deliver code, and always [rebase](https://git-scm.com/docs/git-rebase) your code to
avoid reverse merge commits.
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to the Mercado Pago Java SDK
Thank you for your interest in contributing to the Mercado Pago Java SDK!
## How to contribute
In order to contribute to the Mercado Pago Java SDK effectively we provide guidelines to address common case for
contributions. Presently we have guides for the following type of changes.
* Request For Change (RFC) / Feature Request: These are suggestions / requests for features the SDK currently does not
have. The SDK team evaluates these requests for adequacy / relevance / capacity and overall architectural consistency.
* Bug Reports: These are reports of noncompliance behavior with the SDK specification and other blatantly wrong behavior
of the Mercado Pago Java SDK.
In addition to contributing in the form of Bug Reports and RFCs it is also possible to contribute directly in code with
a Pull Request (PR). In the case of a Pull Request you should also indicate the nature of the Pull Request (
Feature/Bug/etc.) to help the team asses the Pull Request. If you are enthusiastic about a particular Feature being
added or a bug being fixed, a PR is often the quickest way to promote your change as the team does not have to allocate
as many resources to process the contribution.
In the case of PRs it is often best to consult with the SDK team before embarking on a PR, specially if it's a beefy
one. Spending time on a PR that might later be rejected because major discrepancies with vision or competing
contributions is an uncomfortable outcome for all involved people. Remember the SDK team with privilege overall
consistency and progress over any one particular contribution.
## Coding Guidance
All contributions *MUST* follow the [Coding Guidelines](CODING_GUIDELINES.md). Contributions that fail to follow these
guidelines will be disregarded and told to make the required modifications to do so.
## Request For Change / Feature Request
Generally speaking an RFC is needed when you want to add a new feature or change an existing one in an incompatible way
that might result in a major version bump to the toolkit.
Though it seems a little bureaucratic, the process is in place in order to avoid frustration of a potential contributor
by making the discussions take place before any code is written. Once the design and direction is fully agreed then the
contributor can work peacefully knowing that their change will be committed.
As of this moment all you need to do is create an issue and use
the [Feature Request Template](.github/ISSUE_TEMPLATE/feature_request.md).
Please prepend your issue title with `[RFC]` so that's easier to filter.
## Bug Reports
Bugs are a reality in software. We can't fix what we don't know about, so please report liberally. If you're not sure if
something is a bug or not, feel free to file it anyway.
Before reporting a bug, please search existing issues and pull requests, as it's possible that someone else has already
reported your error. In the off case that you find your issue as fixed/closed, please add a reference to it on your new
one.
Your issue should contain a title and a clear description of the issue. You should also include as much relevant
information as possible, and a code sample that demonstrates the issue. The goal of a bug report is to make it easy for
yourself - and others - to replicate the bug and develop a fix.
Opening an issue is as easy as
following [this link](https://github.com/mercadopago/sdk-java/issues/new?assignees=&labels=&template=bug_report.md) and
filling out the given template.
Bug reports may also be sent in the form of a [pull request](#pull-request) containing a failing test.
## Pull Request
First and foremost: Source code, documentation, commit messages, review comments, and any other kind of contribution
must *MUST* follow the [Coding Guidelines](CODING_GUIDELINES.md).
We use the "fork and pull"
model [described here](https://help.github.com/articles/about-collaborative-development-models/), where contributors
push changes to their personal fork and create pull requests to bring those changes into the source repository.
Your basic steps to get going:
* Fork the corresponding toolkit repository and create a branch from master for the issue you are working on.
* Commit as you go following our git conventions.
* Include tests that cover all non-trivial code. The existing tests should provide a template on how to test the toolkit
correctly.
* Make sure all test passes.
* All code changes are expected to comply with the formatting style.
* Push your commits to GitHub and create a pull request against the corresponding toolkit component master branch.
If taking too much time to deliver code, **always** [rebase](https://git-scm.com/docs/git-rebase) towards `master` before
asking for a review, and avoid reverse merge commits.
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2021 MercadoPago Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: PULL_REQUEST_TEMPLATE.md
================================================
## Cambios realizados para el feature:
* item 1
## Cambios generales
* item 1
## Issues cerrados
* Closes #XX
## Checklist validación PR:
- [ ] Título y descripción clara del PR
- [ ] Tests de mi funcionalidad
- [ ] Documentación de mi funcionalidad
- [ ] Tests ejecutados y pasados
- [ ] Branch Coverage >= 80%
================================================
FILE: README.md
================================================
# Mercado Pago SDK for Java
[](https://search.maven.org/search?q=g:com.mercadopago%20AND%20a:sdk-java)

The official [Mercado Pago](https://www.mercadopago.com/developers/en/guides) Java client library.
## 💡 Requirements
Java 1.8 or later
## 📲 Installation
First time using Mercado Pago? Create your [Mercado Pago account](https://www.mercadopago.com), if you don’t have one
already.
1. Append MercadoPago dependencies to pom.xml
```xml
com.mercadopagosdk-java3.1.0
```
2. Run `mvn install` and that's all, you have Mercado Pago SDK installed.
3. Copy the access_token in the [credentials](https://www.mercadopago.com/developers/panel) section of the page and
replace YOUR_ACCESS_TOKEN with it.
That's it! Mercado Pago SDK has been successfully installed.
## 🌟 Getting Started
Simple usage looks like:
```java
import com.mercadopago.MercadoPagoConfig;
import com.mercadopago.client.order.*;
import com.mercadopago.core.MPRequestOptions;
import com.mercadopago.exceptions.MPApiException;
import com.mercadopago.exceptions.MPException;
import com.mercadopago.resources.order.Order;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Example {
public static void main(String[] args) {
MercadoPagoConfig.setAccessToken("{{ACCESS_TOKEN}}");
OrderClient client = new OrderClient();
OrderPaymentRequest payment = OrderPaymentRequest.builder()
.amount("10.00")
.paymentMethod(OrderPaymentMethodRequest.builder()
.id("master")
.type("credit_card")
.token("{{CARD_TOKEN}}")
.installments(1)
.build())
.build();
List payments = new ArrayList<>();
payments.add(payment);
OrderCreateRequest request = OrderCreateRequest.builder()
.type("online")
.totalAmount("10.00")
.externalReference("ext_ref")
.payer(OrderPayerRequest.builder().email("{{EMAIL}}").build())
.transactions(OrderTransactionRequest.builder()
.payments(payments)
.build())
.build();
Map headers = new HashMap<>();
headers.put("X-Idempotency-Key", "{{IDEMPOTENCY_KEY}}");
MPRequestOptions requestOptions = MPRequestOptions.builder()
.customHeaders(headers)
.build();
try {
Order order = client.create(request, requestOptions);
System.out.println("Order created: " + order.getId());
} catch (MPApiException | MPException e) {
System.out.println("Error creating order: " + e.getMessage());
}
}
}
```
### Per-request Configuration
All the request methods accept an optional `MPRequestOptions` object. With this you can set a custom access token,
custom timeouts or even any custom headers you want, like an idempotency key for example.
```java
public class Example {
public static void main(String[] args) {
OrderClient client = new OrderClient();
Map customHeaders = new HashMap<>();
customHeaders.put("x-idempotency-key", "...");
MPRequestOptions requestOptions =
MPRequestOptions.builder()
.accessToken("custom_access_token")
.connectionRequestTimeout(2000)
.connectionTimeout(2000)
.socketTimeout(2000)
.customHeaders(customHeaders)
.build();
OrderCreateRequest createRequest = OrderCreateRequest.builder().build();
try {
Order order = client.create(createRequest, requestOptions);
System.out.println(order);
} catch (MPException | MPApiException ex) {
ex.printStackTrace();
}
}
}
```
### SDK configurations
You can also set some customizations directly at MercadoPagoConfig class, for example set custom timeouts, a custom http
client, log configurations, etc...
```java
public class Example {
public static void main(String[] args) {
MercadoPagoConfig.setConnectionRequestTimeout(2000);
MercadoPagoConfig.setSocketTimeout(2000);
MercadoPagoConfig.setLoggingLevel(Level.FINEST);
}
}
```
### Custom Http Client
You can use a custom http client instead of using the default `MPDefaultHttpClient` by implementing the `MPHttpClient`
interface.
```java
public class CustomHttpClient implements MPHttpClient {
//...
}
```
## 📚 Documentation
See our documentation for more details.
- Mercado Pago reference API. [Portuguese](https://www.mercadopago.com/developers/pt/reference)
/ [English](https://www.mercadopago.com/developers/en/reference)
/ [Spanish](https://www.mercadopago.com/developers/es/reference)
## 🤝 Contributing
All contributions are welcome, ranging from people wanting to triage issues, others wanting to write documentation, to
people wanting to contribute code.
Please read and follow our [contribution guidelines](CONTRIBUTING.md). Contributions not following these guidelines will
be disregarded. The guidelines are in place to make all of our lives easier and make contribution a consistent process
for everyone.
### Patches to version 1.x.x
Since the release of version 2.0.0, version 1 is deprecated and will not be receiving new
features, only bug fixes. If you need to submit PRs for that version, please do so by using `develop-v1` as your base
branch.
## ❤️ Support
If you require technical support, please contact our support team at our developers
site: [English](https://www.mercadopago.com/developers/en/support/center/contact)
/ [Portuguese](https://www.mercadopago.com/developers/pt/support/center/contact)
/ [Spanish](https://www.mercadopago.com/developers/es/support/center/contact)
## 🏻 License
```
MIT license. Copyright (c) 2022 - Mercado Pago / Mercado Libre
For more information, see the LICENSE file.
```
================================================
FILE: SUPPORT.md
================================================
# 🆘 Support and Help
> **Quick guide:** Have a bug? → [Bug Report](../../issues/new/choose) | Questions? → [Question](../../issues/new/choose) | New idea? → [Feature Request](../../issues/new/choose)
---
## 🎯 Quick Decision Guide
| If you need... | Then... |
|----------------|---------|
| 💬 Question about how to use the SDK | [Create Question](../../issues/new/choose) |
| 🐛 Report an error or bug | [Create Bug Report](../../issues/new/choose) |
| ✨ Propose new feature | [Create Feature Request](../../issues/new/choose) |
| 💳 Problem with your MP account | [Official MP Support - ES ](https://www.mercadopago.com.co/developers/en/support/center)- [Official MP Support - PT ](https://www.mercadopago.com.co/developers/pt/support/center) |
---
## 📚 Before Creating an Issue
**Search first, ask later:**
1. **[Official Documentation](https://www.mercadopago.com/developers/es/docs)** - Most questions are answered here
2. **[Closed Issues](../../issues?q=is%3Aissue+is%3Aclosed)** - Your problem may be solved
3. **[Open Issues](../../issues?q=is%3Aissue+is%3Aopen)** - Your problem may be already reported
---
## 💬 How to Report Issues
### 1. For Questions 💬
**When to use?** Doubts about usage, configuration, or best practices.
**Steps:**
1. Search in [closed questions](../../issues?q=is%3Aissue+is%3Aclosed+label%3Aquestion)
2. [Create new question](../../issues/new/choose)
3. **Include:** SDK version, country, environment, code example.
### 2. For Bugs 🐛
**When to use?** Errors, unexpected behavior and/or crashes.
**Steps:**
1. Verify [latest version](../../releases/latest)
2. Search in [existing bugs](../../issues?q=is%3Aissue+label%3Abug)
3. [Report bug](../../issues/new/choose)
4. **Include:** reproducible steps, logs, environment, SDK version.
### 3. For Features ✨
**When to use?** Propose improvements or new features
**Steps:**
1. Search in [feature requests](../../issues?q=is%3Aissue+label%3Afeature%20request)
2. [Propose feature](../../issues/new/choose)
3. **Explain:** problem it solves, use cases, benefit.
### 4. To Contribute 🤝
**Want to help?** Read [CONTRIBUTING.md](./CONTRIBUTING.md)
---
## 🔒 Security
### ⚠️ NEVER Share in Public Issues:
- ❌ Access tokens or production credentials
- ❌ Client IDs / Client Secrets
- ❌ Customer or card data
- ❌ Personally Identifiable Information (PII)
> **⚠️ IMPORTANT:** Issues with real data will be closed and reported immediately.
---
## 🌎 Official Mercado Pago SDK Support
### ⚡ GitHub Issues Scope
**GitHub Issues is ONLY for SDK technical support.**
✅ **Use GitHub for:**
- SDK bugs
- Questions about SDK usage
- SDK features
- Code contributions
❌ **DO NOT use GitHub for:**
- Problems with your MP account
- Specific transactions or payments
- Commercial or billing topics
- Homologation/certification
- Account access or credentials
- Webhook configuration in your account
### 🏢 Contact Official MP Support for:
[**🔗 Official Mercado Pago Support - ES**](https://www.mercadopago.com.co/developers/es/support/center)
[**🔗 Official Mercado Pago Support - PT**](https://www.mercadopago.com.co/developers/pt/support/center)
- ✉️ Account problems
- 💳 Transactions and payments
- 🤝 Commercial topics
- 📋 Homologation
- 🔐 Account access
- 🌐 Webhooks in your account
- 📊 Reports and statistics
---
## 🔗 Resources and Contacts
### Documentation
- **[Official Documentation](https://www.mercadopago.com/developers/es/docs)** - Complete guides
- **[API Reference](https://www.mercadopago.com/developers/en/reference)** - API reference
- **[SDKs](https://www.mercadopago.com/developers/en/docs/sdks-library/server-side)** - Other SDKs
### Support
- **[GitHub Issues](../../issues/new/choose)** - SDK technical support
### Community channels
- **[Discord](https://discord.gg/96nqqpaycN)** - Community channel
- **[Newsletter](https://www.mercadopago.com/developers/panel/contact)** - Mercado Pago Newsletter
- **[Status Page](https://status.mercadopago.com/)** - Service status
---
## 💡 Tips for Getting Quick Help
1. **🔍 Search first** - Saves everyone time
2. **📝 Be specific** - "Error 400 on POST /payments" vs "It doesn't work"
3. **💻 Reproducible code** - Minimal and complete example
4. **📋 Follow templates** - They're designed to help you
5. **🚫 No sensitive data** - Protect your security
6. **🤝 Be respectful** - We're all part of the community
---
💙 **Thank you for being part of the Mercado Pago developer community!**
================================================
FILE: build-gradle.sh
================================================
#!/bin/sh
VERSION="7.6.1"
BREW_VERSION=${VERSION:0:1}
INSTALL_DIR=gradle
CMD=$(which gradle)
check_gradle_installed() {
echo "Checking if gradle is installed globally..."
which gradle > /dev/null 2>&1
return $?
}
install() {
which brew > /dev/null 2>&1
if [ $? -eq 0 ];
then
echo "Homebrew detected. Install gradle globally?"
echo "[yes/no] default: yes"
read brew
if [[ "$brew" == "yes" ]] || [[ "$brew" == "" ]];
then
echo "brew"
install_brew
else
echo "local"
install_locally
fi
else
install_locally
fi
}
install_brew() {
echo "Installing version $BREW_VERSION globally with Homebrew..."
brew install "gradle@$BREW_VERSION"
ln -s /usr/local/opt/gradle@$BREW_VERSION/bin/gradle /usr/local/bin/gradle
CMD=$(which gradle)
}
install_locally() {
echo "Installing version $VERSION locally @ ./$INSTALL_DIR/..."
ls gradle > /dev/null 2>&1
if [ $? -gt 0 ];
then
mkdir gradle
fi
curl "https://downloads.gradle-dn.com/distributions/gradle-$VERSION-bin.zip" > "gradle/gradle-$VERSION-bin.zip"
unzip -d gradle "gradle/gradle-$GRADLE_VERSION-bin.zip"
export GRADLE_HOME="gradle/gradle-$VERSION"
CMD="$GRADLE_HOME/bin/gradle"
}
init() {
ls settings.gradle > /dev/null 2>&1
if [ $? -gt 0 ];
then
echo "Setting up project..."
$CMD init <<< "\r\rno\r"
fi
}
build() {
which gradle > /dev/null 2>&1
if [ $? -gt 0 ];
then
export GRADLE_HOME="gradle/gradle-$VERSION"
CMD="$GRADLE_HOME/bin/gradle"
fi
$CMD build
}
check_gradle_installed
installed=$?
if [ $installed -gt 0 ] ;
then
echo "Gradle not found. Installing..."
install
fi
init
build
================================================
FILE: maven-central-deploy.sh
================================================
#!/usr/bin/env bash
!/bin/bash
# Deploy maven artefact in current directory into Maven central repository
# using maven-release-plugin goals
read -p "Really deploy to maven central repository (yes/no)? "
if ( [ "$REPLY" == "yes" ] ) then
ssh-add ~/.ssh/lubos.krnac
ssh-add -l
mvn release:clean release:prepare release:perform -B -e | tee maven-central-deploy.log
ssh-add -D
else
echo 'Exit without deploy'
fi
================================================
FILE: mp_ref_report.md
================================================
# MP API Reference Audit Report — Java SDK
_Generado: 2026-04-24_
## Resumen
| Categoria | Cantidad |
|-----------|----------|
| Total metodos API | 48 |
| Con reference URL | 28 (58%) |
| Sin reference URL (gaps) | 20 (42%) |
| URLs no canonicas (dominio pais) | 16 |
| URLs canonicas (.com) | 10 |
---
## URLs no canonicas (dominio por pais)
Estas URLs usan dominios por pais (`.com.br`, `.com.ar`) en lugar del canonico `https://www.mercadopago.com/developers/en/reference/...`:
| Archivo | URL encontrada | Dominio |
|---------|---------------|---------|
| PaymentRefundClient.java | `https://www.mercadopago.com.br/developers/en/reference/chargebacks/_payments_id_refunds/post` | .com.br |
| PaymentRefundClient.java | `https://www.mercadopago.com.br/developers/en/reference/chargebacks/_payments_id_refunds_refund_id/get` | .com.br |
| PaymentRefundClient.java | `https://www.mercadopago.com.br/developers/en/reference/chargebacks/_payments_id_refunds/get` | .com.br |
| CustomerClient.java | `https://www.mercadopago.com.br/developers/en/reference/online-payments/checkout-api/customers/search-customer/get` | .com.br |
| CustomerCardClient.java | `https://www.mercadopago.com.br/developers/en/reference/cards/_customers_customer_id_cards/get` | .com.br |
| IdentificationTypeClient.java | `https://www.mercadopago.com.br/developers/en/reference/identification_types/_identification_types/get` | .com.br |
| MerchantOrderClient.java | `https://www.mercadopago.com.br/developers/en/reference/merchant_orders/_merchant_orders/post` | .com.br |
| MerchantOrderClient.java | `https://www.mercadopago.com.br/developers/en/reference/merchant_orders/_merchant_orders_id/get` | .com.br |
| MerchantOrderClient.java | `https://www.mercadopago.com.br/developers/en/reference/merchant_orders/_merchant_orders_id/put` | .com.br |
| MerchantOrderClient.java | `https://www.mercadopago.com.br/developers/en/reference/merchant_orders/_merchant_orders_search/get` | .com.br |
| OauthClient.java | `https://www.mercadopago.com.br/developers/en/reference/oauth/_oauth_token/post` | .com.br |
| PreferenceClient.java | `https://www.mercadopago.com.br/developers/en/reference/preferences/_checkout_preferences/post` | .com.br |
| PreferenceClient.java | `https://www.mercadopago.com.br/developers/en/reference/preferences/_checkout_preferences_id/get` | .com.br |
| PreferenceClient.java | `https://www.mercadopago.com.br/developers/en/reference/preferences/_checkout_preferences_id/put` | .com.br |
| PreferenceClient.java | `https://www.mercadopago.com.br/developers/en/reference/preferences/_checkout_preferences_search/get` | .com.br |
| PaymentMethodClient.java | `https://www.mercadopago.com.br/developers/en/reference/payment_methods/_payment_methods/get` | .com.br |
| PointClient.java | `https://www.mercadopago.com.ar/developers/en/reference/in-person-payments/point/orders/create-order/post` | .com.ar |
| PointClient.java | `https://www.mercadopago.com.ar/developers/en/reference/in-person-payments/point/orders/get-order/get` | .com.ar |
| PointClient.java | `https://www.mercadopago.com.ar/developers/en/reference/in-person-payments/point/orders/cancel-order/post` | .com.ar |
| PointClient.java | `https://www.mercadopago.com.ar/developers/en/reference/in-person-payments/point/terminals/get-terminals/get` | .com.ar |
| PointClient.java | `https://www.mercadopago.com.ar/developers/en/reference/in-person-payments/point/terminals/update-operation-mode/patch` | .com.ar |
---
## Links faltantes (gaps) — 20 metodos sin referencia
### PaymentClient.java (4 gaps de 5 metodos)
- [ ] `get(Long id)` — GET /v1/payments/{id}
- [ ] `cancel(Long id)` — PUT /v1/payments/{id} (status=cancelled)
- [ ] `capture(Long id, BigDecimal amount)` — PUT /v1/payments/{id} (capture=true)
- [ ] `search(MPSearchRequest request)` — GET /v1/payments/search
### CustomerCardClient.java (4 gaps de 4 metodos)
- [ ] `get(String customerId, String cardId)` — GET /v1/customers/{id}/cards/{cardId}
- [ ] `create(String customerId, CustomerCardCreateRequest request)` — POST /v1/customers/{id}/cards
- [ ] `delete(String customerId, String cardId)` — DELETE /v1/customers/{id}/cards/{cardId}
- [ ] `listAll(String customerId)` — GET /v1/customers/{id}/cards
### CardTokenClient.java (2 gaps de 2 metodos)
- [ ] `get(String id)` — GET /v1/card_tokens/{id}
- [ ] `create(CardTokenRequest request)` — POST /v1/card_tokens
### OrderClient.java (9 gaps de 10 metodos)
- [ ] `get(String id)` — GET /v1/orders/{id}
- [ ] `process(String id)` — POST /v1/orders/{id}/process
- [ ] `createTransaction(String orderId, OrderTransactionRequest request)` — POST /v1/orders/{id}/transactions
- [ ] `updateTransaction(String orderId, String transactionId, OrderPaymentRequest request)` — PUT /v1/orders/{id}/transactions/{transactionId}
- [ ] `cancel(String orderId)` — POST /v1/orders/{id}/cancel
- [ ] `capture(String orderId)` — POST /v1/orders/{id}/capture
- [ ] `deleteTransaction(String orderId, String transactionId)` — DELETE /v1/orders/{id}/transactions/{transactionId}
- [ ] `refund(String orderId, OrderRefundRequest request)` — POST /v1/orders/{id}/refund
- [ ] `search(MPSearchRequest request)` — GET /v1/orders
### PreapprovalClient.java (4 gaps de 4 metodos)
- [ ] `get(String id)` — GET /preapproval/{id}
- [ ] `create(PreapprovalCreateRequest request)` — POST /preapproval
- [ ] `update(String id, PreapprovalUpdateRequest request)` — PUT /preapproval/{id}
- [ ] `search(MPSearchRequest request)` — GET /preapproval/search
### Otros
- [ ] `CustomerClient.delete(String customerId)` — DELETE /v1/customers/{id}
- [ ] `OauthClient.getAuthorizationURL(...)` — URL builder (no endpoint directo)
- [ ] `PointClient.getPaymentIntentStatus(String id)` — GET /point/integration-api/payment-intents/{id}/events
- [ ] `UserClient.get()` — GET /users/me
---
## Cobertura por cliente
| Cliente | Metodos | Con URL | Sin URL | Cobertura |
|---------|---------|---------|---------|-----------|
| PaymentClient | 6 | 1 | 5* | 17% |
| PaymentRefundClient | 3 | 3 | 0 | 100% |
| CustomerClient | 5 | 4 | 1 | 80% |
| CustomerCardClient | 4 | 0 | 4 | 0% |
| CardTokenClient | 2 | 0 | 2 | 0% |
| IdentificationTypeClient | 1 | 1 | 0 | 100% |
| MerchantOrderClient | 4 | 4 | 0 | 100% |
| OauthClient | 3 | 2 | 1 | 67% |
| OrderClient | 10 | 1 | 9 | 10% |
| PointClient | 7 | 6 | 1 | 86% |
| PreapprovalClient | 4 | 0 | 4 | 0% |
| PreferenceClient | 4 | 4 | 0 | 100% |
| PaymentMethodClient | 1 | 1 | 0 | 100% |
| UserClient | 1 | 0 | 1 | 0% |
*PaymentClient: tiene 1 URL a nivel de clase pero solo cubre create()
---
## Lista de revision manual
- [ ] PaymentClient.java — 4 metodos sin referencia API
- [ ] CustomerCardClient.java — 4 metodos sin referencia API (0% cobertura)
- [ ] CardTokenClient.java — 2 metodos sin referencia API (0% cobertura)
- [ ] OrderClient.java — 9 metodos sin referencia API (10% cobertura)
- [ ] PreapprovalClient.java — 4 metodos sin referencia API (0% cobertura)
- [ ] CustomerClient.java — delete() sin referencia API
- [ ] OauthClient.java — getAuthorizationURL() sin referencia API
- [ ] PointClient.java — getPaymentIntentStatus() sin referencia API
- [ ] UserClient.java — get() sin referencia API
- [ ] 16 URLs usan dominio por pais (.com.br/.com.ar) en lugar del canonico (.com)
================================================
FILE: pom.xml
================================================
4.0.0com.mercadopagosdk-java3.1.0jarMercadopago SDKMercadopago SDKhttps://github.com/mercadopago/sdk-javaApache License, Version 2.0https://www.apache.org/licenses/LICENSE-2.0.txtMercado Pagomp_sdk@mercadopago.comMercado Pagohttps://www.mercadopago.com/developers${project.artifactId}-${project.version}src/main/javasrc/test/javaorg.apache.maven.pluginsmaven-compiler-plugin3.8.11.81.8maven-clean-plugin3.1.0auto-cleaninitializecleanorg.apache.maven.pluginsmaven-gpg-plugin3.2.4sign-artifactsverifysign--pinentry-modeloopbackMAVEN_GPG_PASSPHRASEorg.apache.maven.pluginsmaven-surefire-plugin3.0.0-M5org.apache.maven.pluginsmaven-source-plugin3.3.0attach-sourcesjar-no-forkorg.apache.maven.pluginsmaven-javadoc-plugin3.8.01.8none${project.build.directory}/delombok${project.basedir}/docsattach-javadocsjarorg.sonatype.centralcentral-publishing-maven-plugin0.9.0truecentraltrueorg.codehaus.mojocobertura-maven-plugin2.7htmlxmlorg.jacocojacoco-maven-plugin0.8.7prepare-agentreporttestreportorg.projectlomboklombok-maven-plugin1.18.20.0${project.basedir}/src/main/java${project.build.directory}/delombokfalsegenerate-sourcesdelombokhttps://github.com/mercadopago/sdk-java/tree/masterscm:git:git://github.com/mercadopago/sdk-java.gitscm:git:ssh://github.com:mercadopago/sdk-java.gitHEADUTF-8org.apache.httpcomponentshttpclient4.5.14org.apache.commonscommons-collections44.4org.apache.commonscommons-compress1.27.1org.apache.velocityvelocity-engine-core2.4.1org.hsqldbhsqldborg.apache.velocity.toolsvelocity-tools-generic3.1commons-collectionscommons-collectionsorg.apache.commonscommons-lang33.18.0org.apache.httpcomponents.client5httpclient55.4.3com.google.code.gsongson2.11.0org.projectlomboklombok1.18.32providedorg.junit.jupiterjunit-jupiter-api5.8.2testorg.junit.jupiterjunit-jupiter-params5.8.2testjunitjunit4.13.1testorg.mockitomockito-core5.18.0test
================================================
FILE: src/main/java/com/mercadopago/MercadoPagoConfig.java
================================================
package com.mercadopago;
import com.mercadopago.net.MPDefaultHttpClient;
import com.mercadopago.net.MPHttpClient;
import java.util.Objects;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.StreamHandler;
import lombok.Getter;
import lombok.Setter;
import lombok.Synchronized;
import org.apache.http.HttpHost;
import org.apache.http.client.HttpRequestRetryHandler;
/**
* Global configuration class for the MercadoPago Java SDK.
*
*
This class holds all SDK-wide settings such as the OAuth access token, HTTP timeouts,
* connection pool limits, proxy configuration, logging behavior, and tracking identifiers.
* All fields are static and thread-safe (declared {@code volatile} or synchronized), so a
* single configuration applies across the entire application.
*
*
Per-request overrides (e.g., a different access token or timeout for one call) can be
* specified via {@link com.mercadopago.core.MPRequestOptions}; any field left at its
* zero/null default in that object will fall back to the values defined here.
*
*
*
* @see com.mercadopago.core.MPRequestOptions
* @see com.mercadopago.net.MPDefaultHttpClient
*/
public class MercadoPagoConfig {
public static final String CURRENT_VERSION = "3.1.0";
/** Internal MercadoPago product identifier sent in every API request for analytics. */
public static final String PRODUCT_ID = "BC32A7VTRPP001U8NHJ0";
/**
* Tracking header value sent with every API request. Encodes the Java runtime version
* and SDK version so the MercadoPago platform can identify the client environment.
*/
public static final String TRACKING_ID = String.format(
"platform:%s,type:SDK%s,so;",
MercadoPagoConfig.getJavaVersion(), MercadoPagoConfig.CURRENT_VERSION);
/** Base URL for all MercadoPago REST API calls. */
public static final String BASE_URL = "https://api.mercadopago.com";
/** Default maximum number of concurrent HTTP connections in the connection pool. Value: 10. */
private static final int DEFAULT_MAX_CONNECTIONS = 10;
/** Default timeout in milliseconds for establishing an HTTP connection. Value: 20 000 ms. */
private static final int DEFAULT_CONNECTION_TIMEOUT_MS = 20000;
/** Default timeout in milliseconds for obtaining a connection from the pool. Value: 20 000 ms. */
private static final int DEFAULT_CONNECTION_REQUEST_TIMEOUT_MS = 20000;
/** Default socket (read) timeout in milliseconds for waiting for response data. Value: 20 000 ms. */
private static final int DEFAULT_SOCKET_TIMEOUT_MS = 20000;
/** Default scope label used when reporting SDK metrics. Value: {@code "prod"}. */
private static final String DEFAULT_METRICS_SCOPE = "prod";
/** Default logging level for the SDK logger. Value: {@link Level#OFF} (logging disabled). */
private static final Level DEFAULT_LOGGING_LEVEL = Level.OFF;
/** OAuth access token used to authenticate API requests when no per-request token is provided. */
@Getter
@Setter
private static volatile String accessToken;
/** Platform identifier header sent with API requests for tracking and analytics. */
@Getter
@Setter
private static volatile String platformId;
/** Corporation identifier header sent with API requests for multi-entity tracking. */
@Getter
@Setter
private static volatile String corporationId;
/** Integrator identifier header sent with API requests to attribute traffic to a specific integrator. */
@Getter
@Setter
private static volatile String integratorId;
/**
* Custom {@link StreamHandler} for SDK log output. When {@code null}, a default
* {@link ConsoleHandler} is used instead.
*
* @see #getStreamHandler()
*/
@Getter
@Setter
private static volatile StreamHandler loggingHandler;
/** Scope label used when reporting SDK metrics. Defaults to {@code "prod"}. */
@Getter
@Setter
private static volatile String metricsScope = DEFAULT_METRICS_SCOPE;
/**
* Java {@link Level} controlling the verbosity of SDK log output. Defaults to
* {@link Level#OFF} (no logging).
*/
@Getter
@Setter
private static volatile Level loggingLevel = DEFAULT_LOGGING_LEVEL;
/** Maximum number of concurrent HTTP connections maintained in the connection pool. Defaults to 10. */
@Getter
@Setter
private static volatile int maxConnections = DEFAULT_MAX_CONNECTIONS;
/** Timeout in milliseconds for establishing a new HTTP connection. Defaults to 20 000 ms. */
@Getter
@Setter
private static volatile int connectionTimeout = DEFAULT_CONNECTION_TIMEOUT_MS;
/** Timeout in milliseconds for obtaining a connection from the pool. Defaults to 20 000 ms. */
@Getter
@Setter
private static volatile int connectionRequestTimeout = DEFAULT_CONNECTION_REQUEST_TIMEOUT_MS;
/** Timeout in milliseconds for waiting for response data on an open socket. Defaults to 20 000 ms. */
@Getter
@Setter
private static volatile int socketTimeout = DEFAULT_SOCKET_TIMEOUT_MS;
/**
* HTTP client implementation used for all API calls. Lazily initialized to
* {@link MPDefaultHttpClient} on first access via {@link #getHttpClient()}.
*/
@Setter
private static volatile MPHttpClient httpClient;
/**
* HTTP proxy host through which all API requests are routed. When {@code null},
* requests are made directly without a proxy.
*/
@Getter(onMethod_ = { @Synchronized })
@Setter(onMethod_ = { @Synchronized })
private static HttpHost proxy;
/**
* Custom retry handler for HTTP requests. When set, the underlying Apache HTTP client
* will delegate retry decisions to this handler instead of using its default strategy.
*/
@Getter
@Setter
private static HttpRequestRetryHandler retryHandler;
/**
* Returns the HTTP client used for API communication, creating a default
* {@link MPDefaultHttpClient} instance on first invocation (lazy initialization).
*
*
The returned client is a singleton shared across all SDK calls. To replace it
* with a custom implementation, use {@link #setHttpClient(MPHttpClient)} before making
* any API requests.
*
* @return the current {@link MPHttpClient} instance, never {@code null}
* @see MPDefaultHttpClient
*/
public static synchronized MPHttpClient getHttpClient() {
if (Objects.isNull(httpClient)) {
httpClient = new MPDefaultHttpClient();
}
return httpClient;
}
/**
* Returns the Java runtime version formatted as {@code "major|full"}.
*
*
For example, on Java 11.0.12+7, this method returns {@code "11|11.0.12+7"}.
* The value is used in the {@link #TRACKING_ID} header sent with every API request.
*
* @return a string in the format {@code "majorVersion|fullVersion"}, or {@code null}
* if the {@code java.runtime.version} system property is unavailable
*/
public static synchronized String getJavaVersion() {
String version = System.getProperty("java.runtime.version");
if (Objects.isNull(version)) {
return null;
}
String major = version.replaceAll("^1\\.", "");
int dotIndex = major.indexOf('.');
if (dotIndex != -1) {
major = major.substring(0, dotIndex);
}
return major + "|" + version;
}
/**
* Returns the active {@link StreamHandler} for SDK logging. If a custom handler has been
* set via {@link #setLoggingHandler(StreamHandler)}, it is returned; otherwise a new
* {@link ConsoleHandler} is created as a fallback.
*
* @return the configured {@link StreamHandler}, or a default {@link ConsoleHandler}
*/
public static StreamHandler getStreamHandler() {
return Objects.nonNull(loggingHandler) ? loggingHandler : new ConsoleHandler();
}
}
================================================
FILE: src/main/java/com/mercadopago/client/MercadoPagoClient.java
================================================
package com.mercadopago.client;
import static java.util.Objects.nonNull;
import static org.apache.commons.collections4.MapUtils.isNotEmpty;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import com.google.gson.JsonObject;
import com.mercadopago.MercadoPagoConfig;
import com.mercadopago.core.MPRequestOptions;
import com.mercadopago.exceptions.MPApiException;
import com.mercadopago.exceptions.MPException;
import com.mercadopago.net.Headers;
import com.mercadopago.net.HttpMethod;
import com.mercadopago.net.MPHttpClient;
import com.mercadopago.net.MPRequest;
import com.mercadopago.net.MPResponse;
import com.mercadopago.net.MPSearchRequest;
import com.mercadopago.net.UrlFormatter;
import java.util.HashMap;
import java.util.Map;
/**
* Abstract base client for all MercadoPago API interactions.
*
*
This class provides the foundation for every specialized API client in the SDK. It handles
* HTTP request execution, default and custom header management (including authorization via Bearer
* tokens), timeout resolution with a three-level priority (request options, request object, global
* config), and automatic idempotency key generation for {@code POST}, {@code PUT}, and
* {@code PATCH} requests.
*
*
Subclasses should use the protected {@code send()}, {@code search()}, and {@code list()}
* helper methods to communicate with the MercadoPago REST API.
*
* @see com.mercadopago.MercadoPagoConfig
* @see MPHttpClient
* @see MPRequestOptions
*/
public abstract class MercadoPagoClient {
/** Default value for the {@code Accept} HTTP header. */
private static final String ACCEPT_HEADER_VALUE = "application/json";
/** Default value for the {@code Content-Type} HTTP header, including UTF-8 charset. */
private static final String CONTENT_TYPE_HEADER_VALUE = "application/json; charset=UTF-8";
/** Format string used to build the {@code Authorization: Bearer} header value. */
private static final String BEARER = "Bearer %s";
/** Path segment used to detect OAuth token requests and skip the Bearer header. */
private static final String OAUTH_TOKEN = "/oauth/token";
/** HTTP client used to execute every request dispatched by this client instance. */
protected final MPHttpClient httpClient;
/**
* Default HTTP headers sent with every request. Populated during construction with
* {@code Accept}, {@code Content-Type}, {@code User-Agent}, {@code Product-Id}, and
* {@code Tracking-Id}.
*/
protected Map defaultHeaders;
/**
* Constructs a new {@code MercadoPagoClient} with the given HTTP client.
*
*
Initialises the default headers map with {@code Accept}, {@code Content-Type},
* {@code User-Agent}, {@code Product-Id}, and {@code Tracking-Id} values taken from
* {@link MercadoPagoConfig}.
*
* @param httpClient the {@link MPHttpClient} implementation used to execute HTTP requests
*/
public MercadoPagoClient(MPHttpClient httpClient) {
this.httpClient = httpClient;
this.defaultHeaders = new HashMap<>();
defaultHeaders.put(Headers.ACCEPT, ACCEPT_HEADER_VALUE);
defaultHeaders.put(Headers.PRODUCT_ID, MercadoPagoConfig.PRODUCT_ID);
defaultHeaders.put(
Headers.USER_AGENT,
String.format("MercadoPago Java SDK/%s", MercadoPagoConfig.CURRENT_VERSION));
defaultHeaders.put(Headers.TRACKING_ID, MercadoPagoConfig.TRACKING_ID);
defaultHeaders.put(Headers.CONTENT_TYPE, CONTENT_TYPE_HEADER_VALUE);
}
/**
* Sends an HTTP request using the pre-built {@link MPRequest} object with default configuration.
*
*
This is a convenience overload that delegates to {@link #send(MPRequest, MPRequestOptions)}
* with {@code null} request options, meaning global configuration from
* {@link MercadoPagoConfig} is used for timeouts and access tokens.
*
* @param request the {@link MPRequest} containing URI, HTTP method, payload, and query parameters
* @return the {@link MPResponse} with status code, headers, and body returned by the API
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
protected MPResponse send(MPRequest request) throws MPException, MPApiException {
return this.send(request, null);
}
/**
* Sends an HTTP request using the pre-built {@link MPRequest} object, applying optional
* per-request overrides.
*
*
This method resolves the final URL (formatting query parameters), selects the access token
* (preferring {@code requestOptions} over global config), merges default and custom headers,
* and resolves timeouts with a three-level priority: request options > request object >
* {@link MercadoPagoConfig} defaults. An idempotency key is automatically generated for
* {@code POST}, {@code PUT}, and {@code PATCH} methods unless one is already present.
*
* @param request the {@link MPRequest} containing URI, HTTP method, payload, and query parameters
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the {@link MPResponse} with status code, headers, and body returned by the API
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
protected MPResponse send(MPRequest request, MPRequestOptions requestOptions)
throws MPException, MPApiException {
String uri = UrlFormatter.format(request.getUri(), request.getQueryParams());
return httpClient.send(
MPRequest.builder()
.uri(uri)
.accessToken(getAccessToken(requestOptions))
.method(request.getMethod())
.headers(addRequestHeaders(request, requestOptions))
.payload(request.getPayload())
.connectionRequestTimeout(addConnectionRequestTimeout(request, requestOptions))
.connectionTimeout(addConnectionTimeout(request, requestOptions))
.socketTimeout(addSocketTimeout(request, requestOptions))
.build());
}
/**
* Builds and sends an HTTP request from individual components with default configuration.
*
*
This is a convenience overload that delegates to
* {@link #send(String, HttpMethod, JsonObject, Map, MPRequestOptions)} with {@code null}
* request options.
*
* @param path the relative API path (e.g. {@code "/v1/payments"})
* @param method the {@link HttpMethod} to use (GET, POST, PUT, DELETE, PATCH)
* @param payload the JSON request body, or {@code null} for body-less requests
* @param queryParams a map of query-string parameters, or {@code null} if none
* @return the {@link MPResponse} with status code, headers, and body returned by the API
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
protected MPResponse send(
String path, HttpMethod method, JsonObject payload, Map queryParams)
throws MPException, MPApiException {
return this.send(path, method, payload, queryParams, null);
}
/**
* Builds and sends an HTTP request from individual components, applying optional per-request
* overrides.
*
*
Internally constructs an {@link MPRequest} via {@code buildRequest()}, then delegates to
* {@link #send(MPRequest)}. This is the most flexible {@code send()} variant and is the
* ultimate target of all other convenience overloads.
*
* @param path the relative API path (e.g. {@code "/v1/payments"})
* @param method the {@link HttpMethod} to use (GET, POST, PUT, DELETE, PATCH)
* @param payload the JSON request body, or {@code null} for body-less requests
* @param queryParams a map of query-string parameters, or {@code null} if none
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the {@link MPResponse} with status code, headers, and body returned by the API
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
protected MPResponse send(
String path,
HttpMethod method,
JsonObject payload,
Map queryParams,
MPRequestOptions requestOptions)
throws MPException, MPApiException {
MPRequest mpRequest = buildRequest(path, method, payload, queryParams, requestOptions);
return this.send(mpRequest);
}
/**
* Performs a search request against the given API path using default configuration.
*
*
Delegates to {@link #search(String, MPSearchRequest, MPRequestOptions)} with {@code null}
* request options.
*
* @param path the relative API path for the search endpoint (e.g. {@code "/v1/payments/search"})
* @param request the {@link MPSearchRequest} containing search/filter/pagination parameters, or
* {@code null} for an unfiltered search
* @return the {@link MPResponse} with the search results returned by the API
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
protected MPResponse search(String path, MPSearchRequest request)
throws MPException, MPApiException {
return this.search(path, request, null);
}
/**
* Performs a search request against the given API path, applying optional per-request overrides.
*
*
Extracts query parameters from the {@link MPSearchRequest} and issues an HTTP {@code GET}
* via the underlying {@code send()} method. If {@code searchRequest} is {@code null}, no
* query parameters are appended.
*
* @param path the relative API path for the search endpoint (e.g. {@code "/v1/payments/search"})
* @param searchRequest the {@link MPSearchRequest} containing search/filter/pagination
* parameters, or {@code null} for an unfiltered search
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the {@link MPResponse} with the search results returned by the API
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
protected MPResponse search(
String path, MPSearchRequest searchRequest, MPRequestOptions requestOptions)
throws MPException, MPApiException {
Map queryParams =
nonNull(searchRequest) ? searchRequest.getParameters() : null;
return this.send(path, HttpMethod.GET, null, queryParams, requestOptions);
}
/**
* Performs an HTTP {@code GET} request that returns a list of resources from the given API path.
*
*
This is a convenience overload that delegates to
* {@link #list(String, HttpMethod, JsonObject, Map, MPRequestOptions)} using {@code GET} with
* no payload or query parameters.
*
* @param path the relative API path for the list endpoint
* (e.g. {@code "/v1/customers/123/cards"})
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the {@link MPResponse} containing the list of resources returned by the API
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
protected MPResponse list(String path, MPRequestOptions requestOptions)
throws MPException, MPApiException {
return this.list(path, HttpMethod.GET, null, null, requestOptions);
}
/**
* Performs an HTTP request that returns a list of resources, with full control over all request
* parameters.
*
*
This method is functionally identical to
* {@link #send(String, HttpMethod, JsonObject, Map, MPRequestOptions)} and exists as a
* semantic alias to improve readability in subclasses that list resources.
*
* @param path the relative API path for the list endpoint
* @param method the {@link HttpMethod} to use (typically {@code GET})
* @param payload the JSON request body, or {@code null} for body-less requests
* @param queryParams a map of query-string parameters, or {@code null} if none
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the {@link MPResponse} containing the list of resources returned by the API
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
protected MPResponse list(
String path,
HttpMethod method,
JsonObject payload,
Map queryParams,
MPRequestOptions requestOptions)
throws MPException, MPApiException {
return this.send(path, method, payload, queryParams, requestOptions);
}
private MPRequest buildRequest(
String path,
HttpMethod method,
JsonObject payload,
Map queryParams,
MPRequestOptions requestOptions) {
return MPRequest.builder()
.uri(path)
.accessToken(getAccessToken(requestOptions))
.payload(payload)
.method(method)
.queryParams(queryParams)
.headers(addCustomHeaders(path, requestOptions))
.connectionRequestTimeout(addConnectionRequestTimeout(null, requestOptions))
.connectionTimeout(addConnectionTimeout(null, requestOptions))
.socketTimeout(addSocketTimeout(null, requestOptions))
.build();
}
private int addSocketTimeout(MPRequest request, MPRequestOptions requestOptions) {
if (nonNull(requestOptions) && requestOptions.getSocketTimeout() > 0) {
return requestOptions.getSocketTimeout();
}
if (nonNull(request) && request.getSocketTimeout() > 0) {
return request.getSocketTimeout();
}
return MercadoPagoConfig.getSocketTimeout();
}
private int addConnectionTimeout(MPRequest request, MPRequestOptions requestOptions) {
if (nonNull(requestOptions) && requestOptions.getConnectionTimeout() > 0) {
return requestOptions.getConnectionTimeout();
}
if (nonNull(request) && request.getConnectionTimeout() > 0) {
return request.getConnectionTimeout();
}
return MercadoPagoConfig.getConnectionTimeout();
}
private int addConnectionRequestTimeout(MPRequest request, MPRequestOptions requestOptions) {
if (nonNull(requestOptions) && requestOptions.getConnectionRequestTimeout() > 0) {
return requestOptions.getConnectionRequestTimeout();
}
if (nonNull(request) && request.getConnectionRequestTimeout() > 0) {
return request.getConnectionRequestTimeout();
}
return MercadoPagoConfig.getConnectionRequestTimeout();
}
private Map addRequestHeaders(MPRequest request, MPRequestOptions requestOptions) {
Map headers =
nonNull(request.getHeaders()) ? request.getHeaders() : new HashMap<>();
headers.putAll(addDefaultHeaders(request));
if (isNotBlank(MercadoPagoConfig.getCorporationId())) {
headers.put(Headers.CORPORATION_ID, MercadoPagoConfig.getCorporationId());
}
if (isNotBlank(MercadoPagoConfig.getIntegratorId())) {
headers.put(Headers.INTEGRATOR_ID, MercadoPagoConfig.getIntegratorId());
}
if (isNotBlank(MercadoPagoConfig.getPlatformId())) {
headers.put(Headers.PLATFORM_ID, MercadoPagoConfig.getPlatformId());
}
if (nonNull(requestOptions) && isNotEmpty(requestOptions.getCustomHeaders()) ) {
for (Map.Entry header : requestOptions.getCustomHeaders().entrySet()) {
if (!headers.containsKey(header.getKey()) && !Headers.CONTENT_TYPE.equalsIgnoreCase(header.getKey())) {
headers.put(header.getKey().toLowerCase(), header.getValue());
}
}
}
headers.putAll(addCustomHeaders(request.getUri(), requestOptions));
return headers;
}
private Map addDefaultHeaders(MPRequest request) {
Map headers = new HashMap<>(defaultHeaders);
if (shouldAddIdempotencyKey(request)) {
headers.put(Headers.IDEMPOTENCY_KEY, request.createIdempotencyKey());
}
if (nonNull(request) && !request.getUri().contains(OAUTH_TOKEN) && !headers.containsKey(Headers.AUTHORIZATION)) {
headers.put(Headers.AUTHORIZATION, String.format(BEARER, chooseAccessToken(request)));
}
return headers;
}
private String chooseAccessToken(MPRequest request) {
return request.getAccessToken() != null ? request.getAccessToken() : MercadoPagoConfig.getAccessToken();
}
private Map addCustomHeaders(String uri, MPRequestOptions requestOptions) {
Map headers = new HashMap<>();
if (nonNull(requestOptions) && nonNull(requestOptions.getCustomHeaders())) {
for (Map.Entry entry : requestOptions.getCustomHeaders().entrySet()) {
headers.put(entry.getKey().toLowerCase(), entry.getValue());
}
}
if (requestOptions!= null && !uri.contains(OAUTH_TOKEN)) {
headers.put(Headers.AUTHORIZATION, String.format(BEARER, getAccessToken(requestOptions)));
}
return headers;
}
private boolean shouldAddIdempotencyKey(MPRequest request) {
boolean containsIdempotency = false;
if (nonNull(request) && nonNull(request.getHeaders())) {
containsIdempotency = request.getHeaders().containsKey(Headers.IDEMPOTENCY_KEY.toLowerCase());
}
if (containsIdempotency) return false;
return request.getMethod() == HttpMethod.POST ||
request.getMethod() == HttpMethod.PUT ||
request.getMethod() == HttpMethod.PATCH;
}
private String getAccessToken(MPRequestOptions requestOptions) {
return nonNull(requestOptions)
&& nonNull(requestOptions.getAccessToken())
&& !requestOptions.getAccessToken().isEmpty()
? requestOptions.getAccessToken()
: MercadoPagoConfig.getAccessToken();
}
}
================================================
FILE: src/main/java/com/mercadopago/client/cardtoken/CardTokenClient.java
================================================
package com.mercadopago.client.cardtoken;
import static com.mercadopago.MercadoPagoConfig.getStreamHandler;
import com.mercadopago.MercadoPagoConfig;
import com.mercadopago.client.MercadoPagoClient;
import com.mercadopago.core.MPRequestOptions;
import com.mercadopago.exceptions.MPApiException;
import com.mercadopago.exceptions.MPException;
import com.mercadopago.net.HttpMethod;
import com.mercadopago.net.MPHttpClient;
import com.mercadopago.net.MPResponse;
import com.mercadopago.resources.CardToken;
import com.mercadopago.serialization.Serializer;
import java.util.logging.Logger;
import java.util.logging.StreamHandler;
/**
* Client for the MercadoPago Card Tokens API.
*
*
Provides PCI-compliant card tokenization operations. Tokens represent card data securely
* and are used when creating payments or saving cards to a customer profile.
*
*
Usage example:
*
{@code
* CardTokenClient client = new CardTokenClient();
* CardToken token = client.create(cardTokenRequest);
* // Use token.getId() when creating a payment
* }
*
* @see Card Tokens API reference
*/
public class CardTokenClient extends MercadoPagoClient {
/** Class-level logger for card token operations. */
private static final Logger LOGGER = Logger.getLogger(CardTokenClient.class.getName());
/**
* Default constructor. Uses the default HTTP client provided by {@link MercadoPagoConfig}.
*/
public CardTokenClient() {
this(MercadoPagoConfig.getHttpClient());
}
/**
* Constructs a {@code CardTokenClient} with a custom HTTP client.
*
* @param httpClient the {@link MPHttpClient} implementation used to execute HTTP requests
*/
public CardTokenClient(MPHttpClient httpClient) {
super(httpClient);
StreamHandler streamHandler = getStreamHandler();
streamHandler.setLevel(MercadoPagoConfig.getLoggingLevel());
LOGGER.addHandler(streamHandler);
LOGGER.setLevel(MercadoPagoConfig.getLoggingLevel());
}
/**
* Retrieves a card token by its unique identifier.
*
* @param id the unique identifier of the card token
* @return the requested {@link CardToken}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CardToken get(String id) throws MPException, MPApiException {
return this.get(id, null);
}
/**
* Retrieves a card token by its unique identifier with custom request options.
*
* @param id the unique identifier of the card token
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the requested {@link CardToken}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CardToken get(String id, MPRequestOptions requestOptions)
throws MPException, MPApiException {
MPResponse response =
send(String.format("/v1/card_tokens/%s", id), HttpMethod.GET, null, null, requestOptions);
CardToken cardToken = Serializer.deserializeFromJson(CardToken.class, response.getContent());
cardToken.setResponse(response);
return cardToken;
}
/**
* Creates a new card token from card data.
*
* @param request the {@link CardTokenRequest} with card number, expiration, security code, and
* cardholder details
* @return the created {@link CardToken} containing the token identifier
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CardToken create(CardTokenRequest request) throws MPException, MPApiException {
return this.create(request, null);
}
/**
* Creates a new card token from card data with custom request options.
*
* @param request the {@link CardTokenRequest} with card number, expiration, security code, and
* cardholder details
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the created {@link CardToken} containing the token identifier
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CardToken create(CardTokenRequest request, MPRequestOptions requestOptions)
throws MPException, MPApiException {
MPResponse response =
send(
"/v1/card_tokens",
HttpMethod.POST,
Serializer.serializeToJson(request),
null,
requestOptions);
CardToken cardToken = Serializer.deserializeFromJson(CardToken.class, response.getContent());
cardToken.setResponse(response);
return cardToken;
}
}
================================================
FILE: src/main/java/com/mercadopago/client/cardtoken/CardTokenRequest.java
================================================
package com.mercadopago.client.cardtoken;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO used to create a card token for secure payment processing. Card tokens allow
* sensitive card data to be handled in a PCI-compliant manner by replacing actual card details
* with a temporary token that can be used in payment requests.
*
* @see Card Token API Reference
*/
@Builder
@Getter
public class CardTokenRequest {
/** Unique identifier of the saved card to be tokenized. */
private final String cardId;
/** Unique identifier of the customer who owns the card. */
private final String customerId;
/** Security code (CVV/CVC) printed on the card, required for token creation. */
private final String securityCode;
}
================================================
FILE: src/main/java/com/mercadopago/client/common/AddressRequest.java
================================================
package com.mercadopago.client.common;
import lombok.Getter;
import lombok.experimental.SuperBuilder;
/**
* Request DTO representing a physical address used across multiple Mercado Pago API resources such
* as payments, customers, and shipping. Serves as a reusable base for address-related requests.
*
* @see Mercado Pago API Reference
*/
@Getter
@SuperBuilder
public class AddressRequest {
/** Postal or ZIP code of the address (e.g., "01310-100"). */
private final String zipCode;
/** Name of the street (e.g., "Avenida Paulista"). */
private final String streetName;
/** Street number or house number (e.g., "1578"). */
private final String streetNumber;
/** Neighborhood or district name. */
private final String neighborhood;
/** City name (e.g., "Sao Paulo"). */
private final String city;
/** State or province name (e.g., "SP"). */
private final String state;
/** Additional address details such as suite or unit number. */
private final String complement;
/** Floor number in the building, if applicable. */
private final String floor;
}
================================================
FILE: src/main/java/com/mercadopago/client/common/IdentificationRequest.java
================================================
package com.mercadopago.client.common;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing a personal identification document used to identify payers,
* customers, and cardholders. The type and number vary by country (e.g., CPF in Brazil,
* DNI in Argentina, CC in Colombia).
*
* @see Mercado Pago API Reference
*/
@Getter
@Builder
public class IdentificationRequest {
/** Type of identification document (e.g., "CPF", "DNI", "CNPJ", "CC"). */
private final String type;
/** Identification document number. */
private final String number;
}
================================================
FILE: src/main/java/com/mercadopago/client/common/InvoicePeriod.java
================================================
package com.mercadopago.client.common;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing the billing period configuration for subscription invoices. Defines
* the frequency type and interval at which recurring charges are generated for a subscription plan.
*
* @see Subscriptions API Reference
*/
@Getter
@Builder
public class InvoicePeriod {
/** Frequency type of the billing period (e.g., "monthly", "daily"). */
private String type;
/** Number of frequency units between each billing cycle (e.g., 1 for every month). */
private Integer period;
}
================================================
FILE: src/main/java/com/mercadopago/client/common/PhoneRequest.java
================================================
package com.mercadopago.client.common;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing a phone number, split into area code and number. Used across multiple
* Mercado Pago API resources such as customers, payers, and shipping contacts.
*
* @see Mercado Pago API Reference
*/
@Getter
@Builder
public class PhoneRequest {
/** Telephone area code (e.g., "11" for Sao Paulo, "54" for Argentina). */
private final String areaCode;
/** Phone number without the area code. */
private final String number;
}
================================================
FILE: src/main/java/com/mercadopago/client/common/SubMerchant.java
================================================
package com.mercadopago.client.common;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing sub-merchant information for Payment Facilitator (PF) transactions.
* Required by card brands and regulators to identify the actual merchant in payment facilitator
* models, including details such as MCC, address, and tax identification.
*
* @see Mercado Pago API Reference
*/
@Getter
@Builder
public class SubMerchant {
/** Unique identifier code of the sub-merchant in the facilitator's system. */
private final String subMerchantId;
/** Merchant Category Code (MCC) per ABECS standards and/or primary CNAE classification. */
private final String mcc;
/** ISO 3166-1 country code where the sub-merchant is located (e.g., "BRA"). */
private final String country;
/** Street number of the sub-merchant's address. */
private final Integer addressDoorNumber;
/** Postal code (CEP) of the sub-merchant's address. */
private final String zip;
/** Tax identification number of the sub-merchant (CPF or CNPJ). */
private final String documentNumber;
/** City where the sub-merchant is located. */
private final String city;
/** Street name of the sub-merchant's address. */
private final String addressStreet;
/** Registered legal name of the sub-merchant. */
private final String legalName;
/** ISO code of the state or region where the sub-merchant is located. */
private final String regionCodeIso;
/** State or region code of the sub-merchant's address. */
private final String regionCode;
/** Type of tax identification document (e.g., "CPF", "CNPJ"). */
private final String documentType;
/** Phone number of the sub-merchant. */
private final String phone;
/** Website URL of the sub-merchant or payment facilitator. */
private final String url;
}
================================================
FILE: src/main/java/com/mercadopago/client/common/SubscriptionSequence.java
================================================
package com.mercadopago.client.common;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing the sequence tracking information for a recurring subscription payment.
* Indicates the current installment number and the total number of planned installments in the
* subscription lifecycle.
*
* @see Subscriptions API Reference
*/
@Getter
@Builder
public class SubscriptionSequence {
/** Current sequence number of this payment within the subscription (e.g., 3 of 12). */
private Integer number;
/** Total number of planned payments in the subscription series. */
private Integer total;
}
================================================
FILE: src/main/java/com/mercadopago/client/customer/CustomerAddressRequest.java
================================================
package com.mercadopago.client.customer;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing a customer's default address. Used when creating or updating
* a customer to specify their primary address information for shipping or billing purposes.
*
* @see Customers API Reference
*/
@Getter
@Builder
public class CustomerAddressRequest {
/** Unique identifier of an existing address to set as default. */
private final String id;
/** Postal or ZIP code of the address. */
private final String zipCode;
/** Name of the street. */
private final String streetName;
/** Street number or house number. */
private final Integer streetNumber;
}
================================================
FILE: src/main/java/com/mercadopago/client/customer/CustomerCardClient.java
================================================
package com.mercadopago.client.customer;
import static com.mercadopago.MercadoPagoConfig.getStreamHandler;
import com.google.gson.JsonObject;
import com.mercadopago.MercadoPagoConfig;
import com.mercadopago.client.MercadoPagoClient;
import com.mercadopago.core.MPRequestOptions;
import com.mercadopago.exceptions.MPApiException;
import com.mercadopago.exceptions.MPException;
import com.mercadopago.net.HttpMethod;
import com.mercadopago.net.MPHttpClient;
import com.mercadopago.net.MPRequest;
import com.mercadopago.net.MPResourceList;
import com.mercadopago.net.MPResponse;
import com.mercadopago.resources.customer.CustomerCard;
import com.mercadopago.serialization.Serializer;
import java.util.logging.Logger;
import java.util.logging.StreamHandler;
/**
* Client for the MercadoPago Customer Cards API.
*
*
Provides operations to get, create, delete, and list cards associated with a customer.
* Cards are stored securely and can be reused for future payments without requiring the payer
* to re-enter card details.
*
*
This client is typically used internally by {@link CustomerClient}, but can also be
* instantiated directly.
*
* @see CustomerClient
* @see
* Customer Cards API reference
*/
public class CustomerCardClient extends MercadoPagoClient {
/** Class-level logger for customer card operations. */
private static final Logger LOGGER = Logger.getLogger(CustomerCardClient.class.getName());
/**
* Default constructor. Uses the default HTTP client provided by {@link MercadoPagoConfig}.
*/
public CustomerCardClient() {
this(MercadoPagoConfig.getHttpClient());
}
/**
* Constructs a {@code CustomerCardClient} with a custom HTTP client.
*
* @param httpClient the {@link MPHttpClient} implementation used to execute HTTP requests
*/
public CustomerCardClient(MPHttpClient httpClient) {
super(httpClient);
StreamHandler streamHandler = getStreamHandler();
streamHandler.setLevel(MercadoPagoConfig.getLoggingLevel());
LOGGER.addHandler(streamHandler);
LOGGER.setLevel(MercadoPagoConfig.getLoggingLevel());
}
/**
* Retrieves a specific card belonging to a customer.
*
* @param customerId the unique identifier of the customer who owns the card
* @param cardId the unique identifier of the card to retrieve
* @return the requested {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CustomerCard get(String customerId, String cardId) throws MPException, MPApiException {
return this.get(customerId, cardId, null);
}
/**
* Retrieves a specific card belonging to a customer with custom request options.
*
* @param customerId the unique identifier of the customer who owns the card
* @param cardId the unique identifier of the card to retrieve
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the requested {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CustomerCard get(String customerId, String cardId, MPRequestOptions requestOptions)
throws MPException, MPApiException {
MPResponse response =
send(
String.format("/v1/customers/%s/cards/%s", customerId, cardId),
HttpMethod.GET,
null,
null,
requestOptions);
CustomerCard card = Serializer.deserializeFromJson(CustomerCard.class, response.getContent());
card.setResponse(response);
return card;
}
/**
* Creates and associates a new card with a customer.
*
* @param customerId the unique identifier of the customer
* @param request the {@link CustomerCardCreateRequest} with the card token and other details
* @return the newly created {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CustomerCard create(String customerId, CustomerCardCreateRequest request)
throws MPException, MPApiException {
return this.create(customerId, request, null);
}
/**
* Creates and associates a new card with a customer with custom request options.
*
* @param customerId the unique identifier of the customer
* @param request the {@link CustomerCardCreateRequest} with the card token and other details
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the newly created {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CustomerCard create(
String customerId, CustomerCardCreateRequest request, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending create customer card request");
JsonObject payload = Serializer.serializeToJson(request);
MPRequest mpRequest =
MPRequest.buildRequest(
String.format("/v1/customers/%s/cards", customerId),
HttpMethod.POST,
payload,
null,
requestOptions);
MPResponse response = send(mpRequest);
CustomerCard card = Serializer.deserializeFromJson(CustomerCard.class, response.getContent());
card.setResponse(response);
return card;
}
/**
* Removes a card from a customer.
*
* @param customerId the unique identifier of the customer
* @param cardId the unique identifier of the card to remove
* @return the removed {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CustomerCard delete(String customerId, String cardId) throws MPException, MPApiException {
return this.delete(customerId, cardId, null);
}
/**
* Removes a card from a customer with custom request options.
*
* @param customerId the unique identifier of the customer
* @param cardId the unique identifier of the card to remove
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the removed {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public CustomerCard delete(String customerId, String cardId, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending delete customer card request");
MPResponse response =
send(
String.format("/v1/customers/%s/cards/%s", customerId, cardId),
HttpMethod.DELETE,
null,
null,
requestOptions);
CustomerCard card = Serializer.deserializeFromJson(CustomerCard.class, response.getContent());
card.setResponse(response);
return card;
}
/**
* Lists all cards belonging to a customer.
*
* @param customerId the unique identifier of the customer
* @return an {@link MPResourceList} of {@link CustomerCard} for the given customer
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public MPResourceList listAll(String customerId)
throws MPException, MPApiException {
return this.listAll(customerId, null);
}
/**
* Lists all cards belonging to a customer with custom request options.
*
* @param customerId the unique identifier of the customer
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return an {@link MPResourceList} of {@link CustomerCard} for the given customer
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public MPResourceList listAll(String customerId, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending list all customer cards request");
MPResponse response =
list(
String.format("/v1/customers/%s/cards", customerId),
HttpMethod.GET,
null,
null,
requestOptions);
MPResourceList cards =
Serializer.deserializeListFromJson(CustomerCard.class, response.getContent());
cards.setResponse(response);
return cards;
}
}
================================================
FILE: src/main/java/com/mercadopago/client/customer/CustomerCardCreateRequest.java
================================================
package com.mercadopago.client.customer;
import com.mercadopago.resources.customer.CustomerCardIssuer;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO used to associate a new card with a customer. The card token is generated on the
* frontend using the MercadoPago.js SDK, ensuring that sensitive card data never reaches your
* server directly. Once associated, the card can be reused in future payments.
*
* @see Cards API Reference
*/
@Getter
@Builder
public class CustomerCardCreateRequest {
/** Temporary card token generated by MercadoPago.js on the frontend. */
private final String token;
/** Card issuer information (e.g., issuing bank details). */
private final CustomerCardIssuer issuer;
/** Payment method identifier for the card (e.g., "visa", "master", "amex"). */
private final String paymentMethodId;
}
================================================
FILE: src/main/java/com/mercadopago/client/customer/CustomerClient.java
================================================
package com.mercadopago.client.customer;
import static com.mercadopago.MercadoPagoConfig.getStreamHandler;
import static com.mercadopago.serialization.Serializer.deserializeResultsResourcesPageFromJson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.mercadopago.MercadoPagoConfig;
import com.mercadopago.client.MercadoPagoClient;
import com.mercadopago.core.MPRequestOptions;
import com.mercadopago.exceptions.MPApiException;
import com.mercadopago.exceptions.MPException;
import com.mercadopago.net.HttpMethod;
import com.mercadopago.net.MPHttpClient;
import com.mercadopago.net.MPRequest;
import com.mercadopago.net.MPResourceList;
import com.mercadopago.net.MPResponse;
import com.mercadopago.net.MPResultsResourcesPage;
import com.mercadopago.net.MPSearchRequest;
import com.mercadopago.resources.customer.Customer;
import com.mercadopago.resources.customer.CustomerCard;
import com.mercadopago.serialization.Serializer;
import java.lang.reflect.Type;
import java.util.logging.Logger;
import java.util.logging.StreamHandler;
/**
* Client for the MercadoPago Customers API.
*
*
Provides CRUD operations for customers (create, get, update, delete) and search with
* pagination. Card operations (get, create, delete, list) are delegated to an internal
* {@link CustomerCardClient} and exposed via convenience methods on this class.
*
*
*
* @see CustomerCardClient
* @see
* Customers API reference
*/
public class CustomerClient extends MercadoPagoClient {
/** Class-level logger for customer operations. */
private static final Logger LOGGER = Logger.getLogger(CustomerClient.class.getName());
/** Internal client used to perform card operations on behalf of this client. */
private final CustomerCardClient cardClient;
/**
* Default constructor. Uses the default HTTP client provided by {@link MercadoPagoConfig}.
*/
public CustomerClient() {
this(MercadoPagoConfig.getHttpClient());
}
/**
* Constructs a {@code CustomerClient} with a custom HTTP client.
*
*
Also initialises the internal {@link CustomerCardClient} with the same HTTP client.
*
* @param httpClient the {@link MPHttpClient} implementation used to execute HTTP requests
*/
public CustomerClient(MPHttpClient httpClient) {
super(httpClient);
cardClient = new CustomerCardClient(httpClient);
StreamHandler streamHandler = getStreamHandler();
streamHandler.setLevel(MercadoPagoConfig.getLoggingLevel());
LOGGER.addHandler(streamHandler);
LOGGER.setLevel(MercadoPagoConfig.getLoggingLevel());
}
/**
* Retrieves a customer by its unique identifier.
*
* @param customerId the unique identifier of the customer
* @return the requested {@link Customer}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public Customer get(String customerId) throws MPException, MPApiException {
return this.get(customerId, null);
}
/**
* Retrieves a customer by its unique identifier with custom request options.
*
* @param customerId the unique identifier of the customer
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the requested {@link Customer}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public Customer get(String customerId, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending get customer request");
MPResponse response =
send(
String.format("/v1/customers/%s", customerId),
HttpMethod.GET,
null,
null,
requestOptions);
Customer customer = Serializer.deserializeFromJson(Customer.class, response.getContent());
customer.setResponse(response);
return customer;
}
/**
* Creates a new customer.
*
* @param request the {@link CustomerRequest} with customer details (email, identification, etc.)
* @return the newly created {@link Customer}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public Customer create(CustomerRequest request) throws MPException, MPApiException {
return this.create(request, null);
}
/**
* Creates a new customer with custom request options.
*
* @param request the {@link CustomerRequest} with customer details (email, identification, etc.)
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the newly created {@link Customer}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public Customer create(CustomerRequest request, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending create customer request");
JsonObject payload = Serializer.serializeToJson(request);
MPRequest mpRequest =
MPRequest.buildRequest("/v1/customers", HttpMethod.POST, payload, null, requestOptions);
MPResponse response = send(mpRequest);
Customer customer = Serializer.deserializeFromJson(Customer.class, response.getContent());
customer.setResponse(response);
return customer;
}
/**
* Updates an existing customer.
*
* @param customerId the unique identifier of the customer to update
* @param request the {@link CustomerRequest} with the updated customer details
* @return the updated {@link Customer}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public Customer update(String customerId, CustomerRequest request)
throws MPException, MPApiException {
return this.update(customerId, request, null);
}
/**
* Updates an existing customer with custom request options.
*
* @param customerId the unique identifier of the customer to update
* @param request the {@link CustomerRequest} with the updated customer details
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the updated {@link Customer}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public Customer update(
String customerId, CustomerRequest request, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending update customer request");
JsonObject payload = Serializer.serializeToJson(request);
MPRequest mpRequest =
MPRequest.buildRequest(
String.format("/v1/customers/%s", customerId),
HttpMethod.PUT,
payload,
null,
requestOptions);
MPResponse response = send(mpRequest);
Customer customer = Serializer.deserializeFromJson(Customer.class, response.getContent());
customer.setResponse(response);
return customer;
}
/**
* Deletes a customer by its unique identifier.
*
* @param customerId the unique identifier of the customer to delete
* @return the deleted {@link Customer}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public Customer delete(String customerId) throws MPException, MPApiException {
return this.delete(customerId, null);
}
/**
* Deletes a customer by its unique identifier with custom request options.
*
* @param customerId the unique identifier of the customer to delete
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the deleted {@link Customer}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
*/
public Customer delete(String customerId, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending delete customer request");
MPRequest mpRequest =
MPRequest.buildRequest(
String.format("/v1/customers/%s", customerId),
HttpMethod.DELETE,
null,
null,
requestOptions);
MPResponse response = send(mpRequest);
Customer customer = Serializer.deserializeFromJson(Customer.class, response.getContent());
customer.setResponse(response);
return customer;
}
/**
* Searches for customers matching the specified criteria.
*
* @param request the {@link MPSearchRequest} containing search filters and pagination parameters
* @return an {@link MPResultsResourcesPage} of {@link Customer} with matching results and
* pagination metadata
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MPResultsResourcesPage search(MPSearchRequest request)
throws MPException, MPApiException {
return this.search(request, null);
}
/**
* Searches for customers matching the specified criteria with custom request options.
*
* @param request the {@link MPSearchRequest} containing search filters and pagination parameters
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return an {@link MPResultsResourcesPage} of {@link Customer} with matching results and
* pagination metadata
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MPResultsResourcesPage search(
MPSearchRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException {
LOGGER.info("Sending search customer request");
MPResponse response = search("/v1/customers/search", request, requestOptions);
Type responseType = new TypeToken>() {}.getType();
MPResultsResourcesPage result =
deserializeResultsResourcesPageFromJson(responseType, response.getContent());
result.setResponse(response);
return result;
}
/**
* Retrieves a specific card associated with a customer.
*
*
Delegates to the internal {@link CustomerCardClient}.
*
* @param customerId the unique identifier of the customer
* @param cardId the unique identifier of the card
* @return the requested {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public CustomerCard getCard(String customerId, String cardId) throws MPException, MPApiException {
return this.getCard(customerId, cardId, null);
}
/**
* Retrieves a specific card associated with a customer with custom request options.
*
*
Delegates to the internal {@link CustomerCardClient}.
*
* @param customerId the unique identifier of the customer
* @param cardId the unique identifier of the card
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the requested {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public CustomerCard getCard(String customerId, String cardId, MPRequestOptions requestOptions)
throws MPException, MPApiException {
return cardClient.get(customerId, cardId, requestOptions);
}
/**
* Associates a new card with a customer.
*
*
Delegates to the internal {@link CustomerCardClient}.
*
* @param customerId the unique identifier of the customer
* @param request the {@link CustomerCardCreateRequest} with the card token and other details
* @return the newly created {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public CustomerCard createCard(String customerId, CustomerCardCreateRequest request)
throws MPException, MPApiException {
return this.createCard(customerId, request, null);
}
/**
* Associates a new card with a customer with custom request options.
*
*
Delegates to the internal {@link CustomerCardClient}.
*
* @param customerId the unique identifier of the customer
* @param request the {@link CustomerCardCreateRequest} with the card token and other details
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the newly created {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public CustomerCard createCard(
String customerId, CustomerCardCreateRequest request, MPRequestOptions requestOptions)
throws MPException, MPApiException {
return cardClient.create(customerId, request, requestOptions);
}
/**
* Removes a card from a customer.
*
*
Delegates to the internal {@link CustomerCardClient}.
*
* @param customerId the unique identifier of the customer
* @param cardId the unique identifier of the card to remove
* @return the removed {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public CustomerCard deleteCard(String customerId, String cardId)
throws MPException, MPApiException {
return this.deleteCard(customerId, cardId, null);
}
/**
* Removes a card from a customer with custom request options.
*
*
Delegates to the internal {@link CustomerCardClient}.
*
* @param customerId the unique identifier of the customer
* @param cardId the unique identifier of the card to remove
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the removed {@link CustomerCard}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public CustomerCard deleteCard(String customerId, String cardId, MPRequestOptions requestOptions)
throws MPException, MPApiException {
return cardClient.delete(customerId, cardId, requestOptions);
}
/**
* Lists all cards associated with a customer.
*
*
Delegates to the internal {@link CustomerCardClient}.
*
* @param customerId the unique identifier of the customer
* @return an {@link MPResourceList} of {@link CustomerCard} for the given customer
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MPResourceList listCards(String customerId)
throws MPException, MPApiException {
return this.listCards(customerId, null);
}
/**
* Lists all cards associated with a customer with custom request options.
*
*
Delegates to the internal {@link CustomerCardClient}.
*
* @param customerId the unique identifier of the customer
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return an {@link MPResourceList} of {@link CustomerCard} for the given customer
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MPResourceList listCards(String customerId, MPRequestOptions requestOptions)
throws MPException, MPApiException {
return cardClient.listAll(customerId, requestOptions);
}
}
================================================
FILE: src/main/java/com/mercadopago/client/customer/CustomerRequest.java
================================================
package com.mercadopago.client.customer;
import com.mercadopago.client.common.IdentificationRequest;
import com.mercadopago.client.common.PhoneRequest;
import java.time.OffsetDateTime;
import java.util.Map;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO used to create or update a customer in Mercado Pago. Customers can be associated
* with saved cards, addresses, and identification documents to streamline recurring payments
* and checkout experiences.
*
* @see Customers API Reference
*/
@Getter
@Builder
public class CustomerRequest {
/** Customer's email address, used as a unique identifier for the customer. */
private final String email;
/** Customer's first name. */
private final String firstName;
/** Customer's last name. */
private final String lastName;
/** Customer's phone information including area code and number. */
private final PhoneRequest phone;
/** Customer's identification document (e.g., CPF, DNI). */
private final IdentificationRequest identification;
/** ID of the customer's default address from their address list. */
private final String defaultAddress;
/** Customer's address details for registration purposes. */
private final CustomerAddressRequest address;
/** ID of the customer's default saved card. */
private final String defaultCard;
/** Date when the customer was registered in the merchant's system. */
private final OffsetDateTime dateRegistred;
/** Free-text description or notes about the customer. */
private final String description;
/** Custom key-value metadata associated with the customer. */
private final Map metadata;
}
================================================
FILE: src/main/java/com/mercadopago/client/identificationtype/IdentificationTypeClient.java
================================================
package com.mercadopago.client.identificationtype;
import static com.mercadopago.MercadoPagoConfig.getStreamHandler;
import static com.mercadopago.serialization.Serializer.deserializeListFromJson;
import com.mercadopago.MercadoPagoConfig;
import com.mercadopago.client.MercadoPagoClient;
import com.mercadopago.core.MPRequestOptions;
import com.mercadopago.exceptions.MPApiException;
import com.mercadopago.exceptions.MPException;
import com.mercadopago.net.HttpMethod;
import com.mercadopago.net.MPHttpClient;
import com.mercadopago.net.MPResourceList;
import com.mercadopago.net.MPResponse;
import com.mercadopago.resources.identificationtype.IdentificationType;
import java.util.logging.Logger;
import java.util.logging.StreamHandler;
/**
* Client for the MercadoPago Identification Types API.
*
*
Retrieves the list of identification document types available for the country associated
* with the authenticated user's credentials (e.g., CPF for Brazil, DNI for Argentina).
*
*
*
* @see
* Identification Types API reference
*/
public class IdentificationTypeClient extends MercadoPagoClient {
/** Class-level logger for identification type operations. */
private static final Logger LOGGER = Logger.getLogger(IdentificationTypeClient.class.getName());
/**
* Default constructor. Uses the default HTTP client provided by {@link MercadoPagoConfig}.
*/
public IdentificationTypeClient() {
this(MercadoPagoConfig.getHttpClient());
}
/**
* Constructs an {@code IdentificationTypeClient} with a custom HTTP client.
*
* @param httpClient the {@link MPHttpClient} implementation used to execute HTTP requests
*/
public IdentificationTypeClient(MPHttpClient httpClient) {
super(httpClient);
StreamHandler streamHandler = getStreamHandler();
streamHandler.setLevel(MercadoPagoConfig.getLoggingLevel());
LOGGER.addHandler(streamHandler);
LOGGER.setLevel(MercadoPagoConfig.getLoggingLevel());
}
/**
* Lists all available identification types for the authenticated user's country.
*
* @return an {@link MPResourceList} of {@link IdentificationType} (e.g., CPF, DNI, CURP)
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MPResourceList list() throws MPException, MPApiException {
return this.list(null);
}
/**
* Lists all available identification types with custom request options.
*
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return an {@link MPResourceList} of {@link IdentificationType} (e.g., CPF, DNI, CURP)
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MPResourceList list(MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending list identification types");
MPResponse response =
list("/v1/identification_types", HttpMethod.GET, null, null, requestOptions);
MPResourceList identificationTypes =
deserializeListFromJson(IdentificationType.class, response.getContent());
identificationTypes.setResponse(response);
return identificationTypes;
}
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderClient.java
================================================
package com.mercadopago.client.merchantorder;
import static com.mercadopago.MercadoPagoConfig.getStreamHandler;
import static com.mercadopago.serialization.Serializer.deserializeElementsResourcesPageFromJson;
import static com.mercadopago.serialization.Serializer.deserializeFromJson;
import com.google.gson.reflect.TypeToken;
import com.mercadopago.MercadoPagoConfig;
import com.mercadopago.client.MercadoPagoClient;
import com.mercadopago.core.MPRequestOptions;
import com.mercadopago.exceptions.MPApiException;
import com.mercadopago.exceptions.MPException;
import com.mercadopago.net.HttpMethod;
import com.mercadopago.net.MPElementsResourcesPage;
import com.mercadopago.net.MPHttpClient;
import com.mercadopago.net.MPRequest;
import com.mercadopago.net.MPResponse;
import com.mercadopago.net.MPSearchRequest;
import com.mercadopago.resources.merchantorder.MerchantOrder;
import com.mercadopago.serialization.Serializer;
import java.lang.reflect.Type;
import java.util.logging.Logger;
import java.util.logging.StreamHandler;
/**
* Client for the MercadoPago Merchant Orders API.
*
*
Provides operations to create, retrieve, update, and search merchant orders. Merchant orders
* group one or more payments and can be associated with preferences, shipments, or external
* references.
*
*
Usage example:
*
{@code
* MerchantOrderClient client = new MerchantOrderClient();
* MerchantOrder order = client.create(merchantOrderCreateRequest);
* MerchantOrder retrieved = client.get(order.getId());
* }
*
* @see
* Merchant Orders API reference
*/
public class MerchantOrderClient extends MercadoPagoClient {
/** Class-level logger for merchant order operations. */
private static final Logger LOGGER = Logger.getLogger(MerchantOrderClient.class.getName());
/** URL template for single-merchant-order endpoints (e.g. {@code /merchant_orders/{id}}). */
private static final String URL_WITH_ID = "/merchant_orders/%s";
/**
* Default constructor. Uses the default HTTP client provided by {@link MercadoPagoConfig}.
*/
public MerchantOrderClient() {
this(MercadoPagoConfig.getHttpClient());
}
/**
* Constructs a {@code MerchantOrderClient} with a custom HTTP client.
*
* @param httpClient the {@link MPHttpClient} implementation used to execute HTTP requests
*/
public MerchantOrderClient(MPHttpClient httpClient) {
super(httpClient);
StreamHandler streamHandler = getStreamHandler();
streamHandler.setLevel(MercadoPagoConfig.getLoggingLevel());
LOGGER.addHandler(streamHandler);
LOGGER.setLevel(MercadoPagoConfig.getLoggingLevel());
}
/**
* Retrieves a merchant order by its unique identifier.
*
* @param id the unique identifier of the merchant order
* @return the requested {@link MerchantOrder}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MerchantOrder get(Long id) throws MPException, MPApiException {
return this.get(id, null);
}
/**
* Retrieves a merchant order by its unique identifier with custom request options.
*
* @param id the unique identifier of the merchant order
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the requested {@link MerchantOrder}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MerchantOrder get(Long id, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending get merchant order request");
MPRequest mpRequest =
MPRequest.builder()
.uri(String.format(URL_WITH_ID, id.toString()))
.method(HttpMethod.GET)
.build();
MPResponse response = send(mpRequest, requestOptions);
MerchantOrder result = deserializeFromJson(MerchantOrder.class, response.getContent());
result.setResponse(response);
return result;
}
/**
* Creates a new merchant order.
*
* @param request the {@link MerchantOrderCreateRequest} with order details (items, preference
* id, etc.)
* @return the created {@link MerchantOrder}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MerchantOrder create(MerchantOrderCreateRequest request)
throws MPException, MPApiException {
return this.create(request, null);
}
/**
* Creates a new merchant order with custom request options.
*
* @param request the {@link MerchantOrderCreateRequest} with order details (items, preference
* id, etc.)
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the created {@link MerchantOrder}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MerchantOrder create(MerchantOrderCreateRequest request, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending create merchant order request");
MPRequest mpRequest =
MPRequest.builder()
.uri("/merchant_orders")
.method(HttpMethod.POST)
.payload(Serializer.serializeToJson(request))
.build();
MPResponse response = send(mpRequest, requestOptions);
MerchantOrder result = deserializeFromJson(MerchantOrder.class, response.getContent());
result.setResponse(response);
return result;
}
/**
* Updates an existing merchant order.
*
* @param id the unique identifier of the merchant order to update
* @param request the {@link MerchantOrderUpdateRequest} with the updated attributes
* @return the updated {@link MerchantOrder}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MerchantOrder update(Long id, MerchantOrderUpdateRequest request)
throws MPException, MPApiException {
return this.update(id, request, null);
}
/**
* Updates an existing merchant order with custom request options.
*
* @param id the unique identifier of the merchant order to update
* @param request the {@link MerchantOrderUpdateRequest} with the updated attributes
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return the updated {@link MerchantOrder}
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MerchantOrder update(
Long id, MerchantOrderUpdateRequest request, MPRequestOptions requestOptions)
throws MPException, MPApiException {
LOGGER.info("Sending update merchant order request");
MPRequest mpRequest =
MPRequest.builder()
.uri(String.format(URL_WITH_ID, id.toString()))
.method(HttpMethod.PUT)
.payload(Serializer.serializeToJson(request))
.build();
MPResponse response = send(mpRequest, requestOptions);
MerchantOrder result = deserializeFromJson(MerchantOrder.class, response.getContent());
result.setResponse(response);
return result;
}
/**
* Searches for merchant orders matching the specified criteria.
*
* @param request the {@link MPSearchRequest} containing search filters and pagination parameters
* @return an {@link MPElementsResourcesPage} of {@link MerchantOrder} with matching results and
* pagination metadata
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MPElementsResourcesPage search(MPSearchRequest request)
throws MPException, MPApiException {
return this.search(request, null);
}
/**
* Searches for merchant orders matching the specified criteria with custom request options.
*
* @param request the {@link MPSearchRequest} containing search filters and pagination parameters
* @param requestOptions optional {@link MPRequestOptions} to override access token, headers, or
* timeouts for this single request; may be {@code null}
* @return an {@link MPElementsResourcesPage} of {@link MerchantOrder} with matching results and
* pagination metadata
* @throws MPException if a transport-level or SDK-internal error occurs
* @throws MPApiException if the API returns a non-successful HTTP status code
* @see api
* docs
*/
public MPElementsResourcesPage search(
MPSearchRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException {
LOGGER.info("Sending search merchant order request");
MPResponse response = search("/merchant_orders/search", request, requestOptions);
Type responseType = new TypeToken>() {}.getType();
MPElementsResourcesPage result =
deserializeElementsResourcesPageFromJson(responseType, response.getContent());
result.setResponse(response);
return result;
}
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderCreateRequest.java
================================================
package com.mercadopago.client.merchantorder;
import java.util.List;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO used to create a new Merchant Order. A merchant order groups one or more payments
* for a set of items, enabling the merchant to track fulfillment, shipments, and payment
* collection for a complete purchase operation.
*
* @see Merchant Orders API Reference
*/
@Getter
@Builder
public class MerchantOrderCreateRequest {
/** Checkout preference ID that links this order to a payment preference. */
private final String preferenceId;
/** Application ID that originated this merchant order. */
private final String applicationId;
/** Mercado Libre site ID indicating the country of operation (e.g., "MLA", "MLB"). */
private final String siteId;
/** Payer information associated with this order. */
private final MerchantOrderPayerRequest payer;
/** Sponsor ID for marketplace or platform integrations. */
private final String sponsorId;
/** List of items included in this merchant order. */
private final List items;
/** Webhook URL to receive payment and order status notifications. */
private final String notificationUrl;
/** Free-text field for additional information about the order. */
private final String additionalInfo;
/** External reference ID to correlate this order with the merchant's own system. */
private final String externalReference;
/** Marketplace identifier indicating the origin of the payment. */
private final String marketplace;
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderItemRequest.java
================================================
package com.mercadopago.client.merchantorder;
import java.math.BigDecimal;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing an item within a Merchant Order. Each item describes a product or
* service being sold, including its price, quantity, and descriptive information.
*
* @see Merchant Orders API Reference
*/
@Getter
@Builder
public class MerchantOrderItemRequest {
/** Unique item code or SKU identifier. */
private final String id;
/** Display title or name of the item. */
private final String title;
/** Detailed description of the item. */
private final String description;
/** URL of the item's image for display purposes. */
private final String pictureUrl;
/** Category identifier for the item (e.g., "electronics", "clothing"). */
private final String categoryId;
/** Number of units of this item in the order. */
private final int quantity;
/** Price per unit of the item. */
private final BigDecimal unitPrice;
/** ISO 4217 currency code for the unit price (e.g., "BRL", "ARS", "USD"). */
private final String currencyId;
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderPayerRequest.java
================================================
package com.mercadopago.client.merchantorder;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing the payer associated with a Merchant Order. Identifies the buyer
* who will pay for the items in the order.
*
* @see Merchant Orders API Reference
*/
@Getter
@Builder
public class MerchantOrderPayerRequest {
/** Unique identifier of the payer in Mercado Pago. */
private final Long id;
/** Display nickname or username of the payer. */
private final String nickname;
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderReceiverAddressCityRequest.java
================================================
package com.mercadopago.client.merchantorder;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing city information within a Merchant Order receiver address. Used as
* part of the structured address breakdown for shipping destinations.
*
* @see Merchant Orders API Reference
*/
@Getter
@Builder
public class MerchantOrderReceiverAddressCityRequest {
/** Unique identifier of the city. */
private final String id;
/** Display name of the city. */
private final String name;
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderReceiverAddressCountryRequest.java
================================================
package com.mercadopago.client.merchantorder;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing country information within a Merchant Order receiver address. Used as
* part of the structured address breakdown for shipping destinations.
*
* @see Merchant Orders API Reference
*/
@Getter
@Builder
public class MerchantOrderReceiverAddressCountryRequest {
/** Unique identifier of the country (e.g., "AR", "BR"). */
private final String id;
/** Display name of the country. */
private final String name;
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderReceiverAddressRequest.java
================================================
package com.mercadopago.client.merchantorder;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing the receiver's shipping address for a Merchant Order shipment. Contains
* the full delivery address including geographic coordinates, structured city/state/country
* information, and contact details.
*
* @see Merchant Orders API Reference
*/
@Getter
@Builder
public class MerchantOrderReceiverAddressRequest {
/** Unique identifier of the receiver address. */
private final Long id;
/** Full address line combining street name and number. */
private final String addressLine;
/** Apartment, suite, or unit identifier. */
private final String apartment;
/** City information for the delivery address. */
private final MerchantOrderReceiverAddressCityRequest city;
/** State or province information for the delivery address. */
private final MerchantOrderReceiverAddressStateRequest state;
/** Country information for the delivery address. */
private final MerchantOrderReceiverAddressCountryRequest country;
/** Additional delivery instructions or comments for the carrier. */
private final String comment;
/** Contact name or reference at the delivery address. */
private final String contact;
/** Postal or ZIP code of the delivery address. */
private final String zipCode;
/** Street name of the delivery address. */
private final String streetName;
/** Street number of the delivery address. */
private final String streetNumber;
/** Floor number in the building, if applicable. */
private final String floor;
/** Contact phone number at the delivery address. */
private final String phone;
/** Geographic latitude coordinate of the delivery address. */
private final String latitude;
/** Geographic longitude coordinate of the delivery address. */
private final String longitude;
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderReceiverAddressStateRequest.java
================================================
package com.mercadopago.client.merchantorder;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing state or province information within a Merchant Order receiver address.
* Used as part of the structured address breakdown for shipping destinations.
*
* @see Merchant Orders API Reference
*/
@Getter
@Builder
public class MerchantOrderReceiverAddressStateRequest {
/** Unique identifier of the state or province. */
private final String id;
/** Display name of the state or province. */
private final String name;
}
================================================
FILE: src/main/java/com/mercadopago/client/merchantorder/MerchantOrderShipmentRequest.java
================================================
package com.mercadopago.client.merchantorder;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
import lombok.Builder;
import lombok.Getter;
/**
* Request DTO representing a shipment associated with a Merchant Order. Contains all logistics
* information including shipping method, status, sender/receiver details, delivery address,
* and shipping options.
*
* @see Merchant Orders API Reference
*/
@Getter
@Builder
public class MerchantOrderShipmentRequest {
/** Unique identifier of the shipment. */
private final Long id;
/** Type of shipping (e.g., "custom_shipping", "mercado_envios"). */
private final String shippingType;
/** Shipping mode indicating the logistics model (e.g., "me1", "me2", "custom"). */
private final String shippingMode;
/** Picking type for the shipment (e.g., "seller", "warehouse"). */
private final String pickingType;
/** Current status of the shipment (e.g., "pending", "shipped", "delivered"). */
private final String status;
/** Detailed sub-status providing additional context about the shipping status. */
private final String shippingSubstatus;
/** List of item references included in this shipment, each as a key-value map. */
private final List