Class PaymentProcessor

java.lang.Object
ru.loolzaaa.youkassa.processors.PaymentProcessor

public class PaymentProcessor extends Object
Processor for Payment entity.

The API allows you to create, confirm, cancel payments, as well as receive information about them.

Use ApiClient for API server communication.

  • Constructor Details

    • PaymentProcessor

      public PaymentProcessor()
  • Method Details

    • findById

      public Payment findById(String paymentId)
      Receive information about some Payment by its identifier.
      Parameters:
      paymentId - payment identifier
      Returns:
      payment entity with actual status
      Throws:
      IllegalArgumentException - if payment id is null or empty
    • findAll

      public PaginatedResponse<Payment> findAll(PaymentList paymentList)
      Receive information about all payments with some filter conditions.
      Parameters:
      paymentList - collection with filter conditions
      Returns:
      listed payment entities
      See Also:
    • create

      public Payment create(Payment paymentParams, String idempotencyKey)
      Creates new Payment entity with certain parameters.

      Generate random idempotency key if corresponding argument is null.

      Parameters:
      paymentParams - parameters for new payment
      idempotencyKey - idempotency key
      Returns:
      new payment entity with actual status
      Throws:
      IllegalArgumentException - if payment parameters is null
    • capture

      public Payment capture(String paymentId, Payment paymentParams, String idempotencyKey)
      Capture Payment that holds in waiting_for_capture status.

      Needs when payment was creates with capture = false (default) parameter.

      Generate random idempotency key if corresponding argument is null.

      Parameters:
      paymentId - payment identifier to be capture
      paymentParams - capture parameters
      idempotencyKey - idempotency key
      Returns:
      payment entity with actual status
      Throws:
      IllegalArgumentException - if payment identifier is null or empty, and if capture parameters is null
    • cancel

      public Payment cancel(String paymentId, String idempotencyKey)
      Cancel already created Payment by its identifier.

      Generate random idempotency key if corresponding argument is null.

      Parameters:
      paymentId - payment identifier to be canceled
      idempotencyKey - idempotency key
      Returns:
      payment entity with actual status
      Throws:
      IllegalArgumentException - if payment identifier is null or empty