PayPay SDK JAVA
Java SDK for interacting with the Paypay APIs This is the quickest way to integrate PayPay payment services. This is primarily meant for merchants who wish to perform interactions with the Paypay API programatically. 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, the client need not worry about it.
Building the API client library requires Gradle to be installed.
To install the API client library to your local Maven repository, simply execute:
Add this dependency to your project's build file:
compile "jp.ne.paypay:paypayopa:0.3.0"Please follow the installation instruction and execute the following Java code:
Please refer jp.ne.paypay.example.PaymentApiExample.java for usage of APIs
You need to setup your 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");| Class | Method | HTTP request | Description |
|---|---|---|---|
| PaymentApi | createAccountLinkQRCode | POST /v1/qr/sessions | Create an ACCOUNT LINK QR and display it to the user |
| PaymentApi | cancelPayment | DELETE /v1/payments/{merchantPaymentId} | Cancel a payment |
| PaymentApi | capturePaymentAuth | POST /v1/payments/capture | Capture a payment authorization |
| PaymentApi | createPayment | POST /v1/payments | Create a payment |
| PaymentApi | createQRCode | POST /v1/codes | Create a Code |
| PaymentApi | deleteQRCode | DELETE /v1/codes/{codeId} | Delete a Code |
| PaymentApi | getPaymentDetails | GET /v1/payments/{merchantPaymentId} | Get payment details |
| PaymentApi | getRefundDetails | GET /v1/refunds/{merchantRefundId} | Get refund details |
| PaymentApi | refundPayment | POST /v1/refunds | Refund a payment |
| WalletApi | checkWalletBalance | GET /v1/wallet/check_balance | Check user wallet balance |
| UserApi | getMaskedUserProfile | GET /v1/user/profile/secure?userAuthorizationId={userAuthorizationId} | Get masked user profile |
| UserApi | getUserAuthorizationStatus | GET /v1/user/authorizations?userAuthorizationId={userAuthorizationId} | Get user authorization status |
| UserApi | unlinkUser | DELETE /v1/user/authorizations/{userAuthorizationId} | Unlink user |
- Capture
- CaptureObject
- PaymentDetails
- RefundDetails
- WalletBalance
- BalanceData
- QRCodeDetails
- MerchantOrderItem
- MerchantOrderItemResponse
- MoneyAmount
- NotDataResponse
- Payment
- PaymentDetails
- PaymentMethodDetails
- PaymentMethodListDetails
- PaymentOrder
- PaymentOrderDetails
- PaymentState
- PaymentStateCaptures
- PaymentStateRefunds
- PaymentStateRevert
- ProductType
- QRCode
- QRCodeResponse
- Refund
- RefundOrder
- RefundState
- ResultInfo
- AccountLinkQRCode