use of jp.ne.paypay.api.PendingPaymentApi in project paypayopa-sdk-java by paypay.
the class PendingPaymentApiExample method main.
public static void main(String[] args) throws ApiException {
ApiClient apiClient = new Configuration().getDefaultApiClient();
apiClient.setProductionMode(false);
apiClient.setApiKey("API_KEY");
apiClient.setApiSecretKey("API_SECRET_KEY");
apiClient.setAssumeMerchant("ASSUME_MERCHANT_ID");
String userAuthorizationId = "USER_AUTHORIZATION_ID";
PendingPaymentApi pendingPaymentApi = new PendingPaymentApi(apiClient);
PaymentApi paymentApi = new PaymentApi(apiClient);
PaymentDetails paymentDetails = pendingPayment(pendingPaymentApi, userAuthorizationId, 2);
if (paymentDetails != null && paymentDetails.getData() != null) {
String merchantPaymentId = paymentDetails.getData().getMerchantPaymentId();
getPendingPaymentDetails(pendingPaymentApi, merchantPaymentId);
// Cancel Pending Order
cancelPendingPayment(pendingPaymentApi, merchantPaymentId);
// Refund payment. Run this after payment is complete
refundPendingPayment(paymentApi, pendingPaymentApi, paymentDetails.getData().getPaymentId());
}
}
Aggregations