Class Client.PaymentMethodsClient
- Enclosing class:
- Client
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactivate(PaymentMethodActionParams params) archive(PaymentMethodActionParams params) Confirms a payment method verification with the token sent to the customer (POST /payment_methods/confirm_verification).delete(DeletePaymentMethodParams params) Deletes a saved payment method (POST /payment_methods/delete).disactivate(PaymentMethodActionParams params) disactivate(String paymentMethodId) Retrieves details of a saved payment method by ID (POST /payment_methods/lookup).page(PagePaymentMethodsParams params) settings()Retrieves payment method acceptance settings for your application (POST /payment_methods/settings).tokenize(TokenizePaymentMethodParams params) Tokenizes and saves a payment method for future use (POST /payment_methods/tokenize).tokenize(TokenizePaymentMethodParams params, RequestOptions options) unarchive(PaymentMethodActionParams params) update(UpdatePaymentMethodParams params) update(UpdatePaymentMethodParams params, RequestOptions options) verify(VerifyPaymentMethodParams params) Sends a verification challenge for a saved payment method (POST /payment_methods/verify).
-
Constructor Details
-
PaymentMethodsClient
-
-
Method Details
-
tokenize
public PaymentMethod tokenize(TokenizePaymentMethodParams params) throws IOException, InterruptedException, ApiException Tokenizes and saves a payment method for future use (POST /payment_methods/tokenize).Creates a reusable payment method token from payment details (mobile money account, card, etc.). The tokenized method can be charged without requiring the customer to re-enter payment information. Mobile money payment methods may require verification before they can be charged.
- Parameters:
params- tokenization parameters including customer ID and payment method details- Returns:
PaymentMethodwith the tokenized payment method- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if invalid payment details or tokenization fails
-
tokenize
public PaymentMethod tokenize(TokenizePaymentMethodParams params, RequestOptions options) throws IOException, InterruptedException, ApiException -
verify
public PaymentMethodVerificationSession verify(String paymentMethodId) throws IOException, InterruptedException, ApiException Sends a verification challenge for a saved payment method (POST /payment_methods/verify).Initiates verification by sending a code to the payment method (e.g., SMS to the mobile money number). The customer must submit this code via the confirm verification endpoint to complete verification. Verified payment methods can be charged without additional confirmation steps.
- Parameters:
paymentMethodId- unique identifier of the payment method to verify- Returns:
PaymentMethodVerificationSessionwith verification session details- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if payment method not found or verification cannot be initiated
-
verify
public PaymentMethodVerificationSession verify(VerifyPaymentMethodParams params) throws IOException, InterruptedException, ApiException -
confirmVerification
public PaymentMethod confirmVerification(ConfirmPaymentMethodVerificationParams params) throws IOException, InterruptedException, ApiException Confirms a payment method verification with the token sent to the customer (POST /payment_methods/confirm_verification).Completes the verification process by validating the code the customer received. Once verified, the payment method's
verifiedflag is set to true and it can be charged without additional confirmation steps.- Parameters:
params- confirmation parameters including payment method ID and verification token- Returns:
PaymentMethodwith the verified payment method- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if token invalid, session expired, or maximum attempts exceeded
-
lookup
public PaymentMethod lookup(String paymentMethodId) throws IOException, InterruptedException, ApiException Retrieves details of a saved payment method by ID (POST /payment_methods/lookup).Returns payment method information including type, masked details, verification status, and associated customer. Sensitive information (full card numbers, account numbers) is not returned.
- Parameters:
paymentMethodId- unique identifier of the payment method- Returns:
PaymentMethodcontaining payment method details- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if payment method not found (404)
-
page
public PaymentMethodPage page(PagePaymentMethodsParams params) throws IOException, InterruptedException, ApiException -
update
public PaymentMethod update(UpdatePaymentMethodParams params) throws IOException, InterruptedException, ApiException -
update
public PaymentMethod update(UpdatePaymentMethodParams params, RequestOptions options) throws IOException, InterruptedException, ApiException -
activate
public PaymentMethod activate(String paymentMethodId) throws IOException, InterruptedException, ApiException -
activate
public PaymentMethod activate(PaymentMethodActionParams params) throws IOException, InterruptedException, ApiException -
disactivate
public PaymentMethod disactivate(String paymentMethodId) throws IOException, InterruptedException, ApiException -
disactivate
public PaymentMethod disactivate(PaymentMethodActionParams params) throws IOException, InterruptedException, ApiException -
archive
public PaymentMethod archive(String paymentMethodId) throws IOException, InterruptedException, ApiException -
archive
public PaymentMethod archive(PaymentMethodActionParams params) throws IOException, InterruptedException, ApiException -
unarchive
public PaymentMethod unarchive(String paymentMethodId) throws IOException, InterruptedException, ApiException -
unarchive
public PaymentMethod unarchive(PaymentMethodActionParams params) throws IOException, InterruptedException, ApiException -
delete
public PaymentMethodDeletion delete(String paymentMethodId) throws IOException, InterruptedException, ApiException Deletes a saved payment method (POST /payment_methods/delete).Permanently removes the payment method from the customer's account. Deleted payment methods cannot be recovered or used for future charges. Any in-progress payments using this method will continue to completion.
- Parameters:
paymentMethodId- unique identifier of the payment method to delete- Returns:
PaymentMethodDeletionconfirming deletion- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if payment method not found (404) or cannot be deleted
-
delete
public PaymentMethodDeletion delete(DeletePaymentMethodParams params) throws IOException, InterruptedException, ApiException -
settings
Retrieves payment method acceptance settings for your application (POST /payment_methods/settings).Returns configuration for which payment method types are enabled, supported countries and currencies, and any acceptance rules or restrictions.
- Returns:
PaymentMethodSettingswith acceptance settings- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if unauthorized (401)
-