Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Xendit REST API Client for Java - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services

License

NotificationsYou must be signed in to change notification settings

xendit/xendit-java

Repository files navigation

This library is the abstraction of Xendit API for access from applications written with Java.

Table of Contents

API Documentation

Please checkXendit API Reference.

Requirements

JDK 1.7 or later.

Installation

Maven

Add these lines of code in yourpom.xml

<dependency>    <groupId>com.xendit</groupId>    <artifactId>xendit-java-lib</artifactId>    <version>SELECTED_VERSION</version></dependency>

Gradle

Add these lines in yourbuild.gradle

compile 'com.xendit:xendit-java-lib:{SELECTED_VERSION}'

More information:https://search.maven.org/artifact/com.xendit/xendit-java-lib

Usage

You need to use secret API key in order to use functionality in this library. The key can be obtained from yourXendit Dashboard.

Without Client

If you're only dealing with a single secret key, you can simply import the packages required for the products you're interacting with without the need to create a client. Xendit Disbursement class is being used for IDR Disbursement.

There is another way to set secret key usingXendit.Opt.setApiKey(") which is recommended way to use instead ofXendit.apiKey.

importcom.xendit.Xendit;publicclassExample {publicstaticvoidmain(String[]args) {Xendit.Opt.setApiKey("PUT YOUR API KEY HERE");// ORXendit.apiKey ="PUT YOUR API KEY HERE";                   }}

With Client

If you're dealing with multiple secret keys, it is recommended that you useXenditClient. This allows you to create as many clients as needed, each with their own individual key. Xendit Disbursement Client is being used for IDR Disbursements.

importcom.xendit.XenditClient;publicclassExample {publicstaticvoidmain(String[]args) {XenditClientxenditClient =newXenditClient.Builder()                        .setApikey("PUT YOUR API KEY HERE")                        .build();XenditClientxenditClient2 =newXenditClient.Builder()                        .setApikey("PUT YOUR API KEY HERE")                        .build();    }}

Example: Create an IDR disbursement

Without Client
importcom.xendit.Xendit;importcom.xendit.exception.XenditException;importcom.xendit.model.Disbursement;importjava.util.HashMap;importjava.util.Map;publicclassExampleCreateDisbursement {publicstaticvoidmain(String[]args) {Xendit.apiKey ="xnd_development_...";//ORXendit.Opt.setApiKey("xnd_development_...");try {Map<String,Object>params =newHashMap<>();params.put("external_id","my_external_id");params.put("bank_code","BCA");params.put("account_holder_name","John Doe");params.put("account_number","123456789");params.put("description","My Description");params.put("amount","90000");Disbursementdisbursement =Disbursement.create(params);        }catch (XenditExceptione) {e.printStackTrace();        }    }}
With Client

Xendit Disbursement Client is being used for IDR Disbursement.

importcom.xendit.exception.XenditException;importcom.xendit.XenditClient;importcom.xendit.model.Disbursement;importjava.util.HashMap;importjava.util.Map;publicclassExampleCreateDisbursement {publicstaticvoidmain(String[]args) {XenditClientxenditClient =newXenditClient.Builder()                      .setApikey("xnd_development_...")                      .build();XenditClientxenditClient2 =newXenditClient.Builder()                      .setApikey("xnd_development_...")                      .build();try {Map<String,Object>params =newHashMap<>();params.put("external_id","my_external_id");params.put("bank_code","BCA");params.put("account_holder_name","John Doe");params.put("account_number","123456789");params.put("description","My Description");params.put("amount","90000");Disbursementdisbursement =xenditClient.disbursement.create(params);Disbursementdisbursement2 =xenditClient2.disbursement.create(params);        }catch (XenditExceptione) {e.printStackTrace();        }    }}

There are some examples provided for youhere.

Disbursement Services

Create an IDR disbursement

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

Disbursement.create(    String externalId,    String bankCode,    String accountHolderName,    String accountNumber,    String description,    BigInteger amount,    String[] emailTo,    String[] emailCc,    String[] emailBcc);
Disbursement.create(    Map<String, Object> params);
Map<String,Object>params =newHashMap<>();params.put("external_id","my_external_id");params.put("bank_code","BCA");params.put("account_holder_name","John Doe");params.put("account_number","123456789");params.put("description","My Description");params.put("amount","90000");/* Without client */Disbursementdisbursement =Disbursement.create(params);/* With client */Disbursementdisbursement =xenditClient.disbursement.create(params);

Get banks with available IDR disbursement service

/* Without client */AvailableBank[]banks =Disbursement.getAvailableBanks();/* With client */AvailableBank[]banks =xenditClient.disbursement.getAvailableBanks();

Get an IDR disbursement by external ID

/* Without client */Disbursementdisbursement =Disbursement.getByExternalId("EXAMPLE_ID");/* With client */Disbursementdisbursement =xenditClient.disbursement.getByExternalId("EXAMPLE_ID");

Get an IDR disbursement by ID

/* Without client */Disbursementdisbursement =Disbursement.getById("EXAMPLE_ID");/* With client */Disbursementdisbursement =xenditClient.disbursement.getById("EXAMPLE_ID");

Create a PHP disbursement

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

DisbursementPHP.createPHPDisbursement(    String xendit_idempotency_key,    String reference_id,    String currency,    String channel_code,    String account_name,    String account_number,    String description,    Integer amount,    ReceiptNotification receiptNotification,    Beneficiary beneficiary);ReceiptNotification receiptNotification = ReceiptNotification.builder()    .emailTo(new String[] { "test@emailTo.com" })    .emailCC(new String[] { "test@emailCC.com" })    .emailBcc(new String[] { "test@emailBcc.com" })    .build();Beneficiary beneficiary =    Beneficiary.builder()        .type("test-type")        .givenNames("Test Name")        .middleName("Middle Name")        .surname("Sur Name")        .businessName("Test")        .streetLine1("Jl. 123")        .streetLine2("Jl. 456")        .city("Jakarta Selatan")        .province("DKI Jakarta")        .state("Test")        .country("Test")        .zipCode("12345")        .mobileNumber("123456789")        .phoneNumber("12345678")        .email("email@test.com")        .build();
DisbursementPHP.createPHPDisbursement(    Map<String, String> headers, Map<String, Object> params);
Map<String,Object>params =newHashMap<>();Map<String,String>headers =newHashMap<>();headers.put("xendit-idempotency-key","xendit-idempotency-key");params.put("reference_id","reference_id_value");params.put("currency","PHP");params.put("channel_code","required_channel_code");params.put("account_name","John etc");params.put("account_number","123456");params.put("description","Disbursement description");params.put("amount",50000);params.put("receipt_notification",receiptNotification);/* Without client */DisbursementPHPdisbursement =DisbursementPHP.createPHPDisbursement(headers,params);/* With client */DisbursementPHPdisbursement =xenditClient.disbursementPHP.createPHPDisbursement(headers,params);

Get disbursements Channels

/* Without client */DisbursementChannel[]disbursementChannels =DisbursementChannel.getDisbursementChannels();/* With client */DisbursementChannel[]disbursementChannels =xenditClient.disbursementPHP.getDisbursementChannels();

Get disbursement channels by channel category

/* Without client */DisbursementChannel[]disbursementChannels =DisbursementChannel.getByChannelCategory("channel-category");/* With client */DisbursementChannel[]disbursementChannels =xenditClient.disbursementPHP.getByChannelCategory("channel-category");

Get disbursement channels by channel code

/* Without client */DisbursementChannel[]disbursementChannels =DisbursementChannel.getByChannelCode("channel-code");/* With client */DisbursementChannel[]disbursementChannels =xenditClient.disbursementPHP.getByChannelCode("channel-code");

Get a PHP disbursement by reference ID

/* Without client */DisbursementPHPdisbursement =DisbursementPHP.getPHPByReferenceId("EXAMPLE_ID");/* With client */DisbursementPHPdisbursement =xenditClient.disbursementPHP.getPHPByReferenceId("EXAMPLE_ID");

Get a PHP disbursement by ID

/* Without client */DisbursementPHPdisbursement =Disbursement.getPHPById("EXAMPLE_ID");/* With client */DisbursementPHPdisbursement =xenditClient.disbursementPHP.getPHPById("EXAMPLE_ID");

Back to top

Invoice services

Create an invoice

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

Invoice.create(    String externalId,    Number amount,    String payerEmail,    String description);
Invoice.create(    Map<String, Object> params);
Map<String,Object>params =newHashMap<>();params.put("external_id","my_external_id");params.put("amount",1800000);params.put("payer_email","customer@domain.com");params.put("description","Invoice Demo #123");/* Without client */Invoiceinvoice =Invoice.create(params);/* With client */Invoiceinvoice =xenditClient.invoice.create(params);

Get an invoice by ID

/* Without client */Invoiceinvoice =Invoice.getById("EXAMPLE_ID");/* With client */Invoiceinvoice =xenditClient.invoice.getById("EXAMPLE_ID");

Get all invoices

Map<String,Object>params =newHashMap<>();params.put("limit",3);params.put("statuses","[\"SETTLED\",\"EXPIRED\"]");/* Without client */Invoice[]invoices =Invoice.getAll(params);/* With client */Invoice[]invoices =xenditClient.invoice.getAll(params);

Expire an invoice

/* Without client */Invoiceinvoice =Invoice.expire("EXAMPLE_ID");/* With client */Invoiceinvoice =xenditClient.invoice.expire("EXAMPLE_ID");

Back to top

Virtual Account Services

Create a fixed virtual account

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

Closed virtual account
FixedVirtualAccount.createClosed(    String externalId,    String bankCode,    String name,    Long expectedAmount,    Map<String, Object> additionalParam);
FixedVirtualAccount.createClosed(    Map<String, Object> params);
Opened virtual account
FixedVirtualAccount.createOpen(    String externalId,    String bankCode,    String name,    Map<String, Object> additionalParam);
FixedVirtualAccount.createOpen(    Map<String, Object> params);
Map<String,Object>params =newHashMap<>();params.put("external_id","my_external_id");params.put("bank_code",BankCode.BNI.getText());params.put("name","John Doe");/* Optional for xenPlatform */params.put("for-user-id","<Sub Account User ID>");/* Without client */FixedVirtualAccountvirtualAccount =FixedVirtualAccount.createOpen(params);/* With client */FixedVirtualAccountvirtualAccount =xenditClient.fixedVirtualAccount.createOpen(params);

Update a fixed virtual account by ID

Map<String,Object>params =newHashMap<>();params.put("is_single_use",true);/* Optional for xenPlatform */params.put("for-user-id","<Sub Account User ID>");/* Without client */FixedVirtualAccountfixedVirtualAccount =FixedVirtualAccount.update("EXAMPLE_ID",params);/* With client */FixedVirtualAccountfixedVirtualAccount =xenditClient.fixedVirtualAccount.update("EXAMPLE_ID",params);

Get banks with available virtual account service

/* Without client */AvailableBank[]availableBanks =FixedVirtualAccount.getAvailableBanks();/* With client */AvailableBank[]availableBanks =xenditClient.fixedVirtualAccount.getAvailableBanks();

Get a fixed virtual account by ID

/* Without client */FixedVirtualAccountfpa =FixedVirtualAccount.getFixedVA("EXAMPLE_ID");/* With client */FixedVirtualAccountfpa =xenditClient.fixedVirtualAccount.getFixedVA("EXAMPLE_ID");

Get a fixed virtual account payment by payment ID

/* Without client */FixedVirtualAccountPaymentpayment =FixedVirtualAccount.getPayment("EXAMPLE_PAYMENT_ID");/* With client */FixedVirtualAccountPaymentpayment =xenditClient.fixedVirtualAccount.getPayment("EXAMPLE_PAYMENT_ID");

Back to top

Retail Outlet Services ID

Create fixed payment code

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

RetailOutlet.createFixedPaymentCode(    String externalId,    String retailOutletName,    String name,    Number expectedAmount);
RetailOutlet.createFixedPaymentCode(    Map<String, Object> params);
params.put("external_id", "test");params.put("retail_outlet_name", "ALFAMART");params.put("name", "Rika Sutanto");params.put("expected_amount", 10000);/* Without client */FixedPaymentCode fpc = RetailOutlet.createFixedPaymentCode(params);/* With client */FixedPaymentCode fpc = xenditClient.retailOutlet.createFixedPaymentCode(params);

Get fixed payment code

/* Without client */FixedPaymentCodefpc =RetailOutlet.getFixedPaymentCode("EXAMPLE_ID");/* With client */FixedPaymentCodefpc =xenditClient.retailOutlet.getFixedPaymentCode("EXAMPLE_ID");

Update fixed payment code

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

RetailOutlet.updateFixedPaymentCode(    String id,    String name,    Number expectedAmount,    String expirationDate);
RetailOutlet.updateFixedPaymentCode(    String id,    Map<String, Object> params);
Map<String,Object>params =newHashMap<>();params.put("name","Lorem Ipsum");/* Without client */FixedPaymentCodefpc =RetailOutlet.updateFixedPaymentCode("EXAMPLE_ID",params);/* With client */FixedPaymentCodefpc =xenditClient.retailOutlet.updateFixedPaymentCode("EXAMPLE_ID",params);

Back to top

Retail Outlet Services PH

Create payment code

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

RegionalRetailOutlet.createPaymentCode(    String referenceId,    RegionalRetailOutletPaymentCode.ChannelCode channelCode,    String customerName,    Number amount,    RegionalRetailOutletPaymentCode.Currency currency,    RegionalRetailOutletPaymentCode.Market market);
RegionalRetailOutlet.createPaymentCode(    Map<String, Object> params);
params.put("reference_id","test");params.put("channel_code",RegionalRetailOutletPaymentCode.ChannelCode.SEVENELEVENCLIQQ);params.put("customer_name","test-customer");params.put("amount",10);params.put("currency",RegionalRetailOutletPaymentCode.Currency.PHP);params.put("market",RegionalRetailOutletPaymentCode.Market.PH);/* Without client */RegionalRetailOutletPaymentCodepc =RegionalRetailOutlet.createPaymentCode(params);/* With client */RegionalRetailOutletPaymentCodepc =xenditClient.retailOutlet.createPaymentCode(params);

Get payment code

/* Without client */RegionalRetailOutletPaymentCodepc =RegionalRetailOutlet.getPaymentCode("EXAMPLE_ID");/* With client */RegionalRetailOutletPaymentCodepc =xenditClient.retailOutlet.getPaymentCode("EXAMPLE_ID");

Update payment code

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

RegionalRetailOutlet.updatePaymentCode(    String id,    String customerName,    Number amount,    RegionalRetailOutletPaymentCode.Currency currency,    String expiresAt,    String description);
RegionalRetailOutlet.updatePaymentCode(    String id,    Map<String, Object> params);
Map<String,Object>params =newHashMap<>();params.put("name","Lorem Ipsum");/* Without client */RegionalRetailOutletPaymentCodepc =RegionalRetailOutlet.updatePaymentCode("EXAMPLE_ID",params);/* With client */RegionalRetailOutletPaymentCodepc =xenditClient.retailOutlet.updatePaymentCode("EXAMPLE_ID",params);

Get payments by payment code ID

/* Without client */RegionalRetailOutletPaymentCodepc =RegionalRetailOutlet.getPaymentsByPaymentCodeId("EXAMPLE_ID");/* With client */RegionalRetailOutletPaymentCodepc =xenditClient.retailOutlet.getPaymentsByPaymentCodeId("EXAMPLE_ID");

Back to top

Recurring Payment Services

Create a recurring payment

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

RecurringPayment.create(   String externalId,   String payerEmail,   String interval,   Number intervalCount,   String description,   Number amount);
RecurringPayment.create(   Map<String, Object> params);
Map<String ,Object>params =newHashMap<>();params.put("external_id","recurring_31451441");params.put("payer_email","sample_email@xendit.co");params.put("interval","MONTH");params.put("interval_count",1);params.put("description","Test desc");params.put("amount",100000);params.put("currency","IDR");//Optional param/* Without client */RecurringPaymentrecurringPayment =RecurringPayment.create(params);/* With client */RecurringPaymentrecurringPayment =xenditClient.recurringPayment.create(params);

Get a recurring payment

/* Without client */RecurringPaymentrecurringPayment =RecurringPayment.get("5e2dd160f8a4d24146f5974c");/* With client */RecurringPaymentrecurringPayment =xenditClient.recurringPayment.get("5e2dd160f8a4d24146f5974c");

Edit a recurring payment

Map<String,Object>params =newHashMap<>();params.put("amount",987654);params.put("interval","WEEK");/* Without client */RecurringPaymentrecurringPayment =RecurringPayment.edit("5e2dd55ef8a4d24146f59775",params);/* With client */RecurringPaymentrecurringPayment =xenditClient.recurringPayment.edit("5e2dd55ef8a4d24146f59775",params);

Stop a recurring payment

/* Without client */RecurringPaymentrecurringPayment =RecurringPayment.stop("5e2dd160f8a4d24146f5974c");/* With client */RecurringPaymentrecurringPayment =xenditClient.recurringPayment.stop("5e2dd160f8a4d24146f5974c");

Pause a recurring payment

/* Without client */RecurringPaymentrecurringPayment =RecurringPayment.pause("5e2dd55ef8a4d24146f59775");/* With client */RecurringPaymentrecurringPayment =xenditClient.recurringPayment.pause("5e2dd55ef8a4d24146f59775");

Resume a recurring payment

/* Without client */RecurringPaymentrecurringPayment =RecurringPayment.resume("5e2dd55ef8a4d24146f59775");/* With client */RecurringPaymentrecurringPayment =xenditClient.recurringPayment.resume("5e2dd55ef8a4d24146f59775");

List recurring payments by ID

/* Without client */Invoice[]invoices =RecurringPayment.getPaymentsById("5e2dd55ef8a4d24146f59775");/* With client */Invoice[]invoices =xenditClient.recurringPayment.getPaymentsById("5e2dd55ef8a4d24146f59775");

Back to top

Balance Service

Get balance

TheaccountType parameter is optional.

Balance.get();Balance.get(StringaccountType);
/* Without client */Balancebalance =Balance.get("CASH");/* With client */Balancebalance =xenditClient.balance.get("CASH");

Back to top

Payout Services

Create a payout

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

Payout.createPayout(    String externalId,    Number amount);
Payout.createPayout(    Map<String, Object> params);
Map<String,Object>params =newHashMap<>();params.put("external_id","my_test_id");params.put("amount",100000);/* Without client */Payoutpayout =Payout.createPayout(params);/* Without client */Payoutpayout =xenditClient.payout.createPayout(params);

Get a payout by ID

/* Without client */Payoutpayout =Payout.getPayout("EXAMPLE_ID");/* With client */Payoutpayout =xenditClient.payout.getPayout("EXAMPLE_ID");

Void a payout

/* Without client */Payoutpayout =Payout.voidPayout("EXAMPLE_ID");/* With client */Payoutpayout =xenditClient.payout.voidPayout("EXAMPLE_ID");

Back to top

E-Wallet Services

Create an e-wallet charge

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

EWalletCharge.createEWalletCharge(    String referenceId,    String currency,    Number amount,    String checkoutMethod,    String channelCode,    Map<String, String> channelProperties,    String customerId,    EWalletBasketItem[] basket,    Map<String, Object> metadata);
EWalletCharge.createEWalletCharge(Map<String, Object> params);
Map<String,String>channelProperties =newHashMap<>();channelProperties.put("success_redirect_url","https://yourwebsite.com/order/123");Map<String,Object>params =newHashMap<>();params.put("reference_id","test-reference-id");params.put("currency","IDR");params.put("amount",50000);params.put("checkout_method","ONE_TIME_PAYMENT");params.put("channel_code","ID_SHOPEEPAY");params.put("channel_properties",channelProperties);/* Without client */EWalletChargecharge =EWalletCharge.createEWalletCharge(params);/* With client */EWalletChargecharge =xenditClient.eWallet.createEWalletCharge(params);

Get an e-wallet charge status

/* Without client */EWalletChargecharge =EWalletCharge.getEWalletChargeStatus("ewc_c8630205-3e7a-4511-8250-26a084480c4c");/* With client */EWalletChargecharge =xenditClient.eWallet.getEWalletChargeStatus("ewc_c8630205-3e7a-4511-8250-26a084480c4c");

Back to top

Credit Card Services

Create an authorization

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

CreditCardCharge.createAuthorization(    String tokenId,    String externalId,    Number amount,    String authenticationId,    String cardCVN,    Boolean capture);
CreditCardCharge.createAuthorization(    Map<String, Object> params);
/* Without client */CreditCardChargecreditCardCharge =CreditCard.createAuthorization("...","test_id",75000,"...","123",false);/* With client */CreditCardChargecreditCardCharge =xenditClient.creditCard.createAuthorization("...","test_id",75000,"...","123",false);

Create a charge

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

CreditCardCharge.createCharge(    String tokenId,    String externalId,    Number amount,    String authenticationId,    String cardCVN,    String descriptor);
CreditCardCharge.createCharge(    Map<String, Object> params);
/* Without client */CreditCardChargecreditCardCharge =CreditCard.createCharge("...","test_id",75000,"...","123","lorem ipsum");/* With client */CreditCardChargecreditCardCharge =xenditClient.creditCard.createCharge("...","test_id",75000,"...","123","lorem ipsum");

Reverse an authorization

CreditCard.reverseAuthorization(StringchargeId,StringexternalId);/* Without client */CreditCardReverseAuthcreditCardReverseAuth =CreditCard.reverseAuthorization("1234567","external_id");/* With client */CreditCardReverseAuthcreditCardReverseAuth =xenditClient.creditCard.reverseAuthorization("1234567","external_id");

Capture a charge

CreditCard.captureCharge(StringchargeId,Numberamount);/* Without client */CreditCardChargecreditCardCharge =CreditCard.captureCharge("12345678",55000);/* With client */CreditCardChargecreditCardCharge =xenditClient.creditCard.captureCharge("12345678",55000);

Get a charge by ID

/* Without client */CreditCardChargecreditCardCharge =CreditCard.getCharge("1234567");/* With client */CreditCardChargecreditCardCharge =xenditClient.creditCard.getCharge("1234567");

Create a refund

CreditCard.createRefund(Stringid,Numberamount,StringexternalId);/* Without client */CreditCardRefundcreditCardRefund =CreditCard.createRefund("1234567",50000,"external_id");/* With client */CreditCardRefundcreditCardRefund =xenditClient.creditCard.createRefund("1234567",50000,"external_id");

Back to top

Batch Disbursement Services

Batch disbursement item

BatchDisbursementItemitem =BatchDisbursementItem.builder()        .amount(10000)        .bankCode("ABC")        .bankAccountName("Lorem Ipsum")        .bankAccountNumber("1234567890")        .description("Lorem ipsum dolor sit amet")        .externalId("test_id")        .emailTo(["email1","email2"])        .emailCC(["email1","email2"])        .emailBcc(["email1","email2"])        .build();

Create a batch disbursement

/* Without client */BatchDisbursement.create(Stringreference,BatchDisbursementItem[]disbursements);/* With client */xenditClient.batchDisbursement.create(Stringreference,BatchDisbursementItem[]disbursements);

Get banks with available disbursement service

/* Without client */AvailableBank[]banks =BatchDisbursement.getAvailableBanks();/* With client */AvailableBank[]banks =xenditClient.batchDisbursement.getAvailableBanks();

Back to top

Cardless Credit Services

Cardless credit item

CardlessCreditItemitem =CardlessCreditItem.builder()        .id("123")        .name("Phone Case")        .price(200000)        .type("Smartphone")        .url("https://www.example.org")        .quantity(1)        .build();

Cardless credit customer details

CardlessCreditCustomercustomer =CardlessCreditCustomer.builder()        .firstName("Lorem")        .lastName("Ipsum")        .email("email@example.com")        .phone("08129748247684")        .build();

Cardless credit shipping address

CardlessCreditShippingAddressaddress =CardlessCreditShippingAddress.builder()        .firstName("Lorem")        .lastName("Ipsum")        .address("Jalan teknologi")        .city("Jakarta")        .postalCode("12345")        .countryCode("IDN")        .phone("08129748247684")        .build();

Create a cardless credit payment

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

CardlessCredit.create(    String cardlessCreditType,    String externalId,    Number amount,    String paymentType,    CardlessCreditItem[] items,    CardlessCreditCustomer customerDetails,    CardlessCreditShippingAddress shippingAddress,    String redirectUrl,    String callbackUrl);
CardlessCredit.create(    Map<String, Object> params);
/* Without client */CardlessCreditcardlessCredit =CardlessCredit.create("KREDIVO","external_id",200000,CardlessCredit.PaymentType.THREE_MONTHS.getVal(),items,customer,address,"www.example.com","www.example.com");/* With client */CardlessCreditcardlessCredit =xenditClient.cardlessCredit.create("KREDIVO","external_id",200000,CardlessCredit.PaymentType.THREE_MONTHS.getVal(),items,customer,address,"www.example.com","www.example.com");

QR Code

Create QR Code

/* Without client */QRCodeqrCode =QRCode.create("reference_id",QRCode.QRCodeType.DYNAMIC,"IDR",10000);/* With client */QRCodeqrCode =xenditClient.qrCode.create("reference_id",QRCode.QRCodeType.DYNAMIC,"IDR",10000);

Get QR Code

/* Without client */QRCodeqrCode =QRCode.getQRCodeByQRId("qr_004a0427-b194-49be-9439-657ef77ee4f3");/* With client */QRCodeqrCode =xenditClient.qrCode.getQRCodeByQRId("qr_004a0427-b194-49be-9439-657ef77ee4f3");

Customer

Create Customer

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

Customer.createCustomer(    String referenceId,    String mobileNumber,    String email,    String givenNames,    String middleName,    String surname,    String description,    String phoneNumber,    String nationality,    CustomerAddress[] addresses,    String dateOfBirth,    Map<String, Object> metadata);
Customer.createCustomer(Map<String, Object> params);
Map<String,Object>metadata =newHashMap<>();metadata.put("halo","hello");metadata.put("tes","123");Map<String,Object>params =newHashMap<>();params.put("reference_id","test-reference-id");params.put("email","tes@tes.com");params.put("given_names","Given Names");params.put("nationality","ID");params.put("date_of_birth","1995-12-30");params.put("metadata",metadata);/* Without client */Customercustomer =Customer.createCustomer(params);/* With client */Customercustomer =xenditClient.customer.createCustomer(params);

Get Customer by Reference ID

/* Without client */Customer[]customers =Customer.getCustomerByReferenceId("test-reference-id");/* With client */Customer[]customers =xenditClient.customer.getCustomerByReferenceId("test-reference-id");

Direct Debit

Initialize linked account tokenization

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

InitializedLinkedAccount.initializeLinkedAccountTokenization(    String customerId,    LinkedAccountEnum.ChannelCode channelCode,    Map<String, Object> properties,    Map<String, Object> metadata);
InitializedLinkedAccount.initializeLinkedAccountTokenization(Map<String, Object> params);
Map<String,Object>properties =newHashMap<>();properties.put("account_mobile_number","+62818555988");properties.put("card_last_four","8888");properties.put("card_expiry","06/24");properties.put("account_email","test.email@xendit.co");Map<String,Object>metadata =newHashMap<>();metadata.put("tes","123");StringcustomerId ="791ac956-397a-400f-9fda-4958894e61b5";ChannelCodechannelCode =ChannelCode.DC_BRI;/* Without client */InitializedLinkedAccountlinkedAccount =InitializedLinkedAccount.initializeLinkedAccountTokenization(customerId,channelCode,properties,metadata);/* With client */InitializedLinkedAccountlinkedAccount =xenditClient.directDebitPayment.initializeLinkedAccountTokenization(customerId,channelCode,properties,metadata);

Validate OTP for Linked Account Token

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

ValidatedLinkedAccount.validateOTP(    String tokenId,    String otpCode);
ValidatedLinkedAccount.validateOTP(String tokenId, Map<String, Object> params);
Map<String,Object>params =newHashMap<>();params.put("otp_code","333000");StringtokenId ="lat-ba3c5645-f134-432a-b4f4-f8972685aa03";/* Without client */ValidatedLinkedAccountlinkedAccount =ValidatedLinkedAccount.validateOTP(tokenId,params);/* With client */ValidatedLinkedAccountlinkedAccount =xenditClient.directDebitPayment.validateOTP(tokenId,params);

Retrieve accessible accounts by linked account token

/* Without client */AccessibleLinkedAccount[]linkedAccounts =AccessibleLinkedAccount.retrieveAccessibleLinkedAccounts("lat-960e709c-bdd6-4b4a-a361-243186379c45");/* With client */AccessibleLinkedAccount[]linkedAccounts =xenditClient.directDebitPayment.retrieveAccessibleLinkedAccounts("lat-960e709c-bdd6-4b4a-a361-243186379c45");System.out.println(Arrays.toString(linkedAccounts));

Unbind linked account token

/* Without client */UnbindedLinkedAccountlinkedAccount =UnbindedLinkedAccount.unbindLinkedAccountToken("lat-a08fba1b-100c-445b-b788-aaeaf8215e8f");/* With client */UnbindedLinkedAccountlinkedAccount =xenditClient.directDebitPayment.unbindLinkedAccountToken("lat-a08fba1b-100c-445b-b788-aaeaf8215e8f");

Create payment method

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

PaymentMethod.createPaymentMethod(    String customerId,    LinkedAccountEnum.AccountType type,    Map<String, Object> properties,    Map<String, Object> metadata);
PaymentMethod.createPaymentMethod(Map<String, Object> params);
Map<String,Object>properties =newHashMap<>();properties.put("id","la-052d3e2d-bc4d-4c98-8072-8d232a552299");Map<String,Object>metadata =newHashMap<>();metadata.put("halo","hello");metadata.put("tes","123");Map<String,Object>params =newHashMap<>();params.put("customer_id","4b7b6050-0830-440a-903b-37d527dbbaa9");params.put("type","DEBIT_CARD");params.put("properties",properties);params.put("metadata",metadata);/* Without client */PaymentMethodpaymentMethod =PaymentMethod.createPaymentMethod(params);/* With client */PaymentMethodpaymentMethod =xenditClient.directDebitPayment.createPaymentMethod(params);

Get payment methods by customer ID

/* Without client */PaymentMethod[]paymentMethods =PaymentMethod.getPaymentMethodsByCustomerId("4b7b6050-0830-440a-903b-37d527dbbaa9");/* With client */PaymentMethod[]paymentMethods =xenditClient.directDebitPayment.getPaymentMethodsByCustomerId("4b7b6050-0830-440a-903b-37d527dbbaa9");System.out.println(Arrays.toString(paymentMethods));

Create recurring payment

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

RecurringPayment.create(    String externalId,    String payerEmail,    String interval,    Number intervalCount,    String description,    Number amount);
RecurringPayment.create(Map<String, Object> params);
Map<String ,Object>params =newHashMap<>();params.put("external_id","recurring_31451441");params.put("payer_email","sample_email@xendit.co");params.put("interval","MONTH");params.put("interval_count",1);params.put("description","Test desc");params.put("amount",100000);params.put("currency","IDR");/* Without client */RecurringPaymentrecurringPayment =RecurringPayment.create(params);/* With client */RecurringPaymentrecurringPayment =xenditClient.directDebitPayment.create(params);

Create direct debit payment

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

DirectDebitPayment.createDirectDebitPayment(    String referenceId,    String paymentMethodId,    String currency,    Number amount,    String callbackUrl,    Boolean enableOtp,    String description,    DirectDebitBasketItem[] basket,    DirectDebitDevice device,    String successRedirectUrl,    String failureRedirectUrl,    Map<String, Object> metadata,    String idempotencyKey);
DirectDebitPayment.createDirectDebitPayment(Map<String, Object> params, String idempotencyKey);
DirectDebitBasketItembasketItem =DirectDebitBasketItem.builder()        .referenceId("basket-product-ref-id")        .name("product-name")        .category("mechanics")        .market("ID")        .price(50000)        .quantity(5)        .type("product type")        .subCategory("product sub category")        .description("product description")        .url("https://product.url")        .build();DirectDebitBasketItem[]basketItemArray =newDirectDebitBasketItem[]{basketItem};DirectDebitDevicedevice =DirectDebitDevice.builder()        .id("device-id")        .ipAddress("0.0.0.0")        .userAgent("user-agent")        .adId("ad-id")        .imei("123a456b789c")        .build();Map<String,Object>metadata =newHashMap<>();metadata.put("halo","hello");metadata.put("tes","123");Map<String,Object>params =newHashMap<>();params.put("reference_id","test-direct-debit-ref-4");params.put("payment_method_id","pm-ebb1c863-c7b5-4f20-b116-b3071b1d3aef");params.put("currency","IDR");params.put("amount",15000);params.put("callback_url","http://webhook.site/");params.put("enable_otp",true);params.put("description","test description");params.put("basket",basketItemArray);params.put("success_redirect_url","https://success-redirect.url");params.put("failure_redirect_url","https://failure-redirect.url");params.put("device",device);params.put("metadata",metadata);StringidempotencyKey ="idempotency-key-4";/* Without client */DirectDebitPaymentdirectDebitPayment =DirectDebitPayment.createDirectDebitPayment(params,idempotencyKey);/* With client */DirectDebitPaymentdirectDebitPayment =xenditClient.directDebitPayment.createDirectDebitPayment(params,idempotencyKey);

Validate OTP for direct debit payment

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

DirectDebitPayment.validateOTP(    String directDebitPaymentId,    String otpCode);
DirectDebitPayment.validateOTP(String directDebitPaymentId, Map<String, Object> params);
Map<String,Object>params =newHashMap<>();params.put("otp_code","222000");StringdirectDebitPaymentId ="ddpy-b150da90-2121-44a6-a836-5eebf0d7ab55";/* Without client */DirectDebitPaymentdirectDebitPayment =DirectDebitPayment.validateOTP(directDebitPaymentId,params);/* With client */DirectDebitPaymentdirectDebitPayment =xenditClient.directDebitPayment.validateOTP(directDebitPaymentId,params);

Get direct debit payment status by ID

/* Without client */DirectDebitPaymentdirectDebitPayment =DirectDebitPayment.getDirectDebitPaymentStatusById("ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c");/* With client */DirectDebitPaymentdirectDebitPayment =xenditClient.directDebitPayment.getDirectDebitPaymentStatusById("ddpy-7e61b0a7-92f9-4762-a994-c2936306f44c");

Get direct debit payment status by reference ID

/* Without client */DirectDebitPayment[]directDebitPayments =DirectDebitPayment.getDirectDebitPaymentStatusByReferenceId("test-direct-debit-ref-4");/* With client */DirectDebitPayment[]directDebitPayments =xenditClient.directDebitPayment.getDirectDebitPaymentStatusByReferenceId("test-direct-debit-ref-4");System.out.println(Arrays.toString(directDebitPayments));

Back to top

Paylater Services

Initiate Paylater Plans

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

PaylaterPlans.initiatePaylaterPlans(    String customerId,    String channelCode,    String currency,    Number Amount,    PaylaterOrderItem[] orderItems);
PaylaterPlans.initiatePaylaterPlans(Map<String, Object> params);
PaylaterOrderItemorderItems =PaylaterOrderItem.builder()    .type("type")    .referenceId("reference_id")    .name("name")    .netUnitAmount("net_unit_amount")    .quantity(1)    .url("https://www.google.com")    .category("category")    .subCategory("subCategory")    .description("description")    .build();PaylaterOrderItem[]orderItemsArray =newPaylaterOrderItem[] {orderItem };Map<String,Object>params =newHashMap<>();params.put("customer_id","test-customer-id");params.put("channel_code","ID_KREDIVO");params.put("currency","IDR");params.put("amount",50000);params.put("order_items",orderItemsArray);/* Without client */PaylaterPlansinitiatePlan =PaylaterPlans.initiatePaylaterPlans(params);/* With client */PaylaterPlansinitiatePlan =xenditClient.paylater.initiatePaylaterPlans(params);

Create Paylater Charges

You can choose whether want to put the attributes as parameters or to put in inside a Map object.

PaylaterCharges.createPaylaterCharges(    String planId,    String referenceId,    String checkoutMethod,    String successRedirectUrl,    String failureRedirectUrl,    String paymentMethodId,    Map<String, Object> metadata);
PaylaterCharges.createPaylaterCharges(Map<String, Object> params);
Map<String,Object>metadata =newHashMap<>();metadata.put("halo","hello");metadata.put("tes","123");Map<String,Object>params =newHashMap<>();params.put("plan_id","test-plan-id");params.put("reference_id","test-reference-id");params.put("checkout_method","ONE_TIME_PAYMENT");params.put("success_redirect_url","https://success-redirect.url");params.put("failure_redirect_url","https://failure-redirect.url");params.put("payment_method_id",null);params.put("metadata",metadata);/* Without client */PaylaterChargecharge =PaylaterCharge.createPaylaterCharges(params);/* With client */PaylaterChargecharge =xenditClient.paylater.createPaylaterCharges(params);

Get Paylater Charge by Charge ID

/* Without client */PaylaterChargepaylaterCharge =PaylaterCharge.getPaylaterChargeStatus("charge-id");/* With client */PaylaterChargepaylaterCharge =xenditclient.paylater.getPaylaterChargeStatus("charge-id");

Refund Paylater Charge

PaylaterRefund.createPaylaterRefund(StringchargeId,Numberamount,PaylaterEnum.RefundReasons);/* Without client */PaylaterRefundpaylaterRefund =PaylaterRefund.createPaylaterRefund("charge-id",1000,"OTHERS");/* With client */PaylaterRefundpaylaterRefund =xenditClient.paylater.createPaylaterRefund("charge-id",1000,"OTHERS");

Get Paylater Refund by Refund ID

/* Without client */PaylaterRefundpaylaterRefund =PaylaterRefund.getPaylaterRefundStatus("charge-id","refund-id");/* With client */PaylaterRefundpaylaterRefund =xenditclient.paylater.getPaylaterRefundStatus("charge-id","refund-id");

How to get Request ID

Each API request has an asssociated request identifier. You can find this value in the response headers, under Request-ID. You can use Request-ID to find logs inAPI Logs in Dashboard. Learn more about Searching API Logs using Request-ID inAPI Logs Docs.

If you need to contact us about a specific request, providing the Request ID will ensure the fastest possible resolution.

The following example will show how to obtain Request-ID when creating QRCode

/* Without client */QRCodeqrCode =QRCode.createQRCode("12",QRCode.QRCodeType.DYNAMIC,"IDR",10000);/* Xendit.getResponseHeaders() will contain all response headers after your request is completed, hence you can obtain Request-Id from header by doing the following:*/System.out.println(qrCode.getResponseHeaders().get("Request-Id"));/* With client */QRCodeqrCode =xenditClient.qrCode.createQRCode("external_id",QRCode.QRCodeType.DYNAMIC,"IDR",10000);/* Xendit.getResponseHeaders() will contain all response headers after your request is completed, hence you can obtain Request-Id from header by doing the following:*/System.out.println(qrCode.getResponseHeaders().get("Request-Id"));

Full Example can be foundhere

Contributing

You can go to thecontributing guidelines to learn on how to contribute this project.

Lint

Run./gradlew spotlessApply to apply linter.

Tests

Make sure the the code passes all tests.

./gradlew test

Precommit

Before making any commits, please install pre-commit. To install pre-commit, follow theinstallation steps.

For any requests, bugs, or comments, pleaseopen an issue orsubmit a pull request.


[8]ページ先頭

©2009-2025 Movatter.jp