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.
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
Signature verification is a mandatory step to ensure that the callback is sent by PayPay and the payment is received from an authentic source.
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 client don't need to worry about it.
Building the API client library requires Gradle to be installed.
Add this dependency to your project's build.gradle file:
compile "jp.ne.paypay:paypayopa:1.0.3"
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:
ApiClient apiClient = new Configuration().getDefaultApiClient();
apiClient.setProductionMode(false); //true for production and false for sandbox. Default is sandbox
apiClient.setApiKey("YOUR_API_KEY");
apiClient.setApiSecretKey("YOUR_API_SECRET");
apiClient.setAssumeMerchant("YOUR_MERCHANT_KEY");
Title | Method | HTTP request | Description |
---|---|---|---|
PaymentApi | createAccountLinkQRCode | POST /v1/qr/sessions | Create an ACCOUNT LINK QR and display it to the user |
PaymentApi | cancelPayment | DELETE /v2/payments/{merchantPaymentId} | Cancel a payment |
PaymentApi | createPayment | POST /v2/payments | Create a payment |
PaymentApi | createPaymentAuthorization | POST /v2/payments/preauthorize | Create a payment authorization to block the money |
PaymentApi | createContinuousPayment | POST /v1/subscription/payments | Create a continuous payment and start the money transfer |
PaymentApi | revertAuth | POST /v2/payments/preauthorize/revert | Revert a payment authorization |
PaymentApi | capturePaymentAuth | POST /v2/payments/capture | Capture a payment authorization |
PaymentApi | createQRCode | POST /v2/codes | Create a Code |
PaymentApi | deleteQRCode | DELETE /v2/codes/{codeId} | Delete a Code |
PaymentApi | getPaymentDetails | GET /v2/payments/{merchantPaymentId} | Get payment details |
PaymentApi | getCodesPaymentDetails | GET /v2/codes/payments/{merchantPaymentId} | Get payment details for QR code |
PaymentApi | getRefundDetails | GET /v2/refunds/{merchantRefundId} | Get refund details |
PaymentApi | refundPayment | POST /v2/refunds | Refund a payment |
PaymentApi | createPendingPayment | POST /v1/requestOrder | Create a pending payment |
PaymentApi | getPaymentDetails | GET /v1/requestOrder/{merchantPaymentId} | Get payment details (Pending Payment) |
PaymentApi | cancelPendingOrder | DELETE /v1/requestOrder/{merchantPaymentId} | Cancel a Pending Order |
PaymentApi | getRefundDetails | GET /v2/refunds/{merchantRefundId} | Get refund details (Pending Payment) |
PaymentApi | refundPayment | POST /v1/requestOrder/refunds | Refund a payment (Pending Payment) |
WalletApi | checkWalletBalance | GET /v2/wallet/check_balance | Check user wallet balance |
UserApi | getMaskedUserProfile | GET /v2/user/profile/secure?userAuthorizationId={userAuthorizationId} | Get masked user profile |
UserApi | getUserAuthorizationStatus | GET /v2/user/authorizations?userAuthorizationId={userAuthorizationId} | Get user authorization status |
UserApi | unlinkUser | DELETE /v2/user/authorizations/{userAuthorizationId} | Unlink user |
PendingPaymentApi | createPendingPayment | POST /v1/requestOrder | Sends a push notification to the user requesting payment. |
PendingPaymentApi | getPaymentDetails | GET /v1/requestOrder/{merchantPaymentId} | Get payment details. |
PendingPaymentApi | cancelPendingOrder | DELETE /v1/requestOrder/{merchantPaymentId} | This api is used delete the pending order |
PendingPaymentApi | getRefundDetails | GET /v2/refunds/{merchantRefundId} | Get refund details. |
PendingPaymentApi | refundPayment | POST /v2/refunds | Refund a payment. |
CashbackApi | giveCashback | POST /v2/cashback | Transfer money from merchants campaign wallet to user wallet |
CashbackApi | getCashback | GET /v2/cashback/{merchantCashbackId} | Check the cashback details of the cashback given |
CashbackApi | reverseCashback | POST /v2/cashback_reversal | Transfer money back from user wallet to merchants campaign wallet. |
CashbackApi | getReverseCashback | GET /v2/cashback_reversal/{merchantCashbackReversalId}/{merchantCashbackId} | Check the cashback reversal details of the cashback reversed |
- Capture
- CaptureObject
- PaymentDetails
- RefundDetails
- WalletBalance
- BalanceData
- QRCodeDetails
- MerchantOrderItem
- MerchantOrderItemResponse
- MoneyAmount
- NotDataResponse
- Payment
- PaymentDetails
- PaymentState
- PaymentStateCaptures
- PaymentStateRefunds
- PaymentStateRevert
- ProductType
- QRCode
- QRCodeResponse
- Refund
- RefundState
- ResultInfo
- AccountLinkQRCode
- Cashback
- ReverseCashback
- CashbackDetails
- ReverseCashbackDetails