while integrating paypal in spring boot app im getting this issue
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
***************************
APPLICATION FAILED TO START
***************************
Description:
Field apiContext in com.bookstore.service.impl.PaypalService required a bean of type 'com.paypal.base.rest.APIContext' that could not be found.
Action:
Consider defining a bean of type 'com.paypal.base.rest.APIContext' in your configuration.
my main looks like
@SpringBootApplication
@EnableAutoConfiguration
@Configuration
@ComponentScan
public class BookstoreAngularApplication implements CommandLineRunner {
the error points to the service where i have used api context of paypal
import com.paypal.api.payments.Transaction;
import com.paypal.base.rest.APIContext;
import com.paypal.base.rest.PayPalRESTException;
@Autowired
private APIContext apiContext;
public Payment createPayment(
Double total,
String currency,
PaypalPaymentMethod method,
PaypalPaymentIntent intent,
String description,
String cancelUrl,
String successUrl) throws PayPalRESTException{
Amount amount = new Amount();
amount.setCurrency(currency);
amount.setTotal(total.toString());
Transaction transaction = new Transaction();
transaction.setDescription(description);
transaction.setAmount(amount);
List<Transaction> transactions = new ArrayList<>();
transactions.add(transaction);
Payer payer = new Payer();
payer.setPaymentMethod(method.toString());
Payment payment = new Payment();
payment.setIntent(intent.toString());
payment.setPayer(payer);
payment.setTransactions(transactions);
RedirectUrls redirectUrls = new RedirectUrls();
redirectUrls.setCancelUrl(cancelUrl);
redirectUrls.setReturnUrl(successUrl);
payment.setRedirectUrls(redirectUrls);
return payment.create(apiContext);
}
public Payment executePayment(String paymentId, String payerId) throws PayPalRESTException{
Payment payment = new Payment();
payment.setId(paymentId);
PaymentExecution paymentExecute = new PaymentExecution();
paymentExecute.setPayerId(payerId);
return payment.execute(apiContext, paymentExecute);
}
i have project running the paypal sdk working fine but when i add it to my app im sicking this error of paypal api context