Skip to content

Repository files navigation

PayPay SDK - JAVA

LicenseMaven CentraljavadocBuild StatusLanguage grade: JavaBlack Duck Security RiskMaintainabilityFOSSA StatusSnyk Vulnerabilities for GitHub RepoCodacy BadgeBCH complianceCII Best Practices

Java SDK for interacting with PayPay APIs

This is the quickest way to integrate PayPay payment services. This is primarily meant for merchants who wish to perform interactions with PayPay API programmatically. With PayPay's OPA SDK, you can build a custom Payment checkout process to suit your unique business needs and branding guidelines.

Note: This SDK is provided to assist merchants in integrating with our APIs. While it remains available for use, ongoing maintenance is limited and updates may not be released regularly. Most new features and enhancements are introduced directly at the API level, and we recommend referring to the latest API documentation for the most up-to-date capabilities.

Integrating with PayPay OPA

Prerequisites

Before integrating with the SDK, run through this checklist:

  • Understand the payment flow
  • Sign up for a PayPay developer/merchant Account
  • Generate the API keys from the Developer Panel. Use the sandbox API Keys to test out the integration

HMAC Signature Verification

Signature verification is a mandatory step to ensure that the callback is sent by PayPay and the payment is received from an authentic source.

Generate a Signature

The PayPay signature, returned to you by the Checkout form on successful payment, can be regenerated by your system and verified as follows:

Step 1: Hash the body and content-type with MD5 algorithm

Note: If there is no request body, for instance, the HTTP GET method case, no need of generating MD5. Instead, hash value is set as "empty". The value of authHeader is passed in HttpHeader.AUTHORIZATION. With the authHeader will decode back the data added and with the HTTP request object and based on data available for api-key in the system, we will recreate the SHA256("key", requestParams) which gives macData. This macData is verified against the value passed in the header.

Note: HMAC authorization will be done internally by the SDK, so clients don't need to worry about it.

Requirements

Building the API client library requires Gradle to be installed.

Installation

Add this dependency to your project's build.gradle file:

dependencies {
compile "jp.ne.paypay:paypayopa:1.0.8"// For Gradle 7+, use implementation instead of compile since it's removed
implementation "jp.ne.paypay:paypayopa:1.0.8"
}

Getting Started

Please follow the installation instruction and execute the following Java code:

Please refer jp.ne.paypay.example.* for usage of APIs

You need to set up your API key and secret using the following:

ApiClientapiClient = newConfiguration().getDefaultApiClient();
apiClient.setProductionMode(false); //true for production and false for sandbox. Default is sandboxapiClient.setApiKey("YOUR_API_KEY");
apiClient.setApiSecretKey("YOUR_API_SECRET");
apiClient.setAssumeMerchant("YOUR_MERCHANT_KEY");

Documentation for API Endpoints

TitleMethodHTTP requestDescription
PaymentApicreateAccountLinkQRCodePOST /v1/qr/sessionsCreate an ACCOUNT LINK QR and display it to the user
PaymentApicancelPaymentDELETE /v2/payments/{merchantPaymentId}Cancel a payment
PaymentApicreatePaymentPOST /v2/paymentsCreate a payment
PaymentApicreatePaymentAuthorizationPOST /v2/payments/preauthorizeCreate a payment authorization to block the money
PaymentApicreateContinuousPaymentPOST /v1/subscription/paymentsCreate a continuous payment and start the money transfer
PaymentApirevertAuthPOST /v2/payments/preauthorize/revertRevert a payment authorization
PaymentApicapturePaymentAuthPOST /v2/payments/captureCapture a payment authorization
PaymentApicreateQRCodePOST /v2/codesCreate a Code
PaymentApideleteQRCodeDELETE /v2/codes/{codeId}Delete a Code
PaymentApigetPaymentDetailsGET /v2/payments/{merchantPaymentId}Get payment details
PaymentApigetCodesPaymentDetailsGET /v2/codes/payments/{merchantPaymentId}Get payment details for QR code
PaymentApigetRefundDetailsGET /v2/refunds/{merchantRefundId}Get refund details
PaymentApirefundPaymentPOST /v2/refundsRefund a payment
PaymentApicreatePendingPaymentPOST /v1/requestOrderCreate a pending payment
PaymentApigetPaymentDetailsGET /v1/requestOrder/{merchantPaymentId}Get payment details (Pending Payment)
PaymentApigetPaymentMethodsGET /v4/paymentMethodsGet payment methods
PaymentApicancelPendingOrderDELETE /v1/requestOrder/{merchantPaymentId}Cancel a Pending Order
PaymentApigetRefundDetailsGET /v2/refunds/{merchantRefundId}Get refund details (Pending Payment)
PaymentApirefundPaymentPOST /v1/requestOrder/refundsRefund a payment (Pending Payment)
WalletApicheckWalletBalanceGET /v2/wallet/check_balanceCheck user wallet balance
UserApigetMaskedUserProfileGET /v2/user/profile/secure?userAuthorizationId={userAuthorizationId}Get masked user profile
UserApigetUserAuthorizationStatusGET /v2/user/authorizations?userAuthorizationId={userAuthorizationId}Get user authorization status
UserApiunlinkUserDELETE /v2/user/authorizations/{userAuthorizationId}Unlink user
PendingPaymentApicreatePendingPaymentPOST /v1/requestOrderSends a push notification to the user requesting payment.
PendingPaymentApigetPaymentDetailsGET /v1/requestOrder/{merchantPaymentId}Get payment details.
PendingPaymentApicancelPendingOrderDELETE /v1/requestOrder/{merchantPaymentId}This api is used delete the pending order
PendingPaymentApigetRefundDetailsGET /v2/refunds/{merchantRefundId}Get refund details.
PendingPaymentApirefundPaymentPOST /v2/refundsRefund a payment.
CashbackApigiveCashbackPOST /v2/cashbackTransfer money from merchants campaign wallet to user wallet
CashbackApigetCashbackGET /v2/cashback/{merchantCashbackId}Check the cashback details of the cashback given
CashbackApireverseCashbackPOST /v2/cashback_reversalTransfer money back from user wallet to merchants campaign wallet.
CashbackApigetReverseCashbackGET /v2/cashback_reversal/{merchantCashbackReversalId}/{merchantCashbackId}Check the cashback reversal details of the cashback reversed

Documentation for Models

License

FOSSA Status

About

With PayPay's Payment SDK, you can build a custom Payment checkout process to suit your unique business needs and branding guidelines

Topics

Resources

Contributing

Security policy

Stars

25 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages